public static void PopFaction(this Map map) { Faction faction = FactionContext.Pop(); if (faction == null) { return; } Multiplayer.WorldComp?.SetFaction(faction); map?.MpComp().SetFaction(faction); }
// Sets the current Faction.OfPlayer // Applies faction's world components // Applies faction's map components if map not null public static void PushFaction(this Map map, Faction f) { var faction = FactionContext.Push(f); if (faction == null) { return; } Multiplayer.WorldComp?.SetFaction(faction); map?.MpComp().SetFaction(faction); }
static void Prefix(DateNotifier __instance, ref int?__state) { if (Multiplayer.Client == null && Multiplayer.RealPlayerFaction != null) { return; } Map map = __instance.FindPlayerHomeWithMinTimezone(); if (map == null) { return; } __state = Find.TickManager.TicksGame; FactionContext.Push(Multiplayer.RealPlayerFaction); Find.TickManager.DebugSetTicksGame(map.AsyncTime().mapTicks); }
static void Postfix(CompForbiddable __instance, bool __state) { __instance.forbiddenInt = __state; FactionContext.Pop(); }
static void Prefix(CompForbiddable __instance, ref bool __state) { FactionContext.Push(Multiplayer.RealPlayerFaction); __state = __instance.forbiddenInt; __instance.forbiddenInt = __instance.Forbidden; }