Exemplo n.º 1
0
 static void Postfix(ExtendedPawnData riderData, JobDriver_Mounted __instance, ref bool __result)
 {
     if (__instance.Rider == null)
     {
         __result = true;
         return;
     }
     if (__instance.pawn.Faction == Faction.OfPlayer && !__instance.Rider.Drafted && __instance.Rider.CurJob != null && !allowedJobs.Contains(__instance.Rider.CurJob.def))
     {
         if (__instance.Rider.CurJob.def == JobDefOf.EnterTransporter)
         {
             __result = true;
         }
         if (!__instance.Rider.Drafted && __instance.pawn.HungryOrTired())
         {
             __result = true;
         }
         if (__instance.Rider.CurJob.def == JobDefOf.Hunt && Base.noMountedHunting)
         {
             __result = true;
         }
         else if (!__instance.Rider.pather.Moving)
         {
             __result = true;
         }
     }
 }
Exemplo n.º 2
0
 static void Postfix(ExtendedPawnData riderData, JobDriver_Mounted __instance, ref bool __result)
 {
     if (__instance.pawn.Faction == Faction.OfPlayer && __instance.pawn.RaceProps.IsMechanoid && !__instance.Rider.Drafted)
     {
         //only allow mechanoid mounts in battle for now
         __result = true;
     }
 }
        static void Postfix(JobDriver_Mounted __instance)
        {
            ExtendedPawnData pawnData = Base.Instance.GetExtendedDataStorage().GetExtendedDataFor(__instance.pawn);

            if (!__instance.Rider.Drafted && __instance.pawn.Faction == Faction.OfPlayer)
            {
                if (pawnData.ownedBy != null && !__instance.interrupted)
                {
                    __instance.pawn.jobs.jobQueue.EnqueueFirst(new Job(JobDefOf.Wait, 10000, true)); //wait a while before returning to camp, to give the rider the chance to ride back. Not needed when pawn is master.
                }
            }
        }
Exemplo n.º 4
0
 static void Postfix(ExtendedPawnData riderData, JobDriver_Mounted __instance, ref bool __result)
 {
     if (__instance.pawn.Faction == Faction.OfPlayer && !__instance.Rider.Drafted && __instance.Rider.CurJob != null && !allowedJobs.Contains(__instance.Rider.CurJob.def))
     {
         if (__instance.Rider.CurJob.def == JobDefOf.Hunt && !Base.noMountedHunting)
         {
             __result = false;
         }
         else
         {
             __result = true;
         }
     }
 }
Exemplo n.º 5
0
        public static bool IsCurrentlyMounted(Pawn animal)
        {
            if (animal.CurJob == null || animal.CurJob.def != GUC_JobDefOf.Mounted)
            {
                return(false);
            }
            JobDriver_Mounted mountedDriver = (JobDriver_Mounted)animal.jobs.curDriver;
            Pawn Rider = mountedDriver.Rider;
            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store == null || store.GetExtendedDataFor(Rider).mount == null)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 6
0
            static void Prefix(JobDriver __instance)
            {
                if (__instance.job.def != GUC_JobDefOf.Mounted)
                {
                    return;
                }
                JobDriver_Mounted jobDriver = (JobDriver_Mounted)__instance;

                ExtendedPawnData pawnData = Base.Instance.GetExtendedDataStorage().GetExtendedDataFor(jobDriver.pawn);

                if (pawnData != null)
                {
                    Pawn             Rider     = jobDriver.Rider;
                    ExtendedPawnData riderData = Base.Instance.GetExtendedDataStorage().GetExtendedDataFor(Rider);
                    riderData.reset();
                    jobDriver.pawn.Drawer.tweener = new PawnTweener(jobDriver.pawn);
                }
            }
        static void Postfix(JobDriver_Mounted __instance, ref bool __result)
        {
            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store == null)
            {
                __result = true;
                return;
            }
            ExtendedPawnData pawnData = store.GetExtendedDataFor(__instance.pawn);

            if (pawnData.targetJob == null)
            {
                __result = true;
                return;
            }
            __result = ReserveUtility.ReserveEveryThingOfJob(pawnData.targetJob, __instance);
        }
        static void Postfix(JobDriver_Mounted __instance)
        {
            ExtendedPawnData pawnData = Base.Instance.GetExtendedDataStorage().GetExtendedDataFor(__instance.pawn);

            if (!__instance.Rider.Drafted && __instance.pawn.Faction == Faction.OfPlayer)
            {
                if (pawnData.ownedBy != null && !__instance.interrupted && __instance.Rider.GetCaravan() == null)
                {
                    __instance.pawn.jobs.jobQueue.EnqueueFirst(new Job(GU_RR_DefOf.WaitForRider, pawnData.ownedBy)
                    {
                        expiryInterval        = 10000,
                        checkOverrideOnExpire = true,
                        followRadius          = 8,
                        locomotionUrgency     = LocomotionUrgency.Walk
                    }
                                                               ); //follow the rider for a while to give it an opportunity to take a ride back.
                }
            }
        }