Пример #1
0
        // Token: 0x0600002F RID: 47 RVA: 0x00002B5C File Offset: 0x00000D5C
        protected override Job TryGiveJob(Pawn pawn)
        {
            PawnDuty duty = pawn.mindState.duty;
            bool     flag = duty == null;
            Job      result;

            if (flag)
            {
                result = null;
            }
            else
            {
                IntVec3 cell;
                bool    flag2 = !SpectatorCellFinder.TryFindSpectatorCellFor(pawn, duty.spectateRect, pawn.Map, out cell, duty.spectateRectAllowedSides, 1, null);
                if (flag2)
                {
                    result = null;
                }
                else
                {
                    IntVec3  centerCell = duty.spectateRect.CenterCell;
                    Building edifice    = cell.GetEdifice(pawn.Map);
                    bool     flag3      = edifice != null && edifice.def.category == ThingCategory.Building && edifice.def.building.isSittable && pawn.CanReserve(edifice, 1, -1, null, false);
                    if (flag3)
                    {
                        result = new Job(JobDefOfArena.SpectateFightingMatch, edifice, centerCell);
                    }
                    else
                    {
                        result = new Job(JobDefOfArena.SpectateFightingMatch, cell, centerCell);
                    }
                }
            }
            return(result);
        }
        public Job GetSpectateJob(Pawn pawn)
        {
            if (activityCurrentStage >= data.ActivityJobs.Count())
            {
                return(null);
            }

            PawnDuty duty = pawn.mindState.duty;

            if (duty == null)
            {
                return((Job)null);
            }

            IntVec3 cell;

            ActivityUtility.TrySendStageEndedSignal(pawn);

            if (pawn == data.Organizer)
            {
                Job job = new Job(JobDefOf.SpectateCeremony, (LocalTargetInfo)data.Facility.Position);
                OrganizerReserve(pawn, job);
            }

            if (!WatchBuildingUtility.TryFindBestWatchCell(data.Facility, pawn, true, out IntVec3 result, out Building chair))
            {
                WatchBuildingUtility.TryFindBestWatchCell(data.Facility, pawn, false, out result, out chair);
            }
            return(new Job(JobDefOf.SpectateCeremony, (LocalTargetInfo)result, (LocalTargetInfo)data.Facility));
        }
Пример #3
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            if (pawn.story.WorkTypeIsDisabled(WorkTypeDefOf.Construction) &&
                pawn.skills.GetSkill(SkillDefOf.Construction).Level < 2)
            {
                return(null);
            }

            PawnDuty duty = pawn.mindState.duty;

            if (duty == null)
            {
                return(null);
            }

            var info = Find.VisibleMap.GetComponent <CarnivalInfo>();

            if (info != null && info.Active)
            {
                Building building = info.carnivalBuildings.LastOrDefault();

                if (building != null && pawn.CanReserveAndReach(building, PathEndMode.ClosestTouch, Danger.None))
                {
                    pawn.Reserve(building);
                    return(new Job(_DefOf.Job_StrikeBuildings, building));
                }
            }

            return(null);
        }
        protected override Job TryGiveJob(Pawn pawn)
        {
            PawnDuty duty = pawn.mindState.duty;

            if (duty == null)
            {
                return(null);
            }
            float curLevelPercentage = pawn.needs.food.CurLevelPercentage;

            if ((double)curLevelPercentage > 0.9)
            {
                return(null);
            }
            IntVec3 cell  = duty.focus.Cell;
            Thing   thing = this.FindFood(pawn, cell);

            if (thing == null)
            {
                return(null);
            }
            Job job = new Job(JobDefOf.Ingest, thing);

            job.count = FoodUtility.WillIngestStackCountOf(pawn, thing.def);
            return(job);
        }
        protected override Job TryGiveJob(Pawn pawn)
        {
            PawnDuty duty = pawn.mindState.duty;

            if (duty == null)
            {
                return(null);
            }
            float curLevelPercentage = pawn.needs.food.CurLevelPercentage;

            if ((double)curLevelPercentage > 0.9)
            {
                return(null);
            }
            IntVec3 cell  = duty.focus.Cell;
            Thing   thing = this.FindFood(pawn, cell);

            if (thing == null)
            {
                return(null);
            }
            return(new Job(JobDefOf.Ingest, thing)
            {
                count = FoodUtility.WillIngestStackCountOf(pawn, thing.def, thing.def.GetStatValueAbstract(StatDefOf.Nutrition, null))
            });
        }
