diff --git a/core/assets/music/editor.mp3 b/core/assets/music/editor.mp3 index 922d194e5f..bd8450231f 100644 Binary files a/core/assets/music/editor.mp3 and b/core/assets/music/editor.mp3 differ diff --git a/core/assets/zones/desertWastes.png b/core/assets/zones/desertWastes.png index 7fcde99aac..dc6b8946e8 100644 Binary files a/core/assets/zones/desertWastes.png and b/core/assets/zones/desertWastes.png differ diff --git a/core/assets/zones/groundZero.png b/core/assets/zones/groundZero.png index 261c94bd8e..51fa326984 100644 Binary files a/core/assets/zones/groundZero.png and b/core/assets/zones/groundZero.png differ diff --git a/core/src/io/anuke/mindustry/ai/BlockIndexer.java b/core/src/io/anuke/mindustry/ai/BlockIndexer.java index 8a7b70717b..5307e4d202 100644 --- a/core/src/io/anuke/mindustry/ai/BlockIndexer.java +++ b/core/src/io/anuke/mindustry/ai/BlockIndexer.java @@ -12,6 +12,7 @@ import io.anuke.mindustry.game.*; import io.anuke.mindustry.game.Teams.*; import io.anuke.mindustry.type.*; import io.anuke.mindustry.world.*; +import io.anuke.mindustry.world.blocks.*; import io.anuke.mindustry.world.meta.*; import static io.anuke.mindustry.Vars.*; @@ -118,7 +119,7 @@ public class BlockIndexer{ ObjectSet set = damagedTiles[team.ordinal()]; for(Tile tile : set){ - if(tile.entity == null || tile.entity.getTeam() != team || !tile.entity.damaged()){ + if((tile.entity == null || tile.entity.getTeam() != team || !tile.entity.damaged()) && !(tile.block() instanceof BuildBlock)){ returnArray.add(tile); } } diff --git a/core/src/io/anuke/mindustry/entities/type/Player.java b/core/src/io/anuke/mindustry/entities/type/Player.java index a17da18801..d1ebe656f9 100644 --- a/core/src/io/anuke/mindustry/entities/type/Player.java +++ b/core/src/io/anuke/mindustry/entities/type/Player.java @@ -27,7 +27,7 @@ import io.anuke.mindustry.net.NetConnection; import io.anuke.mindustry.type.*; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; -import io.anuke.mindustry.world.blocks.Floor; +import io.anuke.mindustry.world.blocks.*; import java.io.*; @@ -638,7 +638,8 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{ } protected void updateTouch(){ - if(Units.invalidateTarget(target, this) && !(target instanceof TileEntity && ((TileEntity)target).damaged() && target.isValid() && target.getTeam() == team && mech.canHeal && dst(target) < getWeapon().bullet.range())){ + if(Units.invalidateTarget(target, this) && + !(target instanceof TileEntity && ((TileEntity)target).damaged() && target.isValid() && target.getTeam() == team && mech.canHeal && dst(target) < getWeapon().bullet.range() && !(((TileEntity)target).block instanceof BuildBlock))){ target = null; } diff --git a/core/src/io/anuke/mindustry/game/MusicControl.java b/core/src/io/anuke/mindustry/game/MusicControl.java index 53c4ba4351..7b9fdfab7d 100644 --- a/core/src/io/anuke/mindustry/game/MusicControl.java +++ b/core/src/io/anuke/mindustry/game/MusicControl.java @@ -8,7 +8,7 @@ import io.anuke.arc.util.*; /** Controls playback of multiple music tracks.*/ public class MusicControl{ - private static final float finTime = 80f, foutTime = 80f; + private static final float finTime = 120f, foutTime = 120f; private @Nullable Music current; private float fade; diff --git a/core/src/io/anuke/mindustry/graphics/Pal.java b/core/src/io/anuke/mindustry/graphics/Pal.java index 40c4867abc..e24b04ed69 100644 --- a/core/src/io/anuke/mindustry/graphics/Pal.java +++ b/core/src/io/anuke/mindustry/graphics/Pal.java @@ -24,6 +24,8 @@ public class Pal{ lightFlame = Color.valueOf("ffdd55"), darkFlame = Color.valueOf("db401c"), + power2 = Color.valueOf("ff9f6c"), + lightPyraFlame = Color.valueOf("ffb855"), darkPyraFlame = Color.valueOf("db661c"), diff --git a/core/src/io/anuke/mindustry/maps/generators/BasicGenerator.java b/core/src/io/anuke/mindustry/maps/generators/BasicGenerator.java index 375af9543a..a3229e5906 100644 --- a/core/src/io/anuke/mindustry/maps/generators/BasicGenerator.java +++ b/core/src/io/anuke/mindustry/maps/generators/BasicGenerator.java @@ -39,8 +39,8 @@ public abstract class BasicGenerator extends RandomGenerator{ int offsetX = x - 4, offsetY = y + 23; for(int i = ores.size - 1; i >= 0; i--){ Block entry = ores.get(i); - if(Math.abs(0.5f - sim.octaveNoise2D(2, 0.7, 1f / (50 + i * 2), offsetX, offsetY + i*999)) > 0.23f && - Math.abs(0.5f - sim2.octaveNoise2D(1, 1, 1f / (40 + i * 4), offsetX, offsetY - i*999)) > 0.32f){ + if(Math.abs(0.5f - sim.octaveNoise2D(2, 0.7, 1f / (40 + i * 2), offsetX, offsetY + i*999)) > 0.26f && + Math.abs(0.5f - sim2.octaveNoise2D(1, 1, 1f / (30 + i * 4), offsetX, offsetY - i*999)) > 0.37f){ ore = entry; break; } diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index 98503281b4..3ee8a642af 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -276,7 +276,8 @@ public class Block extends BlockStorage{ tempTiles.clear(); Geometry.circle(tile.x, tile.y, range, (x, y) -> { Tile other = world.ltile(x, y); - if(other != null && other.block instanceof PowerNode && ((PowerNode)other.block).linkValid(other, tile)){ + if(other != null && other.block instanceof PowerNode && ((PowerNode)other.block).linkValid(other, tile) && !other.entity.proximity().contains(tile) && + !tile.entity.proximity().contains(p -> p.entity != null && p.entity.power != null && p.entity.power.graph == other.entity.power.graph)){ tempTiles.add(other); } }); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java b/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java index 87237fafc1..d5909925fd 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java @@ -70,7 +70,7 @@ public class MendProjector extends Block{ entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(entity.cons.optionalValid()), 0.1f); - if(entity.cons.optionalValid() && entity.timer.get(timerUse, useTime)){ + if(entity.cons.optionalValid() && entity.timer.get(timerUse, useTime) && entity.power.satisfaction > 0){ entity.cons.trigger(); } diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java b/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java index 3140255a30..c27f786103 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java @@ -74,7 +74,7 @@ public class OverdriveProjector extends Block{ entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(entity.cons.optionalValid()), 0.1f); - if(entity.timer.get(timerUse, useTime)){ + if(entity.timer.get(timerUse, useTime) && entity.power.satisfaction > 0){ entity.cons.trigger(); } diff --git a/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java b/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java index a2c1410a50..f3517801a3 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java @@ -20,6 +20,7 @@ public class PowerGraph{ private final ObjectSet all = new ObjectSet<>(); private final WindowedMean powerBalance = new WindowedMean(60); + private float lastPowerProduced, lastPowerNeeded; private long lastFrameUpdated = -1; private final int graphID; @@ -37,6 +38,23 @@ public class PowerGraph{ return powerBalance.getMean(); } + public float getLastPowerNeeded(){ + return lastPowerNeeded; + } + + public float getLastPowerProduced(){ + return lastPowerProduced; + } + + public float getSatisfaction(){ + if(Mathf.isZero(lastPowerProduced)){ + return 0f; + }else if(Mathf.isZero(lastPowerNeeded)){ + return 1f; + } + return Mathf.clamp(lastPowerProduced / lastPowerNeeded); + } + public float getPowerProduced(){ float powerProduced = 0f; for(Tile producer : producers){ @@ -164,6 +182,9 @@ public class PowerGraph{ float powerNeeded = getPowerNeeded(); float powerProduced = getPowerProduced(); + lastPowerNeeded = powerNeeded; + lastPowerProduced = powerProduced; + powerBalance.addValue((powerProduced - powerNeeded) / Time.delta()); if(consumers.size == 0 && producers.size == 0 && batteries.size == 0){ 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 e4147f7e73..aa5941aca8 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java @@ -107,7 +107,8 @@ public class PowerNode extends PowerBlock{ Geometry.circle(tile.x, tile.y, (int)(laserRange + 1), (x, y) -> { Tile other = world.ltile(x, y); - if(other != null && other != tile && ((!other.block().outputsPower && other.block().consumesPower) || (other.block().outputsPower && !other.block().consumesPower)) && linkValid(tile, other)){ + if(other != null && other != tile && ((!other.block().outputsPower && other.block().consumesPower) || (other.block().outputsPower && !other.block().consumesPower)) && linkValid(tile, other) + && !other.entity.proximity().contains(tile) && other.entity.power.graph != tile.entity.power.graph){ Call.linkPowerNodes(null, tile, other); } }); @@ -255,8 +256,10 @@ public class PowerNode extends PowerBlock{ x2 += t2.x; y2 += t2.y; - Draw.color(Pal.powerLight, Color.WHITE, Mathf.absin(Time.time(), 8f, 0.3f) + 0.2f); - Drawf.laser(laser, laserEnd, x1, y1, x2, y2, 0.6f); + float fract = 1f-tile.entity.power.graph.getSatisfaction(); + + Draw.color(Color.WHITE, Pal.powerLight, fract*0.86f + Mathf.absin(3f, 0.1f)); + Drawf.laser(laser, laserEnd, x1, y1, x2, y2, 0.4f); Draw.color(); }