public static void Postfix(GameLocation __instance, GameTime time) { var objs = __instance.get_BelowGroundObjects(); foreach (var vec in __instance.GetConstantProcessingForLayer(Layer.Underground)) { (objs[vec] as IUpdatesEvenWithoutFarmer).UpdateEvenWithoutFarmer(__instance, time); } objs = __instance.netObjects; foreach (var vec in __instance.GetConstantProcessingForLayer(Layer.GroundLevel)) { (objs[vec] as IUpdatesEvenWithoutFarmer).UpdateEvenWithoutFarmer(__instance, time); } objs = __instance.get_ElevatedObjects(); foreach (var vec in __instance.GetConstantProcessingForLayer(Layer.Elevated)) { (objs[vec] as IUpdatesEvenWithoutFarmer).UpdateEvenWithoutFarmer(__instance, time); } }
public static void Postfix(GameLocation __instance) { __instance.NetFields.AddField(__instance.get_BelowGroundObjects()); __instance.NetFields.AddField(__instance.GetConstantProcessingForLayer(Layer.Underground)); __instance.NetFields.AddField(__instance.GetConstantProcessingForLayer(Layer.GroundLevel)); __instance.NetFields.AddField(__instance.GetConstantProcessingForLayer(Layer.Elevated)); __instance.get_BelowGroundObjects().OnValueAdded += (key, value) => { if (value is IUpdatesEvenWithoutFarmer) { __instance.GetConstantProcessingForLayer(Layer.Underground).Add(key); } }; __instance.get_BelowGroundObjects().OnValueRemoved += (key, value) => { if (value is IUpdatesEvenWithoutFarmer) { __instance.GetConstantProcessingForLayer(Layer.Underground).Remove(key); } }; __instance.netObjects.OnValueAdded += (key, value) => { if (value is IUpdatesEvenWithoutFarmer) { __instance.GetConstantProcessingForLayer(Layer.GroundLevel).Add(key); } }; __instance.netObjects.OnValueRemoved += (key, value) => { if (value is IUpdatesEvenWithoutFarmer) { __instance.GetConstantProcessingForLayer(Layer.GroundLevel).Remove(key); } }; __instance.get_ElevatedObjects().OnValueAdded += (key, value) => { if (value is IUpdatesEvenWithoutFarmer) { __instance.GetConstantProcessingForLayer(Layer.Elevated).Add(key); } }; __instance.get_ElevatedObjects().OnValueRemoved += (key, value) => { if (value is IUpdatesEvenWithoutFarmer) { __instance.GetConstantProcessingForLayer(Layer.Elevated).Remove(key); } }; }