diff --git a/core/assets-raw/sprites/blocks/powerlaser.png b/core/assets-raw/sprites/blocks/powerlaser.png new file mode 100644 index 0000000000..a20be88c15 Binary files /dev/null and b/core/assets-raw/sprites/blocks/powerlaser.png differ diff --git a/core/assets-raw/sprites/laser.png b/core/assets-raw/sprites/laser.png index 67651ee81c..4b23a386ca 100644 Binary files a/core/assets-raw/sprites/laser.png and b/core/assets-raw/sprites/laser.png differ diff --git a/core/assets-raw/sprites/laserend.png b/core/assets-raw/sprites/laserend.png index 878827188f..d678fb0a81 100644 Binary files a/core/assets-raw/sprites/laserend.png and b/core/assets-raw/sprites/laserend.png differ diff --git a/core/assets/sprites/sprites.atlas b/core/assets/sprites/sprites.atlas index a2f1f70da8..8a93a7565e 100644 --- a/core/assets/sprites/sprites.atlas +++ b/core/assets/sprites/sprites.atlas @@ -438,13 +438,20 @@ blocks/poweredconveyormove orig: 8, 8 offset: 0, 0 index: -1 -blocks/pump +blocks/powerlaser rotate: false xy: 489, 387 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 +blocks/pump + rotate: false + xy: 499, 387 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 blocks/repairturret rotate: false xy: 177, 2 @@ -454,35 +461,35 @@ blocks/repairturret index: -1 blocks/rock rotate: false - xy: 389, 224 + xy: 389, 214 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rock2 rotate: false - xy: 389, 214 + xy: 389, 204 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rock2shadow rotate: false - xy: 389, 204 + xy: 332, 197 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rockshadow rotate: false - xy: 332, 197 + xy: 332, 187 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/router rotate: false - xy: 332, 187 + xy: 342, 197 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -496,7 +503,7 @@ blocks/shadow index: -1 blocks/shieldgenerator rotate: false - xy: 342, 197 + xy: 332, 177 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -510,21 +517,21 @@ blocks/shotgunturret index: -1 blocks/shrub rotate: false - xy: 332, 177 + xy: 342, 187 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/shrubshadow rotate: false - xy: 342, 187 + xy: 342, 177 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/smelter rotate: false - xy: 342, 177 + xy: 352, 192 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -538,21 +545,21 @@ blocks/sniperturret index: -1 blocks/steelconveyor rotate: false - xy: 352, 192 + xy: 352, 182 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/steelconveyormove rotate: false - xy: 352, 182 + xy: 362, 192 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/steelwall rotate: false - xy: 362, 192 + xy: 362, 182 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -566,49 +573,49 @@ blocks/stone index: -1 blocks/stone1 rotate: false - xy: 362, 182 + xy: 372, 192 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stone2 rotate: false - xy: 372, 192 + xy: 372, 182 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stone3 rotate: false - xy: 372, 182 + xy: 382, 192 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock rotate: false - xy: 382, 192 + xy: 382, 182 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock2 rotate: false - xy: 382, 182 + xy: 352, 172 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock3 rotate: false - xy: 352, 172 + xy: 362, 172 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stonedrill rotate: false - xy: 362, 172 + xy: 372, 172 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -622,63 +629,63 @@ blocks/stoneedge index: -1 blocks/stonewall rotate: false - xy: 372, 172 + xy: 382, 172 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/thermalgenerator rotate: false - xy: 382, 172 + xy: 392, 194 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titanium1 rotate: false - xy: 392, 194 + xy: 392, 184 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titanium2 rotate: false - xy: 392, 184 + xy: 392, 174 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titanium3 rotate: false - xy: 392, 174 + xy: 332, 167 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumdrill rotate: false - xy: 332, 167 + xy: 342, 167 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumpurifier rotate: false - xy: 342, 167 + xy: 352, 162 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumshieldwall rotate: false - xy: 352, 162 + xy: 362, 162 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumwall rotate: false - xy: 362, 162 + xy: 372, 162 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -692,35 +699,35 @@ blocks/turret index: -1 blocks/uranium1 rotate: false - xy: 382, 162 + xy: 392, 164 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uranium2 rotate: false - xy: 392, 164 + xy: 389, 282 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uranium3 rotate: false - xy: 389, 282 + xy: 389, 272 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uraniumdrill rotate: false - xy: 389, 272 + xy: 389, 262 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/water rotate: false - xy: 389, 262 + xy: 389, 252 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1374,14 +1381,14 @@ weapons/multigun index: -1 weapons/railgun rotate: false - xy: 499, 387 + xy: 389, 224 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/triblaster rotate: false - xy: 372, 162 + xy: 382, 162 size: 8, 8 orig: 8, 8 offset: 0, 0 diff --git a/core/assets/sprites/sprites.png b/core/assets/sprites/sprites.png index 4735538a0b..991e6853a7 100644 Binary files a/core/assets/sprites/sprites.png and b/core/assets/sprites/sprites.png differ diff --git a/core/src/io/anuke/mindustry/resource/Recipe.java b/core/src/io/anuke/mindustry/resource/Recipe.java index 87d559a922..b5a4494ca3 100644 --- a/core/src/io/anuke/mindustry/resource/Recipe.java +++ b/core/src/io/anuke/mindustry/resource/Recipe.java @@ -58,6 +58,7 @@ public enum Recipe{ combustiongenerator(power, ProductionBlocks.combustiongenerator, stack(Item.titanium, 10), stack(Item.dirium, 10)), nuclearreactor(power, ProductionBlocks.nuclearReactor, stack(Item.titanium, 10), stack(Item.dirium, 10)), powerbooster(power, DistributionBlocks.powerbooster, stack(Item.titanium, 10), stack(Item.dirium, 10)), + powerlaser(power, DistributionBlocks.powerlaser, stack(Item.titanium, 10), stack(Item.dirium, 10)), pump(production, ProductionBlocks.pump, stack(Item.steel, 10)); diff --git a/core/src/io/anuke/mindustry/ui/UpgradeDialog.java b/core/src/io/anuke/mindustry/ui/UpgradeDialog.java index 08b0db10b0..e86ece0264 100644 --- a/core/src/io/anuke/mindustry/ui/UpgradeDialog.java +++ b/core/src/io/anuke/mindustry/ui/UpgradeDialog.java @@ -16,6 +16,7 @@ import io.anuke.ucore.scene.ui.*; import io.anuke.ucore.scene.ui.layout.Table; public class UpgradeDialog extends Dialog{ + boolean wasPaused = false; public UpgradeDialog() { super("Upgrades"); @@ -26,9 +27,11 @@ public class UpgradeDialog extends Dialog{ addCloseButton(); hidden(()->{ - GameState.set(State.playing); + if(!wasPaused) + GameState.set(State.playing); }); shown(()->{ + wasPaused = GameState.is(State.paused); GameState.set(State.paused); }); @@ -37,7 +40,6 @@ public class UpgradeDialog extends Dialog{ }).size(96, 50).pad(5); Table weptab = new Table(); - //weptab.background("button"); weptab.pad(20); int i = 0; diff --git a/core/src/io/anuke/mindustry/world/blocks/DistributionBlocks.java b/core/src/io/anuke/mindustry/world/blocks/DistributionBlocks.java index 337821ed48..7a3a320503 100644 --- a/core/src/io/anuke/mindustry/world/blocks/DistributionBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/DistributionBlocks.java @@ -46,5 +46,10 @@ public class DistributionBlocks{ { formalName = "power booster"; } + }, + powerlaser = new PowerLaser("powerlaser"){ + { + formalName = "power laser"; + } }; } 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 777549d682..a34c2ed061 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,35 +1,49 @@ package io.anuke.mindustry.world.blocks.types.distribution; +import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.GridPoint2; -import io.anuke.mindustry.Vars; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.World; import io.anuke.mindustry.world.blocks.types.PowerAcceptor; import io.anuke.mindustry.world.blocks.types.PowerBlock; import io.anuke.ucore.core.Draw; +import io.anuke.ucore.core.Timers; import io.anuke.ucore.util.Angles; import io.anuke.ucore.util.Geometry; +import io.anuke.ucore.util.Mathf; public class PowerLaser extends PowerBlock{ - public int laserRange = 4; - public float powerAmount = 0.01f; + public int laserRange = 6; + public float powerAmount = 0.03f; + public Color color = Color.valueOf("e54135"); public PowerLaser(String name) { super(name); rotate = true; + solid = true; } @Override public void drawOver(Tile tile){ Tile target = target(tile); - if(target != null){ - Draw.laser("laser", "laserend", tile.worldx(), tile.worldy(), target.worldx(), target.worldy()); - }else{ - Angles.translation(tile.rotation*90, laserRange*Vars.tilesize); + PowerEntity entity = tile.entity(); + + if(target != null && entity.power > powerAmount){ + Angles.translation(tile.rotation * 90, 6f); - Draw.laser("laser", "laserend", tile.worldx(), tile.worldy(), tile.worldx() + Angles.x(), tile.worldy() + Angles.y()); + Draw.color(Color.GRAY, Color.WHITE, 0.902f + Mathf.sin(Timers.time(), 1.7f, 0.08f)); + Draw.alpha(1f); + + float r = 0f; + + Draw.laser("laser", "laserend", + tile.worldx() + Angles.x() + Mathf.range(r), tile.worldy() + Angles.y() + Mathf.range(r), + target.worldx() - Angles.x() + Mathf.range(r), target.worldy() - Angles.y() + Mathf.range(r), + 0.7f + Mathf.sin(Timers.time(), 2f, 0.1f*0)); + + Draw.color(); } } @@ -38,6 +52,8 @@ public class PowerLaser extends PowerBlock{ PowerEntity entity = tile.entity(); Tile target = target(tile); + if(target == null) return; + PowerAcceptor p = (PowerAcceptor)target.block(); if(p.acceptsPower(target) && entity.power >= powerAmount){ entity.power -= (powerAmount - p.addPower(target, powerAmount)); 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 1910fc92d0..78241cbff0 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 @@ -14,7 +14,7 @@ import io.anuke.ucore.util.Mathf; public class Generator extends PowerBlock{ public static final int powerTime = 2; - public int powerRange = 6; + public int powerRange = 4; public float powerSpeed = 0.2f; public Generator(String name) {