diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index b1f8f40f46..905b0de9f1 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -2612,6 +2612,7 @@ public class Blocks{ size = 4; thrusterLength = 34/4f; armor = 5f; + alwaysUnlocked = true; //TODO should this be higher? buildCostMultiplier = 0.75f; diff --git a/core/src/mindustry/game/FogControl.java b/core/src/mindustry/game/FogControl.java index 48183ae36a..8c53a62d4d 100644 --- a/core/src/mindustry/game/FogControl.java +++ b/core/src/mindustry/game/FogControl.java @@ -73,6 +73,16 @@ public class FogControl implements CustomChunk{ } }); + //on tile removed, dynamic fog goes away + Events.on(TilePreChangeEvent.class, e -> { + if(state.rules.fog && e.tile.build != null && !e.tile.build.team.isAI() && e.tile.block().flags.contains(BlockFlag.hasFogRadius)){ + var data = data(e.tile.team()); + if(data != null){ + data.dynamicUpdated = true; + } + } + }); + SaveVersion.addCustomChunk("fogdata", this); } @@ -171,22 +181,22 @@ public class FogControl implements CustomChunk{ } } + //add building updates (TODO this can run in the if-check, but the renderer needs it...) + for(var build : indexer.getFlagged(team.team, BlockFlag.hasFogRadius)){ + unitEventQueue.add(FogEvent.get(build.tile.x, build.tile.y, build.block.fogRadius, 0)); + } + + //on the client, let the renderer know of all the fog sources + //TODO this runs at a lower FPS and hence may look bad...? + if(data.dynamicUpdated && !headless && team.team == Vars.player.team()){ + renderer.fog.flushDynamic(unitEventQueue); + } + //if it's time for an update, flush *everything* onto the update queue if(data.dynamicUpdated && Time.timeSinceMillis(data.lastDynamicMs) > staticUpdateInterval){ data.dynamicUpdated = false; data.lastDynamicMs = Time.millis(); - //add building updates - for(var build : indexer.getFlagged(team.team, BlockFlag.hasFogRadius)){ - unitEventQueue.add(FogEvent.get(build.tileX(), build.tileY(), build.block.fogRadius, 0)); - } - - //on the client, let the renderer know of all the fog sources - //TODO this runs at a lower FPS and hence may look bad...? - if(!headless && team.team == Vars.player.team()){ - renderer.fog.flushDynamic(unitEventQueue); - } - //add unit updates dynamicEventQueue.addAll(unitEventQueue); }