Crux language runes
This commit is contained in:
@@ -69,6 +69,8 @@ public class Blocks{
|
||||
coloredFloor, coloredWall,
|
||||
characterOverlayGray,
|
||||
characterOverlayWhite,
|
||||
runeOverlay,
|
||||
cruxRuneOverlay,
|
||||
|
||||
pebbles, tendrils,
|
||||
|
||||
@@ -924,6 +926,12 @@ public class Blocks{
|
||||
color = Color.white;
|
||||
}};
|
||||
|
||||
runeOverlay = new RuneOverlay("rune-overlay"){{
|
||||
color = Pal.metalGrayDark;
|
||||
}};
|
||||
|
||||
cruxRuneOverlay = new RuneOverlay("rune-overlay-crux");
|
||||
|
||||
Seq.with(metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5, darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6)
|
||||
.each(b -> b.asFloor().wall = darkMetal);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mindustry.graphics;
|
||||
|
||||
import arc.*;
|
||||
import arc.assets.loaders.TextureLoader.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.Texture.*;
|
||||
import arc.graphics.g2d.*;
|
||||
@@ -88,14 +89,15 @@ public class EnvRenderers{
|
||||
Draw.blend();
|
||||
});
|
||||
|
||||
Core.assets.load("sprites/distortAlpha.png", Texture.class);
|
||||
Core.assets.load("sprites/distortAlpha.png", Texture.class, new TextureParameter(){{
|
||||
magFilter = TextureFilter.linear;
|
||||
minFilter = TextureFilter.mipMapLinearLinear;
|
||||
wrapU = wrapV = TextureWrap.repeat;
|
||||
genMipMaps = true;
|
||||
}});
|
||||
|
||||
renderer.addEnvRenderer(Env.scorching, () -> {
|
||||
Texture tex = Core.assets.get("sprites/distortAlpha.png", Texture.class);
|
||||
if(tex.getMagFilter() != TextureFilter.linear){
|
||||
tex.setFilter(TextureFilter.linear);
|
||||
tex.setWrap(TextureWrap.repeat);
|
||||
}
|
||||
|
||||
//TODO layer looks better? should not be conditional
|
||||
Draw.z(state.rules.fog ? Layer.fogOfWar + 1 : Layer.weather - 1);
|
||||
|
||||
85
core/src/mindustry/world/blocks/environment/RuneOverlay.java
Normal file
85
core/src/mindustry/world/blocks/environment/RuneOverlay.java
Normal file
@@ -0,0 +1,85 @@
|
||||
package mindustry.world.blocks.environment;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
public class RuneOverlay extends OverlayFloor{
|
||||
public static final int characters = 109;
|
||||
|
||||
public @Load(value = "@#", fallback = "rune-overlay#", length = characters) TextureRegion[] letterRegions;
|
||||
public Color color = Color.white;
|
||||
|
||||
public RuneOverlay(String name){
|
||||
super(name);
|
||||
saveData = true;
|
||||
variants = 0;
|
||||
saveConfig = true;
|
||||
editorConfigurable = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBase(Tile tile){
|
||||
|
||||
Draw.color(color);
|
||||
if((tile.overlayData & 0xff) < characters){
|
||||
Draw.rect(letterRegions[tile.overlayData & 0xff], tile.worldx(), tile.worldy());
|
||||
}
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getConfig(Tile tile){
|
||||
return (int)tile.overlayData;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
|
||||
byte data = 0;
|
||||
|
||||
if(plan.config instanceof Integer i){
|
||||
data = i.byteValue();
|
||||
}
|
||||
|
||||
int letterChar = data & 0xff;
|
||||
|
||||
if(letterChar < characters){
|
||||
TextureRegion reg = letterRegions[letterChar];
|
||||
Draw.tint(color);
|
||||
Draw.rect(reg, plan.drawx(), plan.drawy());
|
||||
Draw.tint(Color.white);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPicked(Tile tile){
|
||||
Vars.control.input.rotation = CharOverlayData.rotation(tile.overlayData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildEditorConfig(Table table){
|
||||
int value = lastConfig instanceof Integer i ? i : 0;
|
||||
table.field(value + "", val -> lastConfig = Strings.parseInt(val))
|
||||
.valid(t -> Strings.canParsePositiveInt(t) && Strings.parseInt(t, 999) < characters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placeEnded(Tile tile, @Nullable Unit builder, int rotation, @Nullable Object config){
|
||||
if(config instanceof Integer i){
|
||||
tile.overlayData = i.byteValue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editorPicked(Tile tile){
|
||||
lastConfig = tile.overlayData;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user