diff --git a/core/src/mindustry/client/ClientLogic.kt b/core/src/mindustry/client/ClientLogic.kt index a2e1245316..4b68aa0268 100644 --- a/core/src/mindustry/client/ClientLogic.kt +++ b/core/src/mindustry/client/ClientLogic.kt @@ -2,6 +2,7 @@ package mindustry.client import arc.* import arc.Core.* +import arc.graphics.g2d.SortedSpriteBatch import arc.math.geom.* import arc.struct.* import arc.util.* @@ -262,5 +263,9 @@ class ClientLogic { camera.bounds(cameraBounds) cameraBounds.grow(2 * tilesizeF) } + + Events.on(ResetEvent::class.java) { + (batch as? SortedSpriteBatch)?.reset() + } } } diff --git a/core/src/mindustry/entities/Fires.java b/core/src/mindustry/entities/Fires.java index b22e39eb4f..7566be939b 100644 --- a/core/src/mindustry/entities/Fires.java +++ b/core/src/mindustry/entities/Fires.java @@ -72,4 +72,8 @@ public static void register(Fire fire){ map.put(fire.tile.pos(), fire); } } + + static { // FINISHME: Temp hack as fire not being cleared keeps tiles in memory forever. Remove in v147 when anuke fixes it + Events.on(ResetEvent.class, e -> map.clear()); + } } diff --git a/core/src/mindustry/entities/Puddles.java b/core/src/mindustry/entities/Puddles.java index 40526baf05..2828611f65 100644 --- a/core/src/mindustry/entities/Puddles.java +++ b/core/src/mindustry/entities/Puddles.java @@ -1,5 +1,6 @@ package mindustry.entities; +import arc.*; import arc.math.*; import arc.struct.*; import arc.util.*; @@ -108,6 +109,10 @@ public static void register(Puddle puddle){ map.put(puddle.tile().pos(), puddle); } + static { // FINISHME: Temp hack as puddles not being cleared keeps tiles in memory forever. Remove in v147 when anuke fixes it + Events.on(EventType.ResetEvent.class, e -> map.clear()); + } + /** Reacts two liquids together at a location. */ private static float reactPuddle(Liquid dest, Liquid liquid, float amount, Tile tile, float x, float y){ if(dest == null) return 0f; diff --git a/core/src/mindustry/entities/comp/PlayerComp.java b/core/src/mindustry/entities/comp/PlayerComp.java index 8bf96a1590..17cbbf0494 100644 --- a/core/src/mindustry/entities/comp/PlayerComp.java +++ b/core/src/mindustry/entities/comp/PlayerComp.java @@ -198,6 +198,10 @@ public void remove(){ if(!unit.isNull()){ clearUnit(); } + + // null these out to prevent long-lived player objects (for example, Moderation.leaves) from holding onto units with logic controllers that will hold all of their neighbors + lastReadUnit = Nulls.unit; + justSwitchFrom = justSwitchTo = null; } public void team(Team team){ diff --git a/gradle.properties b/gradle.properties index ac5ce91594..5bad9a81b4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -28,4 +28,4 @@ org.gradle.internal.http.connectionTimeout=100000 #kapt.verbose=true # For some reason kapt ir is just completely broken for us. I don't know why. kapt.use.jvm.ir=false -archash=a5d9b11fe5ffc147f3a71d525b9c1532f8584b5d +archash=2863938b5e8a4756428faa0327d7616dcbc8511b