public static void Postfix(Pawn_JobTracker __instance, ThinkResult __result, ThinkTreeDef thinkTree) { FieldInfo info = __instance.GetType().GetField("pawn", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance); Pawn actor = info.GetValue(__instance) as Pawn; if (actor.Faction != Faction.OfPlayer) { return; } RestrictedEntityManager manager = actor.Map.GetComponent <RestrictedEntityManager>(); manager.EndForbiddenSection(actor); }
public static void Postfix(Pawn_JobTracker __instance, ThinkResult __result, ThinkTreeDef thinkTree) { FieldInfo info = AccessTools.Field(typeof(Pawn_JobTracker), "pawn"); Pawn actor = info.GetValue(__instance) as Pawn; if (actor.Faction != Faction.OfPlayer) { return; } RestrictedEntityManager manager = actor.Map.GetComponent <RestrictedEntityManager>(); manager.EndForbiddenSection(actor); }