WIP schematic part idea

This commit is contained in:
Anuken 2023-05-06 21:17:41 -04:00
parent bc622bd7ba
commit 4039556aae
2 changed files with 75 additions and 0 deletions

View File

@ -79,6 +79,8 @@ public class Blocks{
//sandbox
powerSource, powerVoid, itemSource, itemVoid, liquidSource, liquidVoid, payloadSource, payloadVoid, illuminator, heatSource,
partInput, partOutput,
//defense
copperWall, copperWallLarge, titaniumWall, titaniumWallLarge, plastaniumWall, plastaniumWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge,
phaseWall, phaseWallLarge, surgeWall, surgeWallLarge,
@ -5742,6 +5744,14 @@ public class Blocks{
ambientSound = Sounds.none;
}};
partInput = new PartMarker("part-input"){{
requirements(Category.crafting, BuildVisibility.debugOnly, with());
}};
partOutput = new PartMarker("part-output"){{
requirements(Category.crafting, BuildVisibility.debugOnly, with());
}};
//TODO move
illuminator = new LightBlock("illuminator"){{
requirements(Category.effect, BuildVisibility.lightingOnly, with(Items.graphite, 12, Items.silicon, 8, Items.lead, 8));

View File

@ -0,0 +1,65 @@
package mindustry.world.blocks.logic;
import arc.graphics.g2d.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.annotations.Annotations.*;
import mindustry.ctype.*;
import mindustry.gen.*;
import mindustry.io.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.meta.*;
/** For internal use only; marks base part edges. */
public class PartMarker extends Block{
public @Load("@-arrow") TextureRegion arrowRegion;
public PartMarker(String name){
super(name);
update = true;
rotate = true;
configurable = true;
saveConfig = true;
group = BlockGroup.transportation;
config(Item.class, (PartMarkerBuild tile, Item item) -> tile.content = item);
config(Liquid.class, (PartMarkerBuild tile, Liquid item) -> tile.content = item);
configClear((PartMarkerBuild tile) -> tile.content = null);
}
public class PartMarkerBuild extends Building{
public @Nullable UnlockableContent content;
@Override
public void draw(){
super.draw();
Draw.rect(arrowRegion, x, y);
if(content != null){
float size = 4f;
Draw.rect(content.fullIcon, x, y, size, size);
}
}
@Override
public UnlockableContent config(){
return content;
}
@Override
public void write(Writes write){
super.write(write);
TypeIO.writeContent(write, content);
}
@Override
public void read(Reads read, byte revision){
super.read(read, revision);
content = TypeIO.readContent(read) instanceof UnlockableContent con ? con : null;
}
}
}