Character overlay block
|
After Width: | Height: | Size: 173 B |
|
After Width: | Height: | Size: 173 B |
|
After Width: | Height: | Size: 225 B |
|
After Width: | Height: | Size: 202 B |
|
After Width: | Height: | Size: 101 B |
|
After Width: | Height: | Size: 175 B |
|
After Width: | Height: | Size: 227 B |
|
After Width: | Height: | Size: 205 B |
|
After Width: | Height: | Size: 174 B |
|
After Width: | Height: | Size: 298 B |
|
After Width: | Height: | Size: 201 B |
|
After Width: | Height: | Size: 186 B |
|
After Width: | Height: | Size: 102 B |
|
After Width: | Height: | Size: 174 B |
|
After Width: | Height: | Size: 165 B |
|
After Width: | Height: | Size: 237 B |
|
After Width: | Height: | Size: 167 B |
|
After Width: | Height: | Size: 249 B |
|
After Width: | Height: | Size: 243 B |
|
After Width: | Height: | Size: 194 B |
|
After Width: | Height: | Size: 105 B |
|
After Width: | Height: | Size: 191 B |
|
After Width: | Height: | Size: 267 B |
|
After Width: | Height: | Size: 234 B |
|
After Width: | Height: | Size: 172 B |
|
After Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 178 B |
|
After Width: | Height: | Size: 161 B |
|
After Width: | Height: | Size: 362 B |
|
After Width: | Height: | Size: 187 B |
|
After Width: | Height: | Size: 208 B |
|
After Width: | Height: | Size: 85 B |
|
After Width: | Height: | Size: 83 B |
|
After Width: | Height: | Size: 170 B |
|
After Width: | Height: | Size: 72 B |
|
After Width: | Height: | Size: 107 B |
|
After Width: | Height: | Size: 84 B |
|
After Width: | Height: | Size: 100 B |
|
After Width: | Height: | Size: 84 B |
|
After Width: | Height: | Size: 156 B |
|
After Width: | Height: | Size: 159 B |
|
After Width: | Height: | Size: 92 B |
|
After Width: | Height: | Size: 93 B |
|
After Width: | Height: | Size: 167 B |
|
After Width: | Height: | Size: 173 B |
|
After Width: | Height: | Size: 208 B |
|
After Width: | Height: | Size: 106 B |
|
After Width: | Height: | Size: 200 B |
|
After Width: | Height: | Size: 74 B |
|
After Width: | Height: | Size: 153 B |
|
After Width: | Height: | Size: 179 B |
|
After Width: | Height: | Size: 156 B |
|
After Width: | Height: | Size: 125 B |
|
After Width: | Height: | Size: 75 B |
|
After Width: | Height: | Size: 311 B |
|
After Width: | Height: | Size: 99 B |
|
After Width: | Height: | Size: 89 B |
|
After Width: | Height: | Size: 183 B |
|
After Width: | Height: | Size: 118 B |
|
After Width: | Height: | Size: 77 B |
|
After Width: | Height: | Size: 262 B |
|
After Width: | Height: | Size: 192 B |
|
After Width: | Height: | Size: 105 B |
|
After Width: | Height: | Size: 105 B |
|
After Width: | Height: | Size: 161 B |
@@ -614,3 +614,4 @@
|
|||||||
63068=colored-wall|block-colored-wall-ui
|
63068=colored-wall|block-colored-wall-ui
|
||||||
63067=crux-floor-11|block-crux-floor-11-ui
|
63067=crux-floor-11|block-crux-floor-11-ui
|
||||||
63066=crux-floor-12|block-crux-floor-12-ui
|
63066=crux-floor-12|block-crux-floor-12-ui
|
||||||
|
63065=character-overlay|block-character-overlay-ui
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ public class Blocks{
|
|||||||
|
|
||||||
//colored
|
//colored
|
||||||
coloredFloor, coloredWall,
|
coloredFloor, coloredWall,
|
||||||
|
characterOverlay,
|
||||||
|
|
||||||
pebbles, tendrils,
|
pebbles, tendrils,
|
||||||
|
|
||||||
@@ -912,6 +913,10 @@ public class Blocks{
|
|||||||
autotile = true;
|
autotile = true;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
characterOverlay = new CharacterOverlay("character-overlay"){{
|
||||||
|
color = Pal.metalGrayDark;
|
||||||
|
}};
|
||||||
|
|
||||||
Seq.with(metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5, darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6)
|
Seq.with(metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5, darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6)
|
||||||
.each(b -> b.asFloor().wall = darkMetal);
|
.each(b -> b.asFloor().wall = darkMetal);
|
||||||
|
|
||||||
|
|||||||
@@ -961,7 +961,7 @@ public class Block extends UnlockableContent implements Senseable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Called when building of this block ends. */
|
/** Called when building of this block ends. */
|
||||||
public void placeEnded(Tile tile, @Nullable Unit builder, @Nullable Object config){
|
public void placeEnded(Tile tile, @Nullable Unit builder, int rotation, @Nullable Object config){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public class ConstructBlock extends Block{
|
|||||||
if(shouldPlay()) block.placeSound.at(tile, block.placePitchChange ? calcPitch(true) : 1f);
|
if(shouldPlay()) block.placeSound.at(tile, block.placePitchChange ? calcPitch(true) : 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
block.placeEnded(tile, builder, config);
|
block.placeEnded(tile, builder, rotation, config);
|
||||||
|
|
||||||
Events.fire(new BlockBuildEndEvent(tile, builder, team, false, config));
|
Events.fire(new BlockBuildEndEvent(tile, builder, team, false, config));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package mindustry.world.blocks.environment;
|
||||||
|
|
||||||
|
import arc.graphics.*;
|
||||||
|
import arc.graphics.g2d.*;
|
||||||
|
import arc.util.*;
|
||||||
|
import mindustry.annotations.Annotations.*;
|
||||||
|
import mindustry.gen.*;
|
||||||
|
import mindustry.world.*;
|
||||||
|
|
||||||
|
public class CharacterOverlay extends OverlayFloor{
|
||||||
|
/** This is a reduced character set! It is not ASCII! */
|
||||||
|
public static final String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\"!?.,;:()[]{}<>|/@\\^-%+=#_&~";
|
||||||
|
|
||||||
|
public @Load(value = "character-overlay#", length = 64) TextureRegion[] letterRegions;
|
||||||
|
public Color color = Color.white;
|
||||||
|
|
||||||
|
public CharacterOverlay(String name){
|
||||||
|
super(name);
|
||||||
|
saveData = true;
|
||||||
|
variants = 0;
|
||||||
|
rotate = true;
|
||||||
|
drawArrow = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBase(Tile tile){
|
||||||
|
Draw.color(color);
|
||||||
|
int letterChar = CharOverlayData.character(tile.overlayData);
|
||||||
|
Draw.rect(letterRegions[letterChar], tile.worldx(), tile.worldy(), CharOverlayData.rotation(tile.overlayData) * 90f);
|
||||||
|
Draw.color();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void placeEnded(Tile tile, @Nullable Unit builder, int rotation, @Nullable Object config){
|
||||||
|
byte data = 0;
|
||||||
|
if(config instanceof Integer i){
|
||||||
|
data = i.byteValue();
|
||||||
|
}
|
||||||
|
tile.overlayData = CharOverlayData.get(data, (byte)rotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte charToData(char c){
|
||||||
|
int index = chars.indexOf(Character.toUpperCase(c));
|
||||||
|
return index == -1 ? 0 : (byte)index;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Struct
|
||||||
|
class CharOverlayDataStruct{
|
||||||
|
@StructField(6)
|
||||||
|
byte character;
|
||||||
|
@StructField(2)
|
||||||
|
byte rotation;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -140,7 +140,7 @@ public class ColoredFloor extends Floor{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void placeEnded(Tile tile, @Nullable Unit builder, @Nullable Object config){
|
public void placeEnded(Tile tile, @Nullable Unit builder, int rotation, @Nullable Object config){
|
||||||
//config is assumed to be an integer RGBA color
|
//config is assumed to be an integer RGBA color
|
||||||
if(config instanceof Integer i){
|
if(config instanceof Integer i){
|
||||||
tile.extraData = i;
|
tile.extraData = i;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class ColoredWall extends StaticWall{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void placeEnded(Tile tile, @Nullable Unit builder, @Nullable Object config){
|
public void placeEnded(Tile tile, @Nullable Unit builder, int rotation, @Nullable Object config){
|
||||||
//config is assumed to be an integer RGBA color
|
//config is assumed to be an integer RGBA color
|
||||||
if(config instanceof Integer i){
|
if(config instanceof Integer i){
|
||||||
tile.extraData = i;
|
tile.extraData = i;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class RemoveOre extends OverlayFloor{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void placeEnded(Tile tile, @Nullable Unit builder, Object config){
|
public void placeEnded(Tile tile, @Nullable Unit builder, int rotation, Object config){
|
||||||
tile.setOverlay(Blocks.air);
|
tile.setOverlay(Blocks.air);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class RemoveWall extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void placeEnded(Tile tile, @Nullable Unit builder, Object config){
|
public void placeEnded(Tile tile, @Nullable Unit builder, int rotation, Object config){
|
||||||
tile.setBlock(Blocks.air);
|
tile.setBlock(Blocks.air);
|
||||||
if(tile.overlay().wallOre){
|
if(tile.overlay().wallOre){
|
||||||
tile.setOverlay(Blocks.air);
|
tile.setOverlay(Blocks.air);
|
||||||
|
|||||||