Пример #6
0
        private static Gizmo CreateGizmo_SearchAndDestroy_Ranged(Pawn_DraftController __instance)
        {
            string   disabledReason = "";
            bool     disabled       = false;
            PawnDuty duty           = __instance.pawn.mindState.duty;

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

            if (__instance.pawn.Downed)
            {
                disabled       = true;
                disabledReason = "SD_Reason_Downed".Translate();
            }
            Gizmo gizmo = new Command_Toggle
            {
                defaultLabel   = "SD_Gizmo_Ranged_Label".Translate(),
                defaultDesc    = "SD_Gizmo_Ranged_Description".Translate(),
                hotKey         = KeyBindingDefOf.Command_ItemForbid,
                disabled       = disabled,
                order          = 10.6f,
                disabledReason = disabledReason,
                icon           = ContentFinder <Texture2D> .Get(("UI/" + "SearchAndDestroy_Gizmo_Ranged"), true),
                isActive       = () => pawnData.SD_enabled,
                toggleAction   = () =>
                {
                    pawnData.SD_enabled = !pawnData.SD_enabled;
                    __instance.pawn.jobs.EndCurrentJob(JobCondition.InterruptForced, true);
                }
            };

            return(gizmo);
        }
        protected override Job TryGiveJob(Pawn pawn)
        {
            PawnDuty duty = pawn.mindState.duty;
            Job      result;
            IntVec3  c;

            if (duty == null)
            {
                result = null;
            }
            else if (!SpectatorCellFinder.TryFindSpectatorCellFor(pawn, duty.spectateRect, pawn.Map, out c, duty.spectateRectAllowedSides, 1, null))
            {
                result = null;
            }
            else
            {
                IntVec3  centerCell = duty.spectateRect.CenterCell;
                Building edifice    = c.GetEdifice(pawn.Map);
                if (edifice != null && edifice.def.category == ThingCategory.Building && edifice.def.building.isSittable && pawn.CanReserve(edifice, 1, -1, null, false))
                {
                    result = new Job(JobDefOf.SpectateCeremony, edifice, centerCell);
                }
                else
                {
                    result = new Job(JobDefOf.SpectateCeremony, c, centerCell);
                }
            }
            return(result);
        }
Пример #8
0
        private static void parkAnimal(Pawn_JobTracker __instance, Pawn pawn, ExtendedPawnData pawnData)
        {
            Area_GU areaFound = (Area_GU)pawn.Map.areaManager.GetLabeled(Base.DropAnimal_NPC_LABEL);
            IntVec3 targetLoc = pawn.Position;

            if (areaFound != null && areaFound.ActiveCells.Count() > 0)
            {
                targetLoc = DistanceUtility.getClosestAreaLoc(pawn, areaFound);
            }
            if (pawn.Map.reachability.CanReach(pawn.Position, targetLoc, PathEndMode.OnCell, TraverseParms.For(TraverseMode.PassDoors, Danger.Deadly, false)))
            {
                Job dismountJob = new Job(GUC_JobDefOf.Dismount);
                dismountJob.count = 1;
                __instance.jobQueue.EnqueueFirst(dismountJob);
                __instance.jobQueue.EnqueueFirst(new Job(JobDefOf.Goto, targetLoc));
                PawnDuty animalDuty = pawnData.mount.mindState.duty;
                //if(pawnData.mount.GetLord().CurLordToil is LordToil)

                if (animalDuty != null)
                {
                    animalDuty.focus = new LocalTargetInfo(targetLoc);
                }
            }
            else
            {
                Messages.Message("GU_Car_NotReachable_DropAnimal_NPC_Message".Translate(), new RimWorld.Planet.GlobalTargetInfo(targetLoc, pawn.Map), MessageTypeDefOf.NegativeEvent);
            }
        }
 public override void UpdateAllDuties()
 {
     for (int i = 0; i < lord.ownedPawns.Count; i++)
     {
         PawnDuty duty = new PawnDuty(DutyDefOf.WanderClose, location);
         lord.ownedPawns[i].mindState.duty = duty;
     }
 }
