From 9cadb08024ed0df45d0934092c814c3c2cf58466 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 2 Dec 2017 14:59:28 -0500 Subject: [PATCH] More block descriptions, improved indicators --- .../src/io/anuke/mindustry/core/Renderer.java | 20 +++++++++++-------- core/src/io/anuke/mindustry/core/UI.java | 1 + core/src/io/anuke/mindustry/world/Block.java | 2 +- .../world/blocks/types/BlockPart.java | 12 +++++------ .../blocks/types/defense/ShieldBlock.java | 13 +++++++++++- .../types/distribution/PowerBooster.java | 12 ++++++++++- .../blocks/types/production/Generator.java | 19 ++++++------------ .../types/production/NuclearReactor.java | 2 +- 8 files changed, 50 insertions(+), 31 deletions(-) diff --git a/core/src/io/anuke/mindustry/core/Renderer.java b/core/src/io/anuke/mindustry/core/Renderer.java index 9f8a956a53..37ce907625 100644 --- a/core/src/io/anuke/mindustry/core/Renderer.java +++ b/core/src/io/anuke/mindustry/core/Renderer.java @@ -37,6 +37,7 @@ import io.anuke.ucore.scene.utils.Cursors; import io.anuke.ucore.util.*; public class Renderer extends RendererModule{ + String[] surfaces = {"shadow", "shield", "pixel", "indicators"}; int targetscale = baseCameraScale; int chunksize = 32; Cache[][] floorCache; @@ -45,15 +46,14 @@ public class Renderer extends RendererModule{ public Renderer() { Core.cameraScale = baseCameraScale; - - Graphics.addSurface("pixel", Core.cameraScale); } @Override public void init(){ pixelate = Settings.getBool("pixelate"); - Graphics.addSurface("shadow", Settings.getBool("pixelate") ? Core.cameraScale : 1); - Graphics.addSurface("shield", Settings.getBool("pixelate") ? Core.cameraScale : 1); + for(String surface : surfaces){ + Graphics.addSurface(surface, Settings.getBool("pixelate") ? Core.cameraScale : 1); + } } public void setPixelate(boolean pixelate){ @@ -186,8 +186,9 @@ public class Renderer extends RendererModule{ } void drawEnemyMarkers(){ + Graphics.surface("indicators"); Draw.color(Color.RED); - Draw.alpha(0.6f); + //Draw.alpha(0.6f); for(Enemy enemy : control.enemyGroup.all()){ if(Tmp.r1.setSize(camera.viewportWidth, camera.viewportHeight).setCenter(camera.position.x, camera.position.y).overlaps(enemy.hitbox.getRect(enemy.x, enemy.y))){ @@ -199,6 +200,9 @@ public class Renderer extends RendererModule{ Draw.rect("enemyarrow", camera.position.x + Angles.x(), camera.position.y + Angles.y(), angle); } Draw.color(); + Draw.alpha(0.4f); + Graphics.flushSurface(); + Draw.color(); } void drawShield(){ @@ -513,9 +517,9 @@ public class Renderer extends RendererModule{ targetscale = amount; clampScale(); if(Settings.getBool("pixelate")){ - Graphics.getSurface("pixel").setScale(targetscale); - Graphics.getSurface("shadow").setScale(targetscale); - Graphics.getSurface("shield").setScale(targetscale); + for(String surface : surfaces){ + Graphics.getSurface(surface).setScale(targetscale); + } } } diff --git a/core/src/io/anuke/mindustry/core/UI.java b/core/src/io/anuke/mindustry/core/UI.java index cf96f2fc41..a4c95044a7 100644 --- a/core/src/io/anuke/mindustry/core/UI.java +++ b/core/src/io/anuke/mindustry/core/UI.java @@ -96,6 +96,7 @@ public class UI extends SceneModule{ Colors.put("craftinfo", Color.LIGHT_GRAY); Colors.put("missingitems", Color.SCARLET); Colors.put("health", Color.YELLOW); + Colors.put("healthstats", Color.SCARLET); Colors.put("interact", Color.ORANGE); Colors.put("accent", Color.valueOf("f4ba6e")); } diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index abf6d2fa63..eb4e2e8d0d 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -84,7 +84,7 @@ public class Block{ public void getStats(Array list){ list.add("[gray]size: " + width + "x" + height); - list.add("[health]health: " + health); + list.add("[healthstats]health: " + health); } public String name(){ diff --git a/core/src/io/anuke/mindustry/world/blocks/types/BlockPart.java b/core/src/io/anuke/mindustry/world/blocks/types/BlockPart.java index f7fcba05f1..8223915c67 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/BlockPart.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/BlockPart.java @@ -6,7 +6,8 @@ import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; /**Used for multiblocks. Each block that is not the center of the multiblock is a blockpart. - * Think of these as delegates to the actual block; all events are passed to the target block.*/ + * Think of these as delegates to the actual block; all events are passed to the target block. + * They are made to share all properties from the linked tile/block.*/ public class BlockPart extends Block implements PowerAcceptor, LiquidAcceptor{ public BlockPart() { @@ -78,10 +79,6 @@ public class BlockPart extends Block implements PowerAcceptor, LiquidAcceptor{ return false; } } - - private Block linked(Tile tile){ - return tile.getLinked().block(); - } @Override public void setPower(Tile tile, float power){ @@ -91,6 +88,9 @@ public class BlockPart extends Block implements PowerAcceptor, LiquidAcceptor{ ((PowerAcceptor)block).setPower(tile.getLinked(), power); } } - + + private Block linked(Tile tile){ + return tile.getLinked().block(); + } } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/defense/ShieldBlock.java b/core/src/io/anuke/mindustry/world/blocks/types/defense/ShieldBlock.java index 4549b4c19d..3a08c576fd 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/defense/ShieldBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/defense/ShieldBlock.java @@ -1,5 +1,7 @@ package io.anuke.mindustry.world.blocks.types.defense; +import com.badlogic.gdx.utils.Array; + import io.anuke.mindustry.Vars; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.effect.Fx; @@ -9,16 +11,25 @@ import io.anuke.mindustry.world.blocks.types.PowerBlock; import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Timers; import io.anuke.ucore.entities.BulletEntity; +import io.anuke.ucore.util.Strings; public class ShieldBlock extends PowerBlock{ public float shieldRadius = 40f; - public float powerDrain = 0.005f; + public float powerDrain = 0.006f; public float powerPerDamage = 0.1f; public ShieldBlock(String name) { super(name); voltage = powerDrain; } + + @Override + public void getStats(Array list){ + super.getStats(list); + list.add("[powerinfo]Power Drain/second: " + Strings.toFixed(powerDrain*60, 2)); + list.add("[powerinfo]Power Drain/damage taken: " + Strings.toFixed(powerPerDamage, 2)); + list.add("[powerinfo]Shield Radius: " + (int)shieldRadius + " units"); + } @Override public void update(Tile tile){ 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 d06b209818..fab0f3f77f 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 @@ -7,18 +7,28 @@ import io.anuke.mindustry.Vars; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.types.PowerAcceptor; import io.anuke.mindustry.world.blocks.types.production.Generator; +import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Timers; import io.anuke.ucore.util.Mathf; public class PowerBooster extends Generator{ + public int powerRange = 4; public PowerBooster(String name) { super(name); - drawRadius = true; explosive = false; hasLasers = false; } + @Override + public void drawPixelOverlay(Tile tile){ + super.drawPixelOverlay(tile); + + Draw.color("yellow"); + Draw.dashcircle(tile.worldx(), tile.worldy(), powerRange * Vars.tilesize); + Draw.reset(); + } + @Override public void getStats(Array list){ super.getStats(list); 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 5830bcf58e..70a4b931ab 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 @@ -21,10 +21,8 @@ public class Generator extends PowerBlock{ public int laserRange = 6; public int laserDirections = 4; - public int powerRange = 4; public float powerSpeed = 0.06f; public boolean explosive = true; - public boolean drawRadius = false; public boolean hasLasers = true; public boolean outputOnly = false; @@ -35,6 +33,12 @@ public class Generator extends PowerBlock{ @Override public void getStats(Array list){ super.getStats(list); + + if(hasLasers){ + list.add("[powerinfo]Laser range: " + laserRange + " blocks"); + list.add("[powerinfo]Max power transfer/second: " + Strings.toFixed(powerSpeed*2, 2)); + } + if(explosive){ list.add("[orange]Highly explosive!"); } @@ -64,17 +68,6 @@ public class Generator extends PowerBlock{ super.onDestroyed(tile); } } - - @Override - public void drawPixelOverlay(Tile tile){ - super.drawPixelOverlay(tile); - - if(drawRadius){ - Draw.color("yellow"); - Draw.dashcircle(tile.worldx(), tile.worldy(), powerRange * Vars.tilesize); - Draw.reset(); - } - } @Override public void drawOver(Tile tile){ diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java b/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java index c77139e43b..a238c91d1a 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java @@ -29,7 +29,7 @@ public class NuclearReactor extends LiquidItemPowerGenerator{ protected float coolantPower = 0.007f; //how much heat decreases per coolant unit protected float smokeThreshold = 0.3f; //threshold at which block starts smoking protected int explosionRadius = 19; - protected int explosionDamage = 128; + protected int explosionDamage = 135; protected float flashThreshold = 0.46f; public NuclearReactor(String name) {