diff --git a/src/aeyama/world/block/ModuleableBlock.java b/src/aeyama/world/block/ModuleableBlock.java index 0aff06d..160a874 100644 --- a/src/aeyama/world/block/ModuleableBlock.java +++ b/src/aeyama/world/block/ModuleableBlock.java @@ -9,15 +9,21 @@ import mindustry.gen.*; import mindustry.graphics.*; import mindustry.world.*; -import aeyama.world.block.module.ModuleBlock.*; +import mindustry.world.draw.*; + +import aeyama.world.block.ModuleBlock.*; import static mindustry.Vars.tilesize; public class ModuleableBlock extends Block { /** The amount of available module slots to the player. */ public int moduleSlots; + /** Filter the modules this block accept. */ + public Seq tags = new Seq(); private TextureRegion moduleSlotTexture; + public DrawBlock drawer = new DrawDefault(); + public ModuleableBlock(String name, int moduleSlots) { super(name); @@ -49,12 +55,13 @@ public void init() { public void load() { super.load(); + drawer.load(this); moduleSlotTexture = Core.atlas.find("aeyama-module-slot"); } @Override public void drawPlanRegion(BuildPlan plan, Eachable list) { - super.drawPlanRegion(plan, list); + drawer.drawPlan(this, plan, list);; drawModuleSlots(plan.getX(), plan.getY(), plan.block.size, plan.rotation); } @@ -95,14 +102,24 @@ public void drawModuleSlots(float x, float y, int size, int rotation) { } } + @Override + protected TextureRegion[] icons() { + return drawer.finalIcons(this); + } + + @Override + public void getRegionsToOutline(Seq out) { + drawer.getRegionsToOutline(this, out); + } + public class ModuleableBuild extends Building { - public Seq modules = new Seq(); + public Seq modules = new Seq(); @Override public void onProximityUpdate() { - proximity.each(this::isModule, t -> { - ((ModuleBuild)t).linkedBuild = this; - modules.add(t); + proximity.each(this::isModule, module -> { + ((ModuleBuild)module).linkedBuild = this; + modules.add((ModuleBuild)module); }); super.onProximityUpdate(); @@ -119,10 +136,16 @@ public boolean isModule(Building build, Building tile) { @Override public void draw() { - super.draw(); + drawer.draw(this); drawModuleSlots(this.x, this.y, this.block.size, rotation); } + + @Override + public void drawLight() { + super.drawLight(); + drawer.drawLight(this); + } @Override public void drawSelect() {