mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-10 23:28:52 +07:00
Removed block bars / Fixed some input issues
This commit is contained in:
parent
75709a7812
commit
3b1066e16f
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -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.<BuildEntity>entity().progress));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyed(Tile tile){
|
||||
Effects.effect(ExplosionFx.blockExplosionSmoke, tile);
|
||||
|
@ -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.<ForceEntity>entity().buildup / breakage));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
ForceEntity entity = tile.entity();
|
||||
|
@ -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.<TurretEntity>entity().totalAmmo / maxAmmo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
super.init();
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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.<NuclearReactorEntity>entity().heat));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
@ -90,10 +90,6 @@ public class PowerNode extends PowerBlock{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBars(){
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playerPlaced(Tile tile){
|
||||
Tile before = world.tile(lastPlaced);
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
@ -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.<UnitFactoryEntity>entity().buildTime / produceTime));
|
||||
bars.remove(BarType.inventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] getIcon(){
|
||||
return new TextureRegion[]{
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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<BlockBar> 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<BlockBar> removals = new Array<>(4);
|
||||
|
||||
for(BlockBar bar : list){
|
||||
if(bar.type == type){
|
||||
removals.add(bar);
|
||||
}
|
||||
}
|
||||
|
||||
list.removeAll(removals, true);
|
||||
}
|
||||
|
||||
public Array<BlockBar> list(){
|
||||
return list;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user