예제 #1
0
        public static bool UpdateRotation(Pawn_RotationTracker __instance)
        {
            Pawn pawn = pawnField(__instance);

            if (pawn.Destroyed || pawn.jobs.HandlingFacing)
            {
                return(false);
            }

            if (pawn.pather.Moving)
            {
                if (pawn.pather.curPath != null && pawn.pather.curPath.NodesLeftCount >= 1)
                {
                    FaceAdjacentCell2(pawn, pawn.pather.nextCell);
                }

                return(false);
            }

            Stance_Busy stance_Busy = pawn.stances.curStance as Stance_Busy;

            if (stance_Busy != null && stance_Busy.focusTarg.IsValid)
            {
                if (stance_Busy.focusTarg.HasThing)
                {
                    __instance.Face(stance_Busy.focusTarg.Thing.DrawPos);
                }
                else
                {
                    __instance.FaceCell(stance_Busy.focusTarg.Cell);
                }

                return(false);
            }

            Job job = pawn.CurJob; //ADDED

            if (job != null)       //CHANGED
            {
                Pawn_JobTracker jobs = pawn.jobs;
                if (jobs != null)
                {
                    JobDriver jobDriver = jobs.curDriver;
                    if (jobDriver != null)
                    {
                        LocalTargetInfo target = job.GetTarget(jobDriver.rotateToFace); //CHANGED
                        __instance.FaceTarget(target);
                    }
                }
            }

            if (pawn.Drafted)
            {
                pawn.Rotation = Rot4.South;
            }
            return(false);
        }
예제 #2
0
        static void Postfix(Pawn_RotationTracker __instance, ref Pawn ___pawn)
        {
            Stance_Busy stance_Busy = ___pawn.GetStancesOffHand().curStance as Stance_Busy;

            if (stance_Busy != null && stance_Busy.focusTarg.IsValid && !___pawn.pather.Moving)
            {
                if (stance_Busy.focusTarg.HasThing)
                {
                    __instance.Face(stance_Busy.focusTarg.Thing.DrawPos);
                }
                else
                {
                    __instance.FaceCell(stance_Busy.focusTarg.Cell);
                }
            }
        }
예제 #3
0
        static void Postfix(Pawn_RotationTracker __instance)
        {
            Pawn        pawn        = Traverse.Create(__instance).Field("pawn").GetValue <Pawn>();
            Stance_Busy stance_Busy = pawn.GetStancesOffHand().curStance as Stance_Busy;

            if (stance_Busy != null && stance_Busy.focusTarg.IsValid && !pawn.pather.Moving)
            {
                if (stance_Busy.focusTarg.HasThing)
                {
                    __instance.Face(stance_Busy.focusTarg.Thing.DrawPos);
                }
                else
                {
                    __instance.FaceCell(stance_Busy.focusTarg.Cell);
                }
            }
        }