/** * This function is called directly after the game clears all base pieces (to update * the view model - this is done in Base.ClearGeometry, see that patch). The game will * respawn each object and we need to copy over their ids. We reference the dictionary * in the ClearGemometry patch so know what ids to update. */ public static void Postfix(Base __instance, Transform __result) { if (__instance == null || __result == null) { return; } NitroxId id; string key = Base_ClearGeometry_Patch.getObjectKey(__result.name, __result.position); if (Base_ClearGeometry_Patch.NitroxIdByObjectKey.TryGetValue(key, out id)) { NitroxEntity.SetNewId(__result.gameObject, id); } }
/** * This function is called directly after the game clears all base pieces (to update * the view model - this is done in Base.ClearGeometry, see that patch). The game will * respawn each object and we need to copy over their ids. We reference the dictionary * in the ClearGemometry patch so know what ids to update. */ public static void Postfix(Base __instance, Transform __result) { if (__instance == null || __result == null) { return; } NitroxId id; string key = Base_ClearGeometry_Patch.getObjectKey(__result.name, __result.position); if (Base_ClearGeometry_Patch.NitroxIdByObjectKey.TryGetValue(key, out id)) { Log.Debug("When respawning geometry, found id to copy to new object: " + key + " " + id); NitroxEntity.SetNewId(__result.gameObject, id); } }