From 4788bbf65c04607ec6f011c66810f9a26e16aa35 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 21 Nov 2017 13:48:14 -0500 Subject: [PATCH] Added extended stats and descriptions for all blocks --- core/src/io/anuke/mindustry/UI.java | 21 ++++++++++ core/src/io/anuke/mindustry/world/Block.java | 6 +++ .../world/blocks/DistributionBlocks.java | 5 +++ .../world/blocks/ProductionBlocks.java | 2 +- .../mindustry/world/blocks/WeaponBlocks.java | 16 ++------ .../world/blocks/types/LiquidBlock.java | 8 ++++ .../world/blocks/types/PowerBlock.java | 7 ++++ .../blocks/types/defense/LaserTurret.java | 5 --- .../blocks/types/defense/PowerTurret.java | 11 +++++- .../blocks/types/defense/RepairTurret.java | 9 +++++ .../world/blocks/types/defense/Turret.java | 39 +++++++++++++++---- .../blocks/types/distribution/Conveyor.java | 11 ++++-- .../types/distribution/PowerBooster.java | 8 ++++ .../blocks/types/distribution/PowerLaser.java | 7 ++++ .../blocks/types/distribution/Router.java | 13 +++++-- .../blocks/types/production/Crafter.java | 11 ++++++ .../blocks/types/production/Generator.java | 9 +++++ .../types/production/LiquidCrafter.java | 16 +++++++- .../production/LiquidPowerGenerator.java | 10 +++++ .../world/blocks/types/production/Pump.java | 16 ++++++-- 20 files changed, 192 insertions(+), 38 deletions(-) diff --git a/core/src/io/anuke/mindustry/UI.java b/core/src/io/anuke/mindustry/UI.java index 5ef2b9b58f..1382edbd72 100644 --- a/core/src/io/anuke/mindustry/UI.java +++ b/core/src/io/anuke/mindustry/UI.java @@ -46,6 +46,7 @@ public class UI extends SceneModule{ MenuDialog menu; Tooltip tooltip; Tile configTile; + Array statlist = new Array<>(); boolean wasPaused = false; VisibilityProvider play = () -> !GameState.is(State.menu); @@ -92,6 +93,10 @@ public class UI extends SceneModule{ Colors.put("description", Color.WHITE); Colors.put("turretinfo", Color.ORANGE); + Colors.put("iteminfo", Color.LIGHT_GRAY); + Colors.put("powerinfo", Color.YELLOW); + Colors.put("liquidinfo", Color.ROYAL); + Colors.put("craftinfo", Color.LIGHT_GRAY); Colors.put("missingitems", Color.SCARLET); Colors.put("health", Color.YELLOW); Colors.put("interact", Color.ORANGE); @@ -670,6 +675,9 @@ public class UI extends SceneModule{ //extra info if(recipe.result.fullDescription != null){ header.addButton("?", ()->{ + statlist.clear(); + recipe.result.getStats(statlist); + Label desclabel = new Label(recipe.result.fullDescription); desclabel.setWrap(true); @@ -684,10 +692,23 @@ public class UI extends SceneModule{ d.content().add(top).fill().left(); d.content().row(); d.content().add(desclabel).width(600).units(Unit.dp); + d.content().row(); + + if(statlist.size > 0){ + d.content().add("[coral][[extra block info]:").padTop(6).padBottom(5).left(); + d.content().row(); + } + + for(String s : statlist){ + d.content().add(s).left(); + d.content().row(); + } + d.buttons().addButton("OK", ()->{ if(!wasPaused) GameState.set(State.playing); d.hide(); }).size(110, 50).pad(10f).units(Unit.dp); + d.show(); }).expandX().padLeft(4).top().right().size(36f, 40f).units(Unit.dp); } diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index 4805836680..32fadbf841 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -19,6 +19,7 @@ import io.anuke.ucore.util.Tmp; public class Block{ private static int lastid; private static Array blocks = new Array(); + protected static TextureRegion temp = new TextureRegion(); /**internal name*/ @@ -76,6 +77,11 @@ public class Block{ public void drawPlace(int x, int y, boolean valid){} public void postInit(){} + public void getStats(Array list){ + list.add("[gray]size: " + width + "x" + height); + list.add("[health]health: " + health); + } + public String name(){ return name; } diff --git a/core/src/io/anuke/mindustry/world/blocks/DistributionBlocks.java b/core/src/io/anuke/mindustry/world/blocks/DistributionBlocks.java index 59c3111e3b..4d82686a15 100644 --- a/core/src/io/anuke/mindustry/world/blocks/DistributionBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/DistributionBlocks.java @@ -37,6 +37,7 @@ public class DistributionBlocks{ steelconveyor = new Conveyor("steelconveyor"){{ health = 55; speed = 0.04f; + description = "Moves items faster."; formalName = "steel conveyor"; fullDescription = "Advanced item transport block. Moves items faster than standard conveyors."; }}, @@ -45,6 +46,7 @@ public class DistributionBlocks{ pulseconveyor = new Conveyor("poweredconveyor"){{ health = 90; speed = 0.09f; + description = "Moves items even faster."; formalName = "pulse conveyor"; fullDescription = "The ultimate item transport block. Moves items faster than steel conveyors."; }}, @@ -75,15 +77,18 @@ public class DistributionBlocks{ powerbooster = new PowerBooster("powerbooster"){{ formalName = "power booster"; powerRange = 4; + description = "Distributes power within a radius."; fullDescription = "Distributes power to all blocks within its radius. "; }}, powerlaser = new PowerLaser("powerlaser"){{ formalName = "power laser"; + description = "Transmits power with a laser."; fullDescription = "Creates a laser that transmits power to the block in front of it. Does not generate any power itself. " + "Best used with generators or other lasers."; }}, powerlaserrouter = new PowerLaserRouter("powerlaserrouter"){{ formalName = "laser router"; + description = "Splits input power into 3 lasers."; fullDescription = "Laser that distributes power to three directions at once. " + "Useful in situations where it is required to power multiple blocks from one generator."; }}, diff --git a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java index 4aed77f7d8..2ab282f0c7 100644 --- a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java @@ -44,7 +44,7 @@ public class ProductionBlocks{ }}, fluxpump = new Pump("fluxpump"){{ - pumpspeed = 3f; + pumpAmount = 3f; description = "Pumps liquids into nearby conduits."; fullDescription = "An advanced version of the pump. Stores more liquid and pumps liquid faster."; }}, diff --git a/core/src/io/anuke/mindustry/world/blocks/WeaponBlocks.java b/core/src/io/anuke/mindustry/world/blocks/WeaponBlocks.java index f11252cad4..d7b3f6fc05 100644 --- a/core/src/io/anuke/mindustry/world/blocks/WeaponBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/WeaponBlocks.java @@ -14,7 +14,6 @@ import io.anuke.mindustry.world.blocks.types.defense.LaserTurret; import io.anuke.mindustry.world.blocks.types.defense.PowerTurret; import io.anuke.mindustry.world.blocks.types.defense.Turret; import io.anuke.ucore.core.Effects; -import io.anuke.ucore.core.Timers; import io.anuke.ucore.util.Angles; import io.anuke.ucore.util.Mathf; @@ -75,20 +74,12 @@ public class WeaponBlocks{ bullet = BulletType.iron; ammo = Item.iron; health = 70; + shots = 7; + inaccuracy = 30f; + shotDelayScale = 0.7f; fullDescription = "A standard turret. Uses iron for ammo. Shoots a spread of 7 bullets. " + "Lower range, but higher damage output than the gattling turret."; } - - @Override - protected void shoot(Tile tile){ - TurretEntity entity = tile.entity(); - - for(int i = 0; i < 7; i ++) - Timers.run(i/1.5f, ()->{ - Angles.translation(entity.rotation, 4f); - bullet(tile, entity.rotation + Mathf.range(30)); - }); - } }, flameturret = new Turret("flameturret"){ @@ -195,6 +186,7 @@ public class WeaponBlocks{ health = 430; width = height = 2; shootCone = 9f; + shots = 2; fullDescription = "The ultimate rapid-fire turret. Uses uranium as ammo. Shoots large slugs at a high fire rate. " + "Medium range. Spans multiple tiles. Extremely tough."; } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/LiquidBlock.java b/core/src/io/anuke/mindustry/world/blocks/types/LiquidBlock.java index 3f6106dc16..e04b6b2942 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/LiquidBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/LiquidBlock.java @@ -4,6 +4,8 @@ import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; +import com.badlogic.gdx.utils.Array; + import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.resource.Liquid; import io.anuke.mindustry.world.Block; @@ -22,6 +24,12 @@ public class LiquidBlock extends Block implements LiquidAcceptor{ update = true; } + @Override + public void getStats(Array list){ + super.getStats(list); + list.add("[liquidinfo]Liquid Capacity: " + liquidCapacity); + } + @Override public void draw(Tile tile){ LiquidEntity entity = tile.entity(); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/PowerBlock.java b/core/src/io/anuke/mindustry/world/blocks/types/PowerBlock.java index 36d3a6926b..69eb890414 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/PowerBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/PowerBlock.java @@ -6,6 +6,7 @@ import java.io.IOException; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.Vars; import io.anuke.mindustry.entities.TileEntity; @@ -23,6 +24,12 @@ public abstract class PowerBlock extends Block implements PowerAcceptor{ solid = true; } + @Override + public void getStats(Array list){ + super.getStats(list); + list.add("[powerinfo]Power Capacity: " + powerCapacity); + } + @Override public void drawPixelOverlay(Tile tile){ PowerEntity entity = tile.entity(); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/defense/LaserTurret.java b/core/src/io/anuke/mindustry/world/blocks/types/defense/LaserTurret.java index 1b57b5f5e8..7387290ab7 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/defense/LaserTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/defense/LaserTurret.java @@ -24,11 +24,6 @@ public class LaserTurret extends PowerTurret{ super(name); } - @Override - public void postInit(){ - description = "[turretinfo]Ammo: "+(ammo==null ? "N/A" : ammo.name())+"\nRange: " + (int)range + "\nDamage: " + damage; - } - @Override public void shoot(Tile tile){ TurretEntity entity = tile.entity(); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/defense/PowerTurret.java b/core/src/io/anuke/mindustry/world/blocks/types/defense/PowerTurret.java index 953de4e86f..fd5d6361ec 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/defense/PowerTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/defense/PowerTurret.java @@ -6,6 +6,7 @@ import java.io.IOException; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.Vars; import io.anuke.mindustry.entities.TileEntity; @@ -14,6 +15,7 @@ import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.types.PowerAcceptor; import io.anuke.ucore.core.Draw; import io.anuke.ucore.util.Mathf; +import io.anuke.ucore.util.Strings; public class PowerTurret extends Turret implements PowerAcceptor{ public float powerCapacity = 20f; @@ -21,7 +23,14 @@ public class PowerTurret extends Turret implements PowerAcceptor{ public PowerTurret(String name) { super(name); - ammo = Item.stone; + ammo = null; + } + + @Override + public void getStats(Array list){ + super.getStats(list); + list.add("[powerinfo]Power Capacity: " + (int)powerCapacity); + list.add("[powerinfo]Power/shot: " + Strings.toFixed(powerUsed, 1)); } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/types/defense/RepairTurret.java b/core/src/io/anuke/mindustry/world/blocks/types/defense/RepairTurret.java index c28aa5cd8f..f26a591cc2 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/defense/RepairTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/defense/RepairTurret.java @@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.types.defense; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.World; @@ -10,6 +11,7 @@ import io.anuke.ucore.core.Timers; import io.anuke.ucore.graphics.Hue; import io.anuke.ucore.util.Angles; import io.anuke.ucore.util.Mathf; +import io.anuke.ucore.util.Strings; public class RepairTurret extends Turret{ @@ -17,6 +19,13 @@ public class RepairTurret extends Turret{ super(name); } + @Override + public void getStats(Array list){ + list.add("[health]health: " + health); + list.add("[turretinfo]Range: " + (int)range); + list.add("[turretinfo]Repairs/Second: " + Strings.toFixed(60f/reload, 1)); + } + @Override public void postInit(){ description = "[turretinfo]Range: " + (int)range + "\n[description]Heals nearby tiles."; diff --git a/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java b/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java index aa4540ed8b..cb6b26da0e 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java @@ -6,6 +6,7 @@ import java.io.IOException; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.Fx; import io.anuke.mindustry.Vars; @@ -22,6 +23,7 @@ import io.anuke.ucore.core.Timers; import io.anuke.ucore.entities.Entities; import io.anuke.ucore.util.Angles; import io.anuke.ucore.util.Mathf; +import io.anuke.ucore.util.Strings; public class Turret extends Block{ static final int targetInterval = 15; @@ -30,6 +32,8 @@ public class Turret extends Block{ protected float range = 50f; protected float reload = 10f; protected float inaccuracy = 0f; + protected int shots = 1; + protected float shotDelayScale = 0; protected String shootsound = "shoot"; protected BulletType bullet = BulletType.iron; protected Item ammo; @@ -44,9 +48,23 @@ public class Turret extends Block{ solid = true; } + @Override + public void getStats(Array list){ + super.getStats(list); + if(ammo != null) list.add("[turretinfo]Ammo: " + ammo); + if(ammo != null) list.add("[turretinfo]Ammo Capacity: " + maxammo); + if(ammo != null) list.add("[turretinfo]Ammo/Item: " + ammoMultiplier); + list.add("[turretinfo]Range: " + (int)range); + list.add("[turretinfo]Inaccuracy: " + (int)inaccuracy); + list.add("[turretinfo]Damage/Shot: " + bullet.damage); + list.add("[turretinfo]Shots/Second: " + Strings.toFixed(60f/reload, 1)); + list.add("[turretinfo]Shots: " + shots); + } + @Override public void postInit(){ - description = "[turretinfo]Ammo: "+(ammo==null ? "N/A" : ammo.name())+"\nRange: " + (int)range + "\nDamage: " + bullet.damage; + description = "[turretinfo]" + (ammo==null ? "" : "Ammo: " + ammo +"\n") + + "Range: " + (int)range; } @Override @@ -110,7 +128,7 @@ public class Turret extends Block{ public void update(Tile tile){ TurretEntity entity = tile.entity(); - if(entity.hasItem(ammo)){ + if(ammo != null && entity.hasItem(ammo)){ entity.ammo += ammoMultiplier; entity.removeItem(ammo, 1); } @@ -197,13 +215,18 @@ public class Turret extends Block{ protected void shoot(Tile tile){ TurretEntity entity = tile.entity(); - float inac = Mathf.range(inaccuracy); + Angles.translation(entity.rotation, width * Vars.tilesize / 2f); - Angles.translation(entity.rotation + inac, width * Vars.tilesize / 2f); - - Bullet out = new Bullet(bullet, tile.entity, - tile.worldx() + Angles.x(), tile.worldy() + Angles.y(), entity.rotation + inac).add(); - out.damage = (int)(bullet.damage*Vars.multiplier); + for(int i = 0; i < shots; i ++){ + if(Mathf.zero(shotDelayScale)){ + bullet(tile, entity.rotation + Mathf.range(inaccuracy)); + }else{ + Timers.run(i * shotDelayScale, ()->{ + bullet(tile, entity.rotation + Mathf.range(inaccuracy)); + }); + } + + } } protected void bullet(Tile tile, float angle){ diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java index f7f450e0b1..d24acf8dac 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java @@ -7,6 +7,7 @@ import java.io.DataOutputStream; import java.io.IOException; import com.badlogic.gdx.math.MathUtils; +import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.IntArray; import io.anuke.mindustry.entities.TileEntity; @@ -15,9 +16,7 @@ import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Timers; -import io.anuke.ucore.util.Bits; -import io.anuke.ucore.util.Mathf; -import io.anuke.ucore.util.Tmp; +import io.anuke.ucore.util.*; public class Conveyor extends Block{ private static Item[] items = Item.values(); @@ -33,6 +32,12 @@ public class Conveyor extends Block{ update = true; } + @Override + public void getStats(Array list){ + super.getStats(list); + list.add("[iteminfo]Move Speed: " + Strings.toFixed(speed * 60, 1) + " units/s"); + } + @Override public boolean canReplace(Block other){ return other instanceof Conveyor || other instanceof Router || other instanceof Junction; diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerBooster.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerBooster.java index b77f114a98..5f596b0edd 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerBooster.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerBooster.java @@ -1,5 +1,7 @@ package io.anuke.mindustry.world.blocks.types.distribution; +import com.badlogic.gdx.utils.Array; + import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.types.production.Generator; @@ -11,6 +13,12 @@ public class PowerBooster extends Generator{ explosive = false; } + @Override + public void getStats(Array list){ + super.getStats(list); + list.add("[powerinfo]Power Range: " + powerRange + " tiles"); + } + @Override public void update(Tile tile){ distributePower(tile); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerLaser.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerLaser.java index 217a52b6b5..96f24759cc 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerLaser.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerLaser.java @@ -1,6 +1,7 @@ package io.anuke.mindustry.world.blocks.types.distribution; import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.types.production.Generator; @@ -17,6 +18,12 @@ public class PowerLaser extends Generator{ laserDirections = 1; } + @Override + public void getStats(Array list){ + super.getStats(list); + list.add("[powerinfo]Laser Range: " + laserRange + " tiles"); + } + @Override public void update(Tile tile){ distributeLaserPower(tile); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Router.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Router.java index 61988e1f8a..8b8f5afe95 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Router.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Router.java @@ -1,6 +1,7 @@ package io.anuke.mindustry.world.blocks.types.distribution; import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; import io.anuke.mindustry.Vars; @@ -11,7 +12,7 @@ import io.anuke.ucore.core.Timers; public class Router extends Block{ private ObjectMap lastmap = new ObjectMap<>(); - int maxitems = 20; + int capacity = 20; public Router(String name) { super(name); @@ -19,6 +20,12 @@ public class Router extends Block{ solid = true; } + @Override + public void getStats(Array list){ + super.getStats(list); + list.add("[iteminfo]Capacity: " + capacity); + } + @Override public boolean canReplace(Block other){ return other instanceof Junction || other instanceof Conveyor; @@ -44,13 +51,13 @@ public class Router extends Block{ @Override public boolean acceptItem(Item item, Tile dest, Tile source){ int items = dest.entity.totalItems(); - return items < maxitems; + return items < capacity; } @Override public void drawPixelOverlay(Tile tile){ - float fract = (float)tile.entity.totalItems()/maxitems; + float fract = (float)tile.entity.totalItems()/capacity; Vars.renderer.drawBar(Color.GREEN, tile.worldx(), tile.worldy() + 6, fract); } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Crafter.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Crafter.java index 9648b5d805..87db4f58d6 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Crafter.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Crafter.java @@ -1,5 +1,9 @@ package io.anuke.mindustry.world.blocks.types.production; +import java.util.Arrays; + +import com.badlogic.gdx.utils.Array; + import io.anuke.mindustry.Fx; import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.world.Block; @@ -17,6 +21,13 @@ public class Crafter extends Block{ solid = true; } + @Override + public void getStats(Array list){ + super.getStats(list); + list.add("[craftinfo]Input: " + Arrays.toString(requirements)); + list.add("[craftinfo]Output: " + result); + } + @Override public void update(Tile tile){ diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java index 9a332f83a0..2e458f91f9 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java @@ -3,6 +3,7 @@ package io.anuke.mindustry.world.blocks.types.production; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.GridPoint2; import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.Fx; import io.anuke.mindustry.Vars; @@ -30,6 +31,14 @@ public class Generator extends PowerBlock{ public Generator(String name) { super(name); } + + @Override + public void getStats(Array list){ + super.getStats(list); + if(explosive){ + list.add("[orange]Highly explosive!"); + } + } @Override public void onDestroyed(Tile tile){ diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidCrafter.java b/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidCrafter.java index 2b74722d8f..41237c469a 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidCrafter.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidCrafter.java @@ -1,6 +1,7 @@ package io.anuke.mindustry.world.blocks.types.production; import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.Fx; import io.anuke.mindustry.Vars; @@ -13,13 +14,14 @@ import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects.Effect; import io.anuke.ucore.core.Timers; +import io.anuke.ucore.util.Strings; public class LiquidCrafter extends LiquidBlock{ /**Can be null.*/ public Item input = null; public int inputAmount = 5; public Liquid inputLiquid = null; - public float liquidAmount = 19.99f; + public float liquidAmount = 20f; public Item output = null; public int itemCapacity = 90; public int purifyTime = 80; @@ -31,7 +33,17 @@ public class LiquidCrafter extends LiquidBlock{ rotate = false; solid = true; health = 60; - liquidCapacity = 20f; + liquidCapacity = 21f; + } + + @Override + public void getStats(Array list){ + super.getStats(list); + list.add("[liquidinfo]Max items/second: " + Strings.toFixed(60f/purifyTime, 1)); + list.add("[liquidinfo]Input liquid: " + inputLiquid + " x " + (int)liquidAmount); + if(input != null) list.add("[iteminfo]Item Capacity: " + itemCapacity); + if(input != null) list.add("[iteminfo]Input item: " + input + " x " + inputAmount); + list.add("[iteminfo]Output: " + output); } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java b/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java index f12f119e22..a1c7746f8e 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java @@ -5,6 +5,7 @@ import java.io.DataOutputStream; import java.io.IOException; import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.Fx; import io.anuke.mindustry.entities.TileEntity; @@ -15,6 +16,7 @@ import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects.Effect; import io.anuke.ucore.core.Timers; +import io.anuke.ucore.util.Strings; public class LiquidPowerGenerator extends Generator implements LiquidAcceptor{ public int generateTime = 5; @@ -30,6 +32,14 @@ public class LiquidPowerGenerator extends Generator implements LiquidAcceptor{ super(name); } + @Override + public void getStats(Array list){ + super.getStats(list); + list.add("[liquidinfo]Liquid Capacity: " + (int)liquidCapacity); + list.add("[liquidinfo]Generation: " + Strings.toFixed(generatePower / inputLiquid, 3) + "power units/liquid unit"); + list.add("[liquidinfo]Input: " + generateLiquid); + } + @Override public void draw(Tile tile){ super.draw(tile); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java index dc14abe77b..9268933293 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java @@ -1,14 +1,18 @@ package io.anuke.mindustry.world.blocks.types.production; +import com.badlogic.gdx.utils.Array; + import io.anuke.mindustry.resource.Liquid; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.types.LiquidBlock; import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Timers; import io.anuke.ucore.util.Mathf; +import io.anuke.ucore.util.Strings; public class Pump extends LiquidBlock{ - protected float pumpspeed = 2f; + protected float pumpAmount = 2f; + protected float pumpTime = 8f; public Pump(String name) { super(name); @@ -16,6 +20,12 @@ public class Pump extends LiquidBlock{ solid = true; } + @Override + public void getStats(Array list){ + super.getStats(list); + list.add("[liquidinfo]Pump Speed: " + Strings.toFixed(60f/pumpTime*pumpAmount, 1) + "/s"); + } + @Override public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){ return false; @@ -49,9 +59,9 @@ public class Pump extends LiquidBlock{ LiquidEntity entity = tile.entity(); if(tile.floor().liquidDrop != null && - Timers.get(tile, "pump", 8) && entity.liquidAmount < liquidCapacity){ + Timers.get(tile, "pump", pumpTime) && entity.liquidAmount < liquidCapacity){ entity.liquid = tile.floor().liquidDrop; - entity.liquidAmount += Math.min(pumpspeed, this.liquidCapacity - entity.liquidAmount); + entity.liquidAmount += Math.min(pumpAmount, this.liquidCapacity - entity.liquidAmount); } if(Timers.get(tile, "dump", 1)){