From 3b1066e16f74fd94272d4e7289fbccf9df0b1b43 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 28 Dec 2018 16:54:19 -0500 Subject: [PATCH] Removed block bars / Fixed some input issues --- .../mindustry/content/blocks/DebugBlocks.java | 13 ------ .../io/anuke/mindustry/input/MobileInput.java | 4 +- .../src/io/anuke/mindustry/world/BarType.java | 18 -------- core/src/io/anuke/mindustry/world/Block.java | 9 ---- .../mindustry/world/blocks/BuildBlock.java | 7 ---- .../world/blocks/defense/ForceProjector.java | 9 ---- .../blocks/defense/turrets/ItemTurret.java | 8 ---- .../blocks/defense/turrets/LiquidTurret.java | 9 ---- .../world/blocks/distribution/Conveyor.java | 3 -- .../blocks/distribution/LiquidJunction.java | 7 ---- .../world/blocks/distribution/Router.java | 8 ---- .../world/blocks/power/ItemGenerator.java | 8 ---- .../world/blocks/power/NuclearReactor.java | 9 ---- .../world/blocks/power/PowerNode.java | 4 -- .../blocks/production/GenericCrafter.java | 10 ----- .../world/blocks/production/Incinerator.java | 7 ---- .../world/blocks/production/LiquidMixer.java | 11 ----- .../world/blocks/production/PowerSmelter.java | 12 ------ .../world/blocks/production/Smelter.java | 9 ---- .../world/blocks/storage/CoreBlock.java | 8 ---- .../world/blocks/storage/SortedUnloader.java | 3 -- .../world/blocks/storage/StorageBlock.java | 7 ---- .../world/blocks/units/UnitFactory.java | 10 ----- .../anuke/mindustry/world/meta/BlockBar.java | 20 --------- .../anuke/mindustry/world/meta/BlockBars.java | 42 ------------------- 25 files changed, 2 insertions(+), 253 deletions(-) delete mode 100644 core/src/io/anuke/mindustry/world/BarType.java delete mode 100644 core/src/io/anuke/mindustry/world/meta/BlockBar.java delete mode 100644 core/src/io/anuke/mindustry/world/meta/BlockBars.java diff --git a/core/src/io/anuke/mindustry/content/blocks/DebugBlocks.java b/core/src/io/anuke/mindustry/content/blocks/DebugBlocks.java index 9dc2a3cd6b..06db127bb0 100644 --- a/core/src/io/anuke/mindustry/content/blocks/DebugBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/DebugBlocks.java @@ -10,7 +10,6 @@ import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.game.ContentList; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Liquid; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.PowerBlock; @@ -44,12 +43,6 @@ public class DebugBlocks extends BlockList implements ContentList{ shadow = "shadow-round-1"; } - @Override - public void setBars(){ - super.setBars(); - bars.remove(BarType.power); - } - @Override public void init(){ super.init(); @@ -83,12 +76,6 @@ public class DebugBlocks extends BlockList implements ContentList{ return true; } - @Override - public void setBars(){ - super.setBars(); - bars.remove(BarType.inventory); - } - @Override public void update(Tile tile){ SorterEntity entity = tile.entity(); diff --git a/core/src/io/anuke/mindustry/input/MobileInput.java b/core/src/io/anuke/mindustry/input/MobileInput.java index e187353ed8..101be9c646 100644 --- a/core/src/io/anuke/mindustry/input/MobileInput.java +++ b/core/src/io/anuke/mindustry/input/MobileInput.java @@ -679,8 +679,8 @@ public class MobileInput extends InputHandler implements GestureListener{ } }else{ //pan player - Core.camera.position.x += deltaX; - Core.camera.position.y += deltaY; + Core.camera.position.x -= deltaX; + Core.camera.position.y -= deltaY; } return false; diff --git a/core/src/io/anuke/mindustry/world/BarType.java b/core/src/io/anuke/mindustry/world/BarType.java deleted file mode 100644 index e36a7f4def..0000000000 --- a/core/src/io/anuke/mindustry/world/BarType.java +++ /dev/null @@ -1,18 +0,0 @@ -package io.anuke.mindustry.world; - -import io.anuke.arc.graphics.Color; - -public enum BarType{ - health(Color.SCARLET), - inventory(Color.GREEN), - power(Color.valueOf("fbeb67")), - liquid(Color.ROYAL), - heat(Color.CORAL), - production(Color.valueOf("f4ba6e")); - - public final Color color; - - BarType(Color color){ - this.color = color; - } -} diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index dce5a18421..981267bb94 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -79,8 +79,6 @@ public class Block extends BaseBlock { public boolean instantTransfer = false; /** The block group. Unless {@link #canReplace} is overriden, blocks in the same group can replace each other. */ public BlockGroup group = BlockGroup.none; - /** list of displayed block status bars. Defaults to health bar. */ - public BlockBars bars = new BlockBars(); /** List of block stats. */ public BlockStats stats = new BlockStats(this); /** List of block flags. Used for AI indexing. */ @@ -252,7 +250,6 @@ public class Block extends BaseBlock { } setStats(); - setBars(); consumes.checkRequired(this); } @@ -333,12 +330,6 @@ public class Block extends BaseBlock { if(hasItems) stats.add(BlockStat.itemCapacity, itemCapacity, StatUnit.items); } - public void setBars(){ - if(hasPower) bars.add(new BlockBar(BarType.power, true, tile -> tile.entity.power.amount / powerCapacity)); - if(hasLiquids) bars.add(new BlockBar(BarType.liquid, true, tile -> tile.entity.liquids.total() / liquidCapacity)); - if(hasItems) bars.add(new BlockBar(BarType.inventory, true, tile -> (float) tile.entity.items.total() / itemCapacity)); - } - public String name(){ return name; } diff --git a/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java b/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java index 65e84a528b..597097ca17 100644 --- a/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java @@ -23,10 +23,8 @@ import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.graphics.Shaders; import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.Recipe; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; -import io.anuke.mindustry.world.meta.BlockBar; import io.anuke.mindustry.world.modules.ItemModule; import java.io.DataInput; @@ -103,11 +101,6 @@ public class BuildBlock extends Block{ } } - @Override - public void setBars(){ - bars.replace(new BlockBar(BarType.health, true, tile -> tile.entity().progress)); - } - @Override public void onDestroyed(Tile tile){ Effects.effect(ExplosionFx.blockExplosionSmoke, tile); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java b/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java index b37ddd2386..fb3372a975 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java @@ -18,11 +18,9 @@ import io.anuke.mindustry.content.fx.BulletFx; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.traits.AbsorbTrait; import io.anuke.mindustry.graphics.Palette; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.consumers.ConsumeLiquidFilter; -import io.anuke.mindustry.world.meta.BlockBar; import io.anuke.mindustry.world.meta.BlockStat; import io.anuke.mindustry.world.meta.StatUnit; @@ -71,13 +69,6 @@ public class ForceProjector extends Block { stats.add(BlockStat.powerDamage, powerDamage, StatUnit.powerUnits); } - @Override - public void setBars(){ - super.setBars(); - - bars.add(new BlockBar(BarType.heat, true, tile -> tile.entity().buildup / breakage)); - } - @Override public void update(Tile tile){ ForceEntity entity = tile.entity(); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java index 28676ec0cc..bef0283f4c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java @@ -5,9 +5,7 @@ import io.anuke.mindustry.entities.Unit; import io.anuke.mindustry.type.AmmoEntry; import io.anuke.mindustry.type.AmmoType; import io.anuke.mindustry.type.Item; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Tile; -import io.anuke.mindustry.world.meta.BlockBar; import io.anuke.mindustry.world.meta.BlockStat; import io.anuke.mindustry.world.meta.values.ItemFilterValue; @@ -91,12 +89,6 @@ public class ItemTurret extends CooledTurret{ return ammoMap != null && ammoMap.get(item) != null && entity.totalAmmo + ammoMap.get(item).quantityMultiplier <= maxAmmo; } - @Override - public void setBars(){ - super.setBars(); - bars.replace(new BlockBar(BarType.inventory, true, tile -> (float) tile.entity().totalAmmo / maxAmmo)); - } - @Override public void init(){ super.init(); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LiquidTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LiquidTurret.java index eb6e402092..b96e0b9b0d 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LiquidTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LiquidTurret.java @@ -5,9 +5,7 @@ import io.anuke.mindustry.entities.effect.Fire; import io.anuke.mindustry.type.AmmoType; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Liquid; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Tile; -import io.anuke.mindustry.world.meta.BlockBar; import io.anuke.mindustry.world.meta.BlockStat; import io.anuke.mindustry.world.meta.values.LiquidFilterValue; import io.anuke.arc.entities.Effects; @@ -58,13 +56,6 @@ public abstract class LiquidTurret extends Turret{ super.findTarget(tile); } - @Override - public void setBars(){ - super.setBars(); - bars.remove(BarType.inventory); - bars.replace(new BlockBar(BarType.liquid, true, tile -> tile.entity.liquids.total() / liquidCapacity)); - } - @Override protected void effects(Tile tile){ AmmoType type = peekAmmo(tile); diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java b/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java index 73ed7c7f15..047619158c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java @@ -58,9 +58,6 @@ public class Conveyor extends Block{ return Float.compare(pos1.y, pos2.y); } - @Override - public void setBars(){} - @Override public void setStats(){ super.setStats(); diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/LiquidJunction.java b/core/src/io/anuke/mindustry/world/blocks/distribution/LiquidJunction.java index 2b0e142165..040f0efda8 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/LiquidJunction.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/LiquidJunction.java @@ -3,7 +3,6 @@ package io.anuke.mindustry.world.blocks.distribution; import io.anuke.arc.Core; import io.anuke.arc.graphics.g2d.TextureRegion; import io.anuke.mindustry.type.Liquid; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.LiquidBlock; import io.anuke.mindustry.world.meta.BlockStat; @@ -16,12 +15,6 @@ public class LiquidJunction extends LiquidBlock{ hasLiquids = true; } - @Override - public void setBars(){ - super.setBars(); - bars.remove(BarType.liquid); - } - @Override public void setStats(){ super.setStats(); diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/Router.java b/core/src/io/anuke/mindustry/world/blocks/distribution/Router.java index 2128fdca74..fe9ba5f5d5 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/Router.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/Router.java @@ -3,7 +3,6 @@ package io.anuke.mindustry.world.blocks.distribution; import io.anuke.arc.collection.Array; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.type.Item; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Edges; import io.anuke.mindustry.world.Tile; @@ -22,13 +21,6 @@ public class Router extends Block{ group = BlockGroup.transportation; } - @Override - public void setBars(){ - super.setBars(); - - bars.remove(BarType.inventory); - } - @Override public void update(Tile tile){ SplitterEntity entity = tile.entity(); diff --git a/core/src/io/anuke/mindustry/world/blocks/power/ItemGenerator.java b/core/src/io/anuke/mindustry/world/blocks/power/ItemGenerator.java index 798c4c5e70..5805b23edb 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/ItemGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/ItemGenerator.java @@ -6,10 +6,8 @@ import io.anuke.arc.graphics.g2d.TextureRegion; import io.anuke.mindustry.content.fx.BlockFx; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.type.Item; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.consumers.ConsumeItemFilter; -import io.anuke.mindustry.world.meta.BlockBar; import io.anuke.mindustry.world.meta.BlockStat; import io.anuke.mindustry.world.meta.StatUnit; import io.anuke.arc.entities.Effects; @@ -54,12 +52,6 @@ public abstract class ItemGenerator extends PowerGenerator{ stats.add(BlockStat.basePowerGeneration, powerOutput * 60f * 0.5f, StatUnit.powerSecond); } - @Override - public void setBars(){ - super.setBars(); - bars.replace(new BlockBar(BarType.inventory, true, tile -> (float) tile.entity.items.total() / itemCapacity)); - } - @Override public void draw(Tile tile){ super.draw(tile); diff --git a/core/src/io/anuke/mindustry/world/blocks/power/NuclearReactor.java b/core/src/io/anuke/mindustry/world/blocks/power/NuclearReactor.java index eb9343f4af..35b5e295b9 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/NuclearReactor.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/NuclearReactor.java @@ -14,9 +14,7 @@ import io.anuke.mindustry.content.fx.ExplosionFx; import io.anuke.mindustry.entities.Damage; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.type.Liquid; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Tile; -import io.anuke.mindustry.world.meta.BlockBar; import io.anuke.mindustry.world.meta.BlockStat; import io.anuke.mindustry.world.meta.StatUnit; import io.anuke.mindustry.world.meta.values.LiquidFilterValue; @@ -65,13 +63,6 @@ public class NuclearReactor extends PowerGenerator{ lightsRegion = Core.atlas.find(name + "-lights"); } - @Override - public void setBars(){ - super.setBars(); - bars.replace(new BlockBar(BarType.inventory, true, tile -> (float) tile.entity.items.get(consumes.item()) / itemCapacity)); - bars.add(new BlockBar(BarType.heat, true, tile -> tile.entity().heat)); - } - @Override public void setStats(){ super.setStats(); diff --git a/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java b/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java index 2fe071f99f..2690cc0e97 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java @@ -90,10 +90,6 @@ public class PowerNode extends PowerBlock{ } } - @Override - public void setBars(){ - } - @Override public void playerPlaced(Tile tile){ Tile before = world.tile(lastPlaced); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/GenericCrafter.java b/core/src/io/anuke/mindustry/world/blocks/production/GenericCrafter.java index 6e10b1ae13..a7968ef8cf 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/GenericCrafter.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/GenericCrafter.java @@ -6,11 +6,9 @@ import io.anuke.mindustry.content.fx.BlockFx; import io.anuke.mindustry.content.fx.Fx; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.type.Item; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.consumers.ConsumeItem; -import io.anuke.mindustry.world.meta.BlockBar; import io.anuke.mindustry.world.meta.BlockStat; import io.anuke.mindustry.world.meta.StatUnit; import io.anuke.arc.entities.Effects; @@ -39,14 +37,6 @@ public class GenericCrafter extends Block{ health = 60; } - @Override - public void setBars(){ - super.setBars(); - - if(consumes.has(ConsumeItem.class)) bars.replace(new BlockBar(BarType.inventory, true, - tile -> (float) tile.entity.items.get(consumes.item()) / itemCapacity)); - } - @Override public void init(){ super.init(); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Incinerator.java b/core/src/io/anuke/mindustry/world/blocks/production/Incinerator.java index 95e31acd16..973c20bada 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Incinerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Incinerator.java @@ -11,7 +11,6 @@ import io.anuke.mindustry.content.fx.BlockFx; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Liquid; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; @@ -29,12 +28,6 @@ public class Incinerator extends Block{ consumes.power(0.05f); } - @Override - public void setBars(){ - super.setBars(); - bars.remove(BarType.liquid); - } - @Override public void update(Tile tile){ IncineratorEntity entity = tile.entity(); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/LiquidMixer.java b/core/src/io/anuke/mindustry/world/blocks/production/LiquidMixer.java index 3351217fd1..be88688468 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/LiquidMixer.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/LiquidMixer.java @@ -2,11 +2,9 @@ package io.anuke.mindustry.world.blocks.production; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.type.Liquid; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.LiquidBlock; import io.anuke.mindustry.world.consumers.ConsumeLiquid; -import io.anuke.mindustry.world.meta.BlockBar; import io.anuke.mindustry.world.meta.BlockStat; import io.anuke.mindustry.world.meta.StatUnit; import io.anuke.mindustry.world.modules.LiquidModule; @@ -40,15 +38,6 @@ public class LiquidMixer extends LiquidBlock{ stats.add(BlockStat.liquidOutputSpeed, 60f * consumes.get(ConsumeLiquid.class).used(), StatUnit.liquidSecond); } - @Override - public void setBars(){ - super.setBars(); - - bars.remove(BarType.liquid); - bars.add(new BlockBar(BarType.liquid, true, tile -> tile.entity.liquids.get(consumes.liquid()) / liquidCapacity)); - bars.add(new BlockBar(BarType.liquid, true, tile -> tile.entity.liquids.get(outputLiquid) / liquidCapacity)); - } - @Override public boolean shouldConsume(Tile tile){ return tile.entity.liquids.get(outputLiquid) < liquidCapacity; diff --git a/core/src/io/anuke/mindustry/world/blocks/production/PowerSmelter.java b/core/src/io/anuke/mindustry/world/blocks/production/PowerSmelter.java index 99fa0b6f1b..71af723295 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/PowerSmelter.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/PowerSmelter.java @@ -7,10 +7,8 @@ import io.anuke.mindustry.content.fx.BlockFx; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.ItemStack; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.PowerBlock; -import io.anuke.mindustry.world.meta.BlockBar; import io.anuke.mindustry.world.meta.BlockStat; import io.anuke.mindustry.world.meta.StatUnit; import io.anuke.arc.entities.Effects; @@ -70,16 +68,6 @@ public class PowerSmelter extends PowerBlock{ topRegion = Core.atlas.find(name + "-top"); } - @Override - public void setBars(){ - super.setBars(); - bars.remove(BarType.inventory); - - for(ItemStack item : consumes.items()){ - bars.add(new BlockBar(BarType.inventory, true, tile -> (float) tile.entity.items.get(item.item) / itemCapacity)); - } - } - @Override public void setStats(){ super.setStats(); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Smelter.java b/core/src/io/anuke/mindustry/world/blocks/production/Smelter.java index a39d27e9e1..985a9f0d75 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Smelter.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Smelter.java @@ -5,12 +5,10 @@ import io.anuke.mindustry.content.fx.BlockFx; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.ItemStack; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.consumers.ConsumeItem; import io.anuke.mindustry.world.consumers.ConsumeItems; -import io.anuke.mindustry.world.meta.BlockBar; import io.anuke.mindustry.world.meta.BlockStat; import io.anuke.mindustry.world.meta.StatUnit; import io.anuke.arc.entities.Effects; @@ -48,13 +46,6 @@ public class Smelter extends Block{ consumes.require(ConsumeItem.class); } - @Override - public void setBars(){ - for(ItemStack item : consumes.items()){ - bars.add(new BlockBar(BarType.inventory, true, tile -> (float) tile.entity.items.get(item.item) / itemCapacity)); - } - } - @Override public void setStats(){ super.setStats(); diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java index 7a1894a54c..d33212a858 100644 --- a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java @@ -26,7 +26,6 @@ import io.anuke.mindustry.graphics.Shaders; import io.anuke.mindustry.maps.TutorialSector; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.type.Item; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.meta.BlockFlag; @@ -117,13 +116,6 @@ public class CoreBlock extends StorageBlock{ state.teams.get(tile.getTeam()).cores.add(tile); } - @Override - public void setBars(){ - super.setBars(); - - bars.remove(BarType.inventory); - } - @Override public void load(){ super.load(); diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/SortedUnloader.java b/core/src/io/anuke/mindustry/world/blocks/storage/SortedUnloader.java index dd7a85dd21..90b0ca917f 100644 --- a/core/src/io/anuke/mindustry/world/blocks/storage/SortedUnloader.java +++ b/core/src/io/anuke/mindustry/world/blocks/storage/SortedUnloader.java @@ -41,9 +41,6 @@ public class SortedUnloader extends Block implements SelectionTrait{ return !(block instanceof StorageBlock); } - @Override - public void setBars(){} - @Override public void playerPlaced(Tile tile){ Core.app.post(() -> Call.setSortedUnloaderItem(null, tile, lastItem)); diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/StorageBlock.java b/core/src/io/anuke/mindustry/world/blocks/storage/StorageBlock.java index 324c86008a..08148c65e6 100644 --- a/core/src/io/anuke/mindustry/world/blocks/storage/StorageBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/storage/StorageBlock.java @@ -2,7 +2,6 @@ package io.anuke.mindustry.world.blocks.storage; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.type.Item; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; @@ -23,12 +22,6 @@ public abstract class StorageBlock extends Block{ return itemCapacity; } - @Override - public void setBars(){ - super.setBars(); - bars.remove(BarType.inventory); - } - @Override public boolean outputsItems(){ return false; diff --git a/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java b/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java index 0b32fa615e..ee9d507bef 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java @@ -20,11 +20,9 @@ import io.anuke.mindustry.graphics.Shaders; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.ItemStack; -import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.consumers.ConsumeItems; -import io.anuke.mindustry.world.meta.BlockBar; import io.anuke.mindustry.world.meta.BlockFlag; import io.anuke.mindustry.world.meta.BlockStat; import io.anuke.mindustry.world.meta.StatUnit; @@ -96,14 +94,6 @@ public class UnitFactory extends Block{ stats.add(BlockStat.craftSpeed, produceTime / 60f, StatUnit.seconds); } - @Override - public void setBars(){ - super.setBars(); - - bars.add(new BlockBar(BarType.production, true, tile -> tile.entity().buildTime / produceTime)); - bars.remove(BarType.inventory); - } - @Override public TextureRegion[] getIcon(){ return new TextureRegion[]{ diff --git a/core/src/io/anuke/mindustry/world/meta/BlockBar.java b/core/src/io/anuke/mindustry/world/meta/BlockBar.java deleted file mode 100644 index d692e152b5..0000000000 --- a/core/src/io/anuke/mindustry/world/meta/BlockBar.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.anuke.mindustry.world.meta; - -import io.anuke.mindustry.world.BarType; -import io.anuke.mindustry.world.Tile; - -public class BlockBar{ - public final ValueSupplier value; - public final BarType type; - public final boolean top; - - public BlockBar(BarType type, boolean top, ValueSupplier value){ - this.value = value; - this.type = type; - this.top = top; - } - - public interface ValueSupplier{ - float get(Tile tile); - } -} diff --git a/core/src/io/anuke/mindustry/world/meta/BlockBars.java b/core/src/io/anuke/mindustry/world/meta/BlockBars.java deleted file mode 100644 index c52700e31c..0000000000 --- a/core/src/io/anuke/mindustry/world/meta/BlockBars.java +++ /dev/null @@ -1,42 +0,0 @@ -package io.anuke.mindustry.world.meta; - -import io.anuke.arc.collection.Array; -import io.anuke.mindustry.world.BarType; - -public class BlockBars{ - private Array list = Array.with(new BlockBar(BarType.health, false, tile -> tile.entity.health / (float) tile.block().health)); - - public void add(BlockBar bar){ - list.add(bar); - } - - public void replace(BlockBar bar){ - remove(bar.type); - list.add(bar); - } - - public void remove(BarType type){ - for(BlockBar bar : list){ - if(bar.type == type){ - list.removeValue(bar, true); - break; - } - } - } - - public void removeAll(BarType type){ - Array removals = new Array<>(4); - - for(BlockBar bar : list){ - if(bar.type == type){ - removals.add(bar); - } - } - - list.removeAll(removals, true); - } - - public Array list(){ - return list; - } -}