Пример #10
0
 public override void UpdateAllDuties()
 {
     for (int i = 0; i < this.lord.ownedPawns.Count; i++)
     {
         PawnDuty pawnDuty = new PawnDuty(ShipNamespaceDefOfs.LoadShipCargoDuty, ship);
         this.lord.ownedPawns[i].mindState.duty = pawnDuty;
     }
 }
 public override void UpdateAllDuties()
 {
     for (int i = 0; i < lord.ownedPawns.Count; i++)
     {
         PawnDuty duty = new PawnDuty(DutyDefOf.Escort, escortee, followRadius);
         lord.ownedPawns[i].mindState.duty = duty;
     }
 }
 public override void UpdateAllDuties()
 {
     for (int i = 0; i < this.lord.ownedPawns.Count; i++)
     {
         PawnDuty pawnDuty = new PawnDuty(CultsDefOf.Cults_LoadAndEnterTransportersPawn);
         pawnDuty.transportersGroup             = this.transportersGroup;
         this.lord.ownedPawns[i].mindState.duty = pawnDuty;
     }
 }
Пример #13
0
 public override void UpdateAllDuties()
 {
     for (int i = 0; i < lord.ownedPawns.Count; i++)
     {
         PawnDuty duty = new PawnDuty(DutyDefOf.Idle);
         DecoratePawnDuty(duty);
         lord.ownedPawns[i].mindState.duty = duty;
     }
 }
Пример #14
0
 public override void UpdateAllDuties()
 {
     foreach (Pawn pawn in this.lord.ownedPawns)
     {
         PawnDuty pawnDuty = new PawnDuty(Util_DutyDefOf.HealColonists);
         pawn.mindState.duty       = pawnDuty;
         pawn.mindState.duty.focus = this.Data.spaceshipPosition;
     }
 }
Пример #15
0
 public override void UpdateAllDuties()
 {
     for (int i = 0; i < this.lord.ownedPawns.Count; i++)
     {
         PawnDuty pawnDuty = new PawnDuty(DefDatabase <DutyDef> .GetNamed("PD_LoadAndEnterPit"));
         pawnDuty.transportersGroup             = this.transportersGroup;
         this.lord.ownedPawns[i].mindState.duty = pawnDuty;
     }
 }
Пример #16
0
 public override void UpdateAllDuties()
 {
     for (int i = 0; i < lord.ownedPawns.Count; i++)
     {
         PawnDuty pawnDuty = new PawnDuty(DutyDefOf.BestowingCeremony_MoveInPlace, spot);
         pawnDuty.locomotion = LocomotionUrgency.Walk;
         lord.ownedPawns[i].mindState.duty = pawnDuty;
     }
 }
Пример #17
0
 public override void UpdateAllDuties()
 {
     for (int i = 0; i < lord.ownedPawns.Count; i++)
     {
         PawnDuty pawnDuty = new PawnDuty(DutyDefOf.LoadAndEnterTransporters);
         pawnDuty.transportersGroup        = transportersGroup;
         lord.ownedPawns[i].mindState.duty = pawnDuty;
     }
 }
Пример #18
0
 public override void UpdateAllDuties()
 {
     for (int i = 0; i < this.lord.ownedPawns.Count; i++)
     {
         Pawn     pawn     = this.lord.ownedPawns[i];
         PawnDuty pawnDuty = new PawnDuty(DefOfs.C_DutyDefOfs.JoinSermon, preacher, altar);
         pawnDuty.maxDanger  = Danger.Some;
         pawn.mindState.duty = pawnDuty;
     }
 }
Пример #19
0
 public override void UpdateAllDuties()
 {
     this.FilterOutUnspawnedWombs();
     for (int i = 0; i < this.lord.ownedPawns.Count; i++)
     {
         WombBetweenWorlds hiveFor = this.GetHiveFor(this.lord.ownedPawns[i]);
         PawnDuty          duty    = new PawnDuty(CultDefOfs.DefendAndExpandWomb, hiveFor, this.distToHiveToAttack);
         this.lord.ownedPawns[i].mindState.duty = duty;
     }
 }
Пример #20
0
 // Token: 0x06003285 RID: 12933 RVA: 0x00118DB0 File Offset: 0x00116FB0
 public override void UpdateAllDuties()
 {
     base.FilterOutUnspawnedHives();
     for (int i = 0; i < this.lord.ownedPawns.Count; i++)
     {
         Hive     hiveFor = base.GetHiveFor(this.lord.ownedPawns[i]);
         PawnDuty duty    = new PawnDuty(DutyDefOf.DefendHiveAggressively, hiveFor, this.distToHiveToAttack);
         this.lord.ownedPawns[i].mindState.duty = duty;
     }
 }
