Character overlay block

This commit is contained in:
Anuken
2025-07-18 13:57:07 -04:00
parent 78c604946e
commit 4abc2aba8c
74 changed files with 66 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

View File

@@ -614,3 +614,4 @@
63068=colored-wall|block-colored-wall-ui
63067=crux-floor-11|block-crux-floor-11-ui
63066=crux-floor-12|block-crux-floor-12-ui
63065=character-overlay|block-character-overlay-ui

View File

@@ -68,6 +68,7 @@ public class Blocks{
//colored
coloredFloor, coloredWall,
characterOverlay,
pebbles, tendrils,
@@ -912,6 +913,10 @@ public class Blocks{
autotile = true;
}};
characterOverlay = new CharacterOverlay("character-overlay"){{
color = Pal.metalGrayDark;
}};
Seq.with(metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5, darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6)
.each(b -> b.asFloor().wall = darkMetal);

View File

@@ -961,7 +961,7 @@ public class Block extends UnlockableContent implements Senseable{
}
/** 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){
}

View File

@@ -112,7 +112,7 @@ public class ConstructBlock extends Block{
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));
}

View File

@@ -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;
}
}

View File

@@ -140,7 +140,7 @@ public class ColoredFloor extends Floor{
}
@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
if(config instanceof Integer i){
tile.extraData = i;

View File

@@ -46,7 +46,7 @@ public class ColoredWall extends StaticWall{
}
@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
if(config instanceof Integer i){
tile.extraData = i;

View File

@@ -44,7 +44,7 @@ public class RemoveOre extends OverlayFloor{
}
@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);
}

View File

@@ -43,7 +43,7 @@ public class RemoveWall extends Block{
}
@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);
if(tile.overlay().wallOre){
tile.setOverlay(Blocks.air);