Bugfixes for world object caches not clearing when reloading without restart and retextures of a small number of things like fire not working

This commit is contained in:
bbradson
2023-06-08 18:57:10 +02:00
parent d7ff5b96cd
commit 76c0f7a371
7 changed files with 14 additions and 5 deletions
@@ -84,8 +84,8 @@ public class WorldObjectsOptimization : ClassWithFishPrepatches
}
public static int
CachedWorldObjectsVersion,
CachedMapsVersion;
CachedWorldObjectsVersion = -2,
CachedMapsVersion = -2;
private static Type[]
_whitelistedTickingCompTypes
@@ -110,5 +110,9 @@ public class WorldObjectsOptimization : ClassWithFishPrepatches
public static bool CacheDirty(WorldObjectsHolder instance)
=> CachedWorldObjectsVersion != instance.worldObjects._version
|| CachedMapsVersion != Current.gameInt.maps._version;
public static void SetDirty() => CachedWorldObjectsVersion = CachedMapsVersion = -2;
static WorldObjectsHolderTickPatch() => Cache.Utility.Cleared += SetDirty;
}
}