static void Prefix(Pawn_JobTracker __instance)
        {
            Pawn_JobTracker tracker = __instance;
            Pawn            p       = (Pawn)typeof(Pawn_JobTracker).InvokeMember("pawn",
                                                                                 BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic,
                                                                                 null, tracker, null);

            if (p == null)
            {
                throw new Exception("Pawn_JobTracker.pawn is null");
            }
            if (tracker.IsCurrentJobPlayerInterruptible() &&
                tracker.jobQueue.Count == 0 &&
                (tracker.curJob == null ||
                 JobTypeWhitelist.hashset.Contains(tracker.curJob.def) ||
                 TacticsMode.LastActionExpired(p)))
            {
                TacticsMode.TryDoTacticalAction(p);
            }
        }
        static IEnumerable <Gizmo> Postfix(IEnumerable <Gizmo> gizmos, Pawn __instance)
        {
            foreach (Gizmo gizmo in gizmos)
            {
                yield return(gizmo);
            }
            var tactical = new Command_Toggle
            {
                icon         = ContentFinder <UnityEngine.Texture2D> .Get("Buttons/Pawn", true),
                defaultLabel = "Tactics",
                defaultDesc  = "Toggle tactics mode for this colonist. The game will pause and center on the colonist when they finish a job, allowing you to micromanage them.",
                isActive     = (() => TacticsMode.HasTacticsModeToggledOn(__instance)),
                toggleAction = delegate {
                    TacticsMode.SetTacticsMode(__instance, !TacticsMode.HasTacticsModeToggledOn(__instance));
                },
                hotKey = null
            };

            if (TacticsMode.CanEverBeInTacticsMode(__instance))
            {
                yield return(tactical);
            }
        }
 public TacticsMode()
 {
     _instance = this;
 }