From 8884491e46dc23ea09c175684c26ec225468cf81 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 9 Apr 2022 13:28:44 -0400 Subject: [PATCH] Fog placement fixc --- core/src/mindustry/content/Blocks.java | 7 ------- core/src/mindustry/game/FogControl.java | 9 +++++++++ core/src/mindustry/world/Build.java | 1 + 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 6bfc20aa0b..4f8def9ae8 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1884,7 +1884,6 @@ public class Blocks{ requirements(Category.distribution, with(Items.beryllium, 1)); health = 90; speed = 4f; - fogRadius = 1; researchCost = with(Items.beryllium, 5); }}; @@ -1893,7 +1892,6 @@ public class Blocks{ health = 90; speed = 4f; regionRotated1 = 1; - fogRadius = 1; researchCost = with(Items.beryllium, 30); }}; @@ -1901,7 +1899,6 @@ public class Blocks{ requirements(Category.distribution, with(Items.graphite, 8, Items.beryllium, 8)); health = 90; speed = 4f; - fogRadius = 1; researchCostMultiplier = 1.5f; }}; @@ -1909,7 +1906,6 @@ public class Blocks{ requirements(Category.distribution, with(Items.beryllium, 20)); health = 90; speed = 4f; - fogRadius = 1; researchCostMultiplier = 0.3f; }}; @@ -1918,7 +1914,6 @@ public class Blocks{ health = 120; speed = 4f; regionRotated1 = 1; - fogRadius = 1; }}; surgeConveyor = new StackConveyor("surge-conveyor"){{ @@ -4221,7 +4216,6 @@ public class Blocks{ canOverdrive = false; health = 800; researchCostMultiplier = 4f; - fogRadius = 1; }}; reinforcedPayloadRouter = new PayloadRouter("reinforced-payload-router"){{ @@ -4229,7 +4223,6 @@ public class Blocks{ moveTime = 35f; health = 800; canOverdrive = false; - fogRadius = 2; researchCostMultiplier = 4f; }}; diff --git a/core/src/mindustry/game/FogControl.java b/core/src/mindustry/game/FogControl.java index bdd81b1290..d6f6ae2728 100644 --- a/core/src/mindustry/game/FogControl.java +++ b/core/src/mindustry/game/FogControl.java @@ -100,6 +100,15 @@ public final class FogControl implements CustomChunk{ return fog == null || fog[team.id] == null ? null : fog[team.id].staticData; } + public boolean isDiscovered(Team team, int x, int y){ + if(!state.rules.staticFog || team.isAI()) return true; + + var data = getDiscovered(team); + if(data == null) return false; + if(x < 0 || y < 0 || x >= ww || y >= wh) return false; + return data.get(x + y * ww); + } + public boolean isVisible(Team team, float x, float y){ return isVisibleTile(team, World.toTile(x), World.toTile(y)); } diff --git a/core/src/mindustry/world/Build.java b/core/src/mindustry/world/Build.java index b5df63e97d..80c69f5947 100644 --- a/core/src/mindustry/world/Build.java +++ b/core/src/mindustry/world/Build.java @@ -184,6 +184,7 @@ public class Build{ if( check == null || //nothing there + (state.rules.staticFog && !fogControl.isDiscovered(team, wx, wy)) || (check.floor().isDeep() && !type.floating && !type.requiresWater && !type.placeableLiquid) || //deep water (type == check.block() && check.build != null && rotation == check.build.rotation && type.rotate) || //same block, same rotation !check.interactable(team) || //cannot interact