Пример #21
0
 public override void UpdateAllDuties()
 {
     this.FilterOutUnspawnedHives();
     for (int i = 0; i < this.lord.ownedPawns.Count; i++)
     {
         MotherAmbrosiaLGE hiveFor = this.GetHiveFor(this.lord.ownedPawns[i]);
         PawnDuty          duty    = new PawnDuty(DefsOfLGE.DefendAmbrosiaSproutLGE, hiveFor, this.distToHiveToAttack);
         this.lord.ownedPawns[i].mindState.duty = duty;
     }
 }
Пример #22
0
 public override void UpdateAllDuties()
 {
     for (int i = 0; i < this.lord.ownedPawns.Count; i++)
     {
         PawnDuty pawnDuty = new PawnDuty(DutyDefOf.ExitMapNearDutyTarget, this.near, this.radius);
         pawnDuty.locomotion = this.locomotion;
         pawnDuty.canDig     = this.canDig;
         this.lord.ownedPawns[i].mindState.duty = pawnDuty;
     }
 }
 public override void UpdateAllDuties()
 {
     this.FilterOutUnspawnedHives();
     for (int i = 0; i < base.lord.ownedPawns.Count; i++)
     {
         Hive     hiveFor = this.GetHiveFor(base.lord.ownedPawns[i]);
         PawnDuty duty    = new PawnDuty(DutyDefOf.DefendAndExpandHive, hiveFor, this.distToHiveToAttack);
         base.lord.ownedPawns[i].mindState.duty = duty;
     }
 }
Пример #24
0
 // Token: 0x06000860 RID: 2144 RVA: 0x00047694 File Offset: 0x00045A94
 public override void UpdateAllDuties()
 {
     base.FilterOutUnspawnedHiveLikes();
     for (int i = 0; i < this.lord.ownedPawns.Count; i++)
     {
         HiveLike hiveFor = (HiveLike)base.GetHiveLikeFor(this.lord.ownedPawns[i]);
         PawnDuty duty    = new PawnDuty(OGHiveLikeDefOf.OGAMXB_DefendAndExpandHiveLike, hiveFor, this.distToHiveToAttack);
         this.lord.ownedPawns[i].mindState.duty = duty;
     }
 }
Пример #25
0
 public override void UpdateAllDuties()
 {
     foreach (var pawn in lord.ownedPawns)
     {
         var pawnDuty = new PawnDuty(CultsDefOf.Cults_LoadAndEnterTransportersPawn)
         {
             transportersGroup = transportersGroup
         };
         pawn.mindState.duty = pawnDuty;
     }
 }
Пример #26
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            PawnDuty duty = pawn.mindState.duty;

            if (duty == null)
            {
                return(null);
            }

            return(new Job(_DefOf.Job_StandAtLoc, duty.focus, duty.focusSecond));
        }
Пример #27
0
        public override void UpdateAllDuties()
        {
            LordToilData_Travel data = this.Data;

            for (int i = 0; i < this.lord.ownedPawns.Count; i++)
            {
                PawnDuty pawnDuty = new PawnDuty(DutyDefOf.TravelOrLeave, data.dest, -1f);
                pawnDuty.maxDanger = this.maxDanger;
                this.lord.ownedPawns[i].mindState.duty = pawnDuty;
            }
        }
Пример #28
0
 public override void UpdateAllDuties()
 {
     for (var i = 0; i < lord.ownedPawns.Count; i++)
     {
         var pawnDuty = new PawnDuty(CultsDefOf.Cults_LoadAndEnterTransportersPawn)
         {
             transportersGroup = transportersGroup
         };
         lord.ownedPawns[i].mindState.duty = pawnDuty;
     }
 }
Пример #29
0
        public static bool GetWanderRoot(JobGiver_WanderNearDutyLocation __instance, ref IntVec3 __result, Pawn pawn)
        {
            __result = IntVec3.Invalid;
            PawnDuty duty = pawn.mindState.duty;

            if (duty != null)
            {
                __result = WanderUtility.BestCloseWanderRoot(duty.focus.Cell, pawn);
            }
            return(false);
        }
Пример #30
0
        public override void UpdateAllDuties()
        {
            LordToilData_ExitMap data = Data;

            for (int i = 0; i < lord.ownedPawns.Count; i++)
            {
                PawnDuty pawnDuty = new PawnDuty(DutyDefOf.ExitMapBest);
                pawnDuty.locomotion = data.locomotion;
                pawnDuty.canDig     = data.canDig;
                lord.ownedPawns[i].mindState.duty = pawnDuty;
            }
        }