예제 #1
0
        public override void DefsLoaded()
        {
            InviteJob = DefDatabase <JobDef> .GetNamed("bdew_longdistance_invite");

            BreakupJob = DefDatabase <JobDef> .GetNamed("bdew_longdistance_breakup");

            RejectedThoughtInviter = DefDatabase <ThoughtDef> .GetNamed("bdew_longdistance_inv_rejected");

            RejectedThoughtTarget = DefDatabase <ThoughtDef> .GetNamed("bdew_longdistance_inv_rejected_target");

            RejectedThoughtInviterMood = DefDatabase <ThoughtDef> .GetNamed("bdew_longdistance_inv_rejected_mood");

            AcceptedThoughtInviter = DefDatabase <ThoughtDef> .GetNamed("bdew_longdistance_inv_accepted");

            AcceptedThoughtTarget = DefDatabase <ThoughtDef> .GetNamed("bdew_longdistance_inv_accepted_target");

            AcceptedThoughtInviterMood = DefDatabase <ThoughtDef> .GetNamed("bdew_longdistance_inv_accepted_mood");

            MinDaysToJoin = Settings.GetHandle("MinDaysToJoin", "LongDistance.Settings.MinDaysToJoin.Name".Translate(), "LongDistance.Settings.MinDaysToJoin.Desc".Translate(), 0.5f);
            MaxDaysToJoin = Settings.GetHandle("MaxDaysToJoin", "LongDistance.Settings.MaxDaysToJoin.Name".Translate(), "LongDistance.Settings.MaxDaysToJoin.Desc".Translate(), 3f);

            JoinBaseChance    = Settings.GetHandle("JoinBaseChance", "LongDistance.Settings.JoinBaseChance.Name".Translate(), "LongDistance.Settings.JoinBaseChance.Desc".Translate(), 0f);
            JoinOpinionFactor = Settings.GetHandle("JoinOpinionFactor", "LongDistance.Settings.JoinOpinionFactor.Name".Translate(), "LongDistance.Settings.JoinOpinionFactor.Desc".Translate(), 0.01f);
            JoinSkillFactor   = Settings.GetHandle("JoinSkillFactor", "LongDistance.Settings.JoinSkillFactor.Name".Translate(), "LongDistance.Settings.JoinSkillFactor.Desc".Translate(), 0.1f);
            JoinFactionFactor = Settings.GetHandle("JoinFactionFactor", "LongDistance.Settings.JoinFactionFactor.Name".Translate(), "LongDistance.Settings.JoinFactionFactor.Desc".Translate(), 0.002f);

            BreakupBaseChance    = Settings.GetHandle("BreakupBaseChance", "LongDistance.Settings.BreakupBaseChance.Name".Translate(), "LongDistance.Settings.BreakupBaseChance.Desc".Translate(), 0.2f);
            BreakupOpinionFactor = Settings.GetHandle("BreakupOpinionFactor", "LongDistance.Settings.BreakupOpinionFactor.Name".Translate(), "LongDistance.Settings.BreakupOpinionFactor.Desc".Translate(), 0.02f);

            PositiveRelationTreshold = Settings.GetHandle("PositiveRelationTreshold", "LongDistance.Settings.PositiveRelationTreshold.Name".Translate(), "LongDistance.Settings.PositiveRelationTreshold.Desc".Translate(), 50);
            NegativeRelationTreshold = Settings.GetHandle("NegativeRelationTreshold", "LongDistance.Settings.NegativeRelationTreshold.Name".Translate(), "LongDistance.Settings.NegativeRelationTreshold.Desc".Translate(), -50);
        }
        public static bool TryGetValue(this ToolComp comp, JobDef job, StatDef stat, out float factor, out float offset, ToolType toolType = null)
        {
            factor = 1f;
            offset = 0f;
            if (toolType == null && !Dictionaries.jobToolType.TryGetValue(job, out toolType))
            {
                return(false);
            }
            if (!comp.TryGetValue(job, out var val, toolType))
            {
                return(false);
            }
            bool flag = false;

            factor = toolType.workStatFactors.GetStatValueFromList(stat, 0f);
            if (factor != 0f)
            {
                factor *= val;
                flag    = true;
            }
            else
            {
                factor = 1f;
            }
            offset = toolType.workStatOffset.GetStatValueFromList(stat, 0f);
            if (offset != 0f)
            {
                flag   = true;
                offset = val - offset;
            }
            return(flag);
        }
예제 #3
0
파일: Base.cs 프로젝트: skalou/RW_Stabilize
            public static void AddHumanlikeOrdersPostfix(Vector3 clickPos, Pawn pawn, List <FloatMenuOption> opts)
            {
                if (!pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation) || pawn.WorkTagIsDisabled(WorkTags.Caring) || pawn.WorkTypeIsDisabled(WorkTypeDefOf.Doctor) || !pawn.workSettings.WorkIsActive(WorkTypeDefOf.Doctor))
                {
                    return;
                }

                foreach (LocalTargetInfo localTargetInfo in GenUI.TargetsAt(clickPos, TargetingParameters.ForRescue(pawn), true))
                {
                    Pawn target = (Pawn)localTargetInfo.Thing;

                    if (!target.health.HasHediffsNeedingTend())
                    {
                        continue;
                    }

                    if (!pawn.CanReserveAndReach(target, PathEndMode.OnCell, Danger.Deadly, 1, -1, null, true))
                    {
                        // TODO: Add grayed out message
                        continue;
                    }

                    JobDef stabilizeJD = DefDatabase <JobDef> .GetNamed("StabilizeHere");

                    Action action = () => {
                        Job job = new Job(stabilizeJD, target);
                        job.count = 1;

                        pawn.jobs.TryTakeOrderedJob(job);
                    };

                    string text = "StabilizePawn".Translate(target.LabelCap, target);
                    opts.Add(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(text, action, MenuOptionPriority.RescueOrCapture, null, target, 0f, null, null), pawn, target, "ReservedBy"));
                }
            }
예제 #4
0
        // Token: 0x0600002C RID: 44 RVA: 0x000031D8 File Offset: 0x000013D8
        public void RefuelJP(Pawn pilot, Thing JP, bool Using)
        {
            if (Using)
            {
                if (this.JPComposMentis(pilot, JP, out string Reason))
                {
                    if (this.JPFuelAmount >= this.JPFuelMax)
                    {
                        Messages.Message(TranslatorFormattedStringExtensions.Translate("JetPack.FullyFueled", GenText.CapitalizeFirst(JP.Label)), pilot, MessageTypeDefOf.NeutralEvent, false);
                        SoundStarter.PlayOneShotOnCamera(SoundDefOf.ClickReject, null);
                        return;
                    }
                    JobDef JPRefuel = DefDatabase <JobDef> .GetNamed("JPRefuel", true);

                    this.FindBestJPFuel(pilot, out Thing targ);
                    if (targ != null)
                    {
                        Job job = new Job(JPRefuel, targ);
                        pilot.jobs.TryTakeOrderedJob(job, 0);
                        return;
                    }
                    Messages.Message(TranslatorFormattedStringExtensions.Translate("JetPack.NoFuelFound", GenText.CapitalizeFirst(this.JPFuelItem.label)), pilot, MessageTypeDefOf.NeutralEvent, false);
                    SoundStarter.PlayOneShotOnCamera(SoundDefOf.ClickReject, null);
                    return;
                }
                else
                {
                    Messages.Message(TranslatorFormattedStringExtensions.Translate("JetPack.CantDo", pilot, Reason), pilot, MessageTypeDefOf.NeutralEvent, false);
                    SoundStarter.PlayOneShotOnCamera(SoundDefOf.ClickReject, null);
                }
            }
        }
예제 #5
0
        public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn)
        {
            if (myPawn.IsQuestLodger())
            {
                yield return(new FloatMenuOption("CannotUseReason".Translate("CryptosleepCasketGuestsNotAllowed".Translate()), null));

                yield break;
            }
            foreach (FloatMenuOption floatMenuOption in base.GetFloatMenuOptions(myPawn))
            {
                yield return(floatMenuOption);
            }
            if (innerContainer.Count == 0)
            {
                if (!myPawn.CanReach(this, PathEndMode.InteractionCell, Danger.Deadly))
                {
                    yield return(new FloatMenuOption("CannotUseNoPath".Translate(), null));

                    yield break;
                }
                JobDef jobDef = JobDefOf.EnterCryptosleepCasket;
                string label  = "EnterCryptosleepCasket".Translate();
                Action action = delegate
                {
                    Job job = JobMaker.MakeJob(jobDef, this);
                    myPawn.jobs.TryTakeOrderedJob(job);
                };
                yield return(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(label, action), myPawn, this));
            }
        }
 public Job_Story(JobDef def, LocalTargetInfo targetA, Objective objective)
 {
     this.def       = def;
     this.targetA   = targetA;
     this.objective = objective;
     this.loadID    = Find.UniqueIDsManager.GetNextJobID();
 }
예제 #7
0
        private void OrderPawnForceTarget(Verb verb)
        {
            LocalTargetInfo targetA = this.CurrentTargetUnderMouse(true);

            if (targetA.IsValid)
            {
                if (verb.verbProps.IsMeleeAttack)
                {
                    Job job = new Job(JobDefOf.AttackMelee, targetA);
                    job.playerForced = true;
                    Pawn pawn = targetA.Thing as Pawn;
                    if (pawn != null)
                    {
                        job.killIncappedTarget = pawn.Downed;
                    }
                    verb.CasterPawn.jobs.TryTakeOrderedJob(job, JobTag.Misc);
                }
                else
                {
                    JobDef def  = (!verb.verbProps.ai_IsWeapon) ? JobDefOf.UseVerbOnThing : JobDefOf.AttackStatic;
                    Job    job2 = new Job(def);
                    job2.verbToUse = verb;
                    job2.targetA   = targetA;
                    verb.CasterPawn.jobs.TryTakeOrderedJob(job2, JobTag.Misc);
                }
            }
        }
예제 #8
0
 public Job(JobDef def, LocalTargetInfo targetA, LocalTargetInfo targetB)
 {
     this.def     = def;
     this.targetA = targetA;
     this.targetB = targetB;
     loadID       = Find.UniqueIDsManager.GetNextJobID();
 }
예제 #9
0
        public bool HasJobOnRecipe(Job job, out JobDef jobDef)
        {
            jobDef = null;
            ThingDef def = job.targetQueueB.First().Thing.def;

            if (job.bill.recipe == PurpleIvyDefOf.PI_BiomaterialsStudyRecipe)
            {
                foreach (var data in PurpleIvyData.BioStudy[def])
                {
                    if (data.PrerequisitesCompleted &&
                        data.TechprintsApplied == 0 &&
                        this.Map.listerThings.ThingsOfDef
                            (ThingDef.Named("Techprint_" + data.defName)).Count == 0)
                    {
                        jobDef      = PurpleIvyDefOf.PI_BiomaterialsStudy;
                        job.targetB = ThingMaker.MakeThing(ThingDef.Named("Techprint_" + data.defName));
                        return(true);
                    }
                }
            }
            else
            {
                jobDef = JobDefOf.DoBill;
                return(true);
            }
            return(false);
        }
예제 #10
0
 public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn)
 {
     foreach (FloatMenuOption o in base.GetFloatMenuOptions(selPawn))
     {
         yield return(o);
     }
     if (this.innerContainer.Count == 0)
     {
         if (!myPawn.CanReach(this, PathEndMode.InteractionCell, Danger.Deadly, false, TraverseMode.ByPawn))
         {
             FloatMenuOption failer = new FloatMenuOption("CannotUseNoPath".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null);
             yield return(failer);
         }
         else
         {
             JobDef jobDef    = JobDefOf.EnterCryptosleepCasket;
             string jobStr    = "EnterCryptosleepCasket".Translate();
             Action jobAction = delegate
             {
                 Job job = new Job(jobDef, this.$this);
                 myPawn.jobs.TryTakeOrderedJob(job, JobTag.Misc);
             };
             yield return(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(jobStr, jobAction, MenuOptionPriority.Default, null, null, 0f, null, null), myPawn, this, "ReservedBy"));
         }
     }
 }
예제 #11
0
        public static Texture2D StatusIcon(this JobDef job)
        {
            Texture2D icon;

            if (JobIcons.TryGetValue(job, out icon))
            {
                return(icon);
            }

            // TODO: had some odd reports of missing keys - remove the try block once resolved
            try
            {
                Logger.Debug($"Loading icon '{JobIconPaths[job]}' for job '{job.defName}'");
                icon = ContentFinder <Texture2D> .Get(JobIconPaths[job]);

                JobIcons.Add(job, icon);
            }
            catch (Exception e)
            {
                icon = DefaultJobIcon;
                Logger.Error($"Error while loading icon '{JobIconPaths[job]}' for job '{job.defName}';\n{e}");
            }

            return(icon);
        }
예제 #12
0
 // Token: 0x06002514 RID: 9492 RVA: 0x00116FA0 File Offset: 0x001153A0
 public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn)
 {
     foreach (FloatMenuOption o in base.GetFloatMenuOptions(myPawn))
     {
         yield return(o);
     }
     if (!this.TryGetComp <CompPowerTrader>().PowerOn)
     {
         yield return(new FloatMenuOption("CannotUseNoPower".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null));
     }
     else if (this.innerContainer.Count == 0)
     {
         if (myPawn.CanReach(this, PathEndMode.InteractionCell, Danger.Deadly, false, TraverseMode.ByPawn))
         {
             JobDef jobDef    = BarberPodDefsOf.UseBarberPod;
             string jobStr    = "Enter barber pod";
             Action jobAction = delegate()
             {
                 Job job = new Job(jobDef, this);
                 myPawn.jobs.TryTakeOrderedJob(job, JobTag.Misc);
             };
             yield return(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(jobStr, jobAction, MenuOptionPriority.Default, null, null, 0f, null, null), myPawn, this, "ReservedBy"));
         }
     }
     yield break;
 }
예제 #13
0
    void StartConstructionJobButton()
    {
        // Get resource list
        ResourceQuantityQualityList jobResources = resourceChoiceDropdown.GetCurrentChoices();

        JobDef newConstructionJobDef = CreateConstructionJobDef(jobResources, resourceChoiceDropdown.taskName);

        BuildingJobObj newJob = jobManager.AddConstructionJob(newConstructionJobDef, iLoc, jLoc);

        newJob.SetResources(jobResources);
        newJob.StartJob();
        newJob.AddWorker();
        newJob.AddWorker();
        newJob.AddWorker();
        newJob.AddWorker();
        newJob.AddWorker();
        newJob.AddWorker();
        newJob.AddWorker();
        newJob.AddWorker();
        newJob.AddWorker();
        newJob.AddWorker();

        // Change surface type to construction
        ManagerBase.domain.mapData.SetSurfaceValue(iLoc, jLoc, ManagerBase.surfaceValueDictionary["Gear"]);

        // Reload the map and re-focus on the tile
        WorldEventHandlerManager.Broadcast(worldEventChannels.map, mapChannelEvents.change, new WorldEventArg(iLoc, jLoc));
    }
예제 #14
0
 public Job(JobDef def, int expiryInterval, bool checkOverrideOnExpiry = false)
 {
     this.def              = def;
     this.expiryInterval   = expiryInterval;
     checkOverrideOnExpire = checkOverrideOnExpiry;
     loadID = Find.UniqueIDsManager.GetNextJobID();
 }
예제 #15
0
        // Token: 0x06000085 RID: 133 RVA: 0x00004F68 File Offset: 0x00003168
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Thing  f      = null;
            JobDef useDef = null;

            if (AQUtility.AddOrRemove(t, out bool Add, out ThingDef fAddDef, out bool Remove))
            {
                if (Add)
                {
                    f = AQUtility.GetClosestFishInBag(pawn, fAddDef, t);
                    if (f != null)
                    {
                        useDef = DefDatabase <JobDef> .GetNamed("AQManagingAdd", false);
                    }
                }
                else if (Remove)
                {
                    useDef = DefDatabase <JobDef> .GetNamed("AQManagingRemove", false);
                }
            }
            Job newJob = null;

            if (useDef != null)
            {
                newJob = new Job(useDef, t, f);
            }
            return(newJob);
        }
예제 #16
0
파일: Job.cs 프로젝트: xywf221/RimThreaded
        public static bool ToString(Job __instance, ref String __result)
        {
            JobDef jobDef = __instance.def;
            string text1  = "";

            if (jobDef != null)
            {
                text1 = jobDef.ToString();
            }
            string text = text1 + " (" + __instance.GetUniqueLoadID() + ")";

            if (__instance.targetA.IsValid)
            {
                text = text + " A=" + __instance.targetA.ToString();
            }

            if (__instance.targetB.IsValid)
            {
                text = text + " B=" + __instance.targetB.ToString();
            }

            if (__instance.targetC.IsValid)
            {
                text = text + " C=" + __instance.targetC.ToString();
            }
            __result = text;
            return(false);
        }
예제 #17
0
        /// <summary>
        /// Gets all the witnesses of a criminal's acts.
        /// </summary>
        /// <param name="pawn"></param>
        /// <returns></returns>
        public static List <Pawn> WitnessesOf(Pawn criminal, Pawn victim, JobDef crime)
        {
            List <Pawn> result = null;
            Map         map    = criminal.Map;
            int         num    = 0;

            while ((float)num < 100f)
            {
                IntVec3 intVec = criminal.Position + GenRadial.RadialPattern[num];
                if (intVec.InBounds(map))
                {
                    if (GenSight.LineOfSight(intVec, criminal.Position, map, true))
                    {
                        List <Thing> thingList = intVec.GetThingList(map);
                        for (int i = 0; i < thingList.Count; i++)
                        {
                            //
                            if (thingList[i] is Pawn p && p.ShouldCareAboutCrime(criminal, victim, crime))
                            {
                                if (result == null)
                                {
                                    result = new List <Pawn>();
                                }
                                result.Add(p);
                            }
                        }
                    }
                }
                num++;
            }
            return(result);
        }
예제 #18
0
파일: Job.cs 프로젝트: KraigXu/GameProject
 public void Clear()
 {
     def                            = null;
     targetA                        = LocalTargetInfo.Invalid;
     targetB                        = LocalTargetInfo.Invalid;
     targetC                        = LocalTargetInfo.Invalid;
     targetQueueA                   = null;
     targetQueueB                   = null;
     count                          = -1;
     countQueue                     = null;
     loadID                         = -1;
     startTick                      = -1;
     expiryInterval                 = -1;
     checkOverrideOnExpire          = false;
     playerForced                   = false;
     placedThings                   = null;
     maxNumMeleeAttacks             = int.MaxValue;
     maxNumStaticAttacks            = int.MaxValue;
     locomotionUrgency              = LocomotionUrgency.Jog;
     haulMode                       = HaulMode.Undefined;
     bill                           = null;
     commTarget                     = null;
     plantDefToSow                  = null;
     verbToUse                      = null;
     haulOpportunisticDuplicates    = false;
     exitMapOnArrival               = false;
     failIfCantJoinOrCreateCaravan  = false;
     killIncappedTarget             = false;
     ignoreForbidden                = false;
     ignoreDesignations             = false;
     canBash                        = false;
     canUseRangedWeapon             = true;
     haulDroppedApparel             = false;
     restUntilHealed                = false;
     ignoreJoyTimeAssignment        = false;
     doUntilGatheringEnded          = false;
     overeat                        = false;
     attackDoorIfTargetLost         = false;
     takeExtraIngestibles           = 0;
     expireRequiresEnemiesNearby    = false;
     lord                           = null;
     collideWithPawns               = false;
     forceSleep                     = false;
     interaction                    = null;
     endIfCantShootTargetFromCurPos = false;
     endIfCantShootInMelee          = false;
     checkEncumbrance               = false;
     followRadius                   = 0f;
     endAfterTendedOnce             = false;
     quest                          = null;
     mote                           = null;
     jobGiverThinkTree              = null;
     jobGiver                       = null;
     workGiverDef                   = null;
     if (cachedDriver != null)
     {
         cachedDriver.job = null;
     }
     cachedDriver = null;
 }
예제 #19
0
        public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn)
        {
            foreach (FloatMenuOption floatMenuOption in base.GetFloatMenuOptions(myPawn))
            {
                yield return(floatMenuOption);
            }
            if (!MutagenDefOf.MergeMutagen.CanTransform(myPawn))
            {
                yield break;
            }

            if (innerContainer.Count == 0)
            {
                if (!myPawn.CanReach(this, PathEndMode.InteractionCell, Danger.Deadly))
                {
                    yield return(new FloatMenuOption("CannotUseNoPath".Translate(), null));

                    yield break;
                }
                JobDef jobDef    = EnterMutagenChamber;
                string jobStr    = "EnterMutagenChamber".Translate();
                Action jobAction = delegate
                {
                    Job job = new Job(jobDef, this);
                    myPawn.jobs.TryTakeOrderedJob(job);
                };
                yield return(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(jobStr, jobAction), myPawn, this));
            }
        }
예제 #20
0
        public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn)
        {
            foreach (FloatMenuOption o in base.GetFloatMenuOptions(myPawn))
            {
                yield return(o);
            }
            if (this.innerContainer.Count < maxCount)
            {
                if (Toils_bunker.getEnterOutLoc(this) == null)//!myPawn.CanReach(this, PathEndMode.InteractionCell, Danger.Deadly, false, TraverseMode.ByPawn))
                {
                    FloatMenuOption failer = new FloatMenuOption("CannotUseNoPath".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null);
                    yield return(failer);
                }
                else
                {
                    JobDef jobDef = DefDatabase <JobDef> .GetNamed("EnterRa2Bunker", true);  //JobDefOf.EnterCryptosleepCasket;

                    string jobStr    = "EnterRa2Bunker".Translate();
                    Action jobAction = delegate
                    {
                        Job job = new Job(jobDef, this);
                        myPawn.jobs.TryTakeOrderedJob(job, JobTag.Misc);
                    };
                    yield return(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(jobStr, jobAction, MenuOptionPriority.Default, null, null, 0f, null, null), myPawn, this, "ReservedBy"));
                }
            }
            yield break;
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            Log.Message("MakeNewToils called");
            initialJob = Followee.CurJobDef;
            this.FailOn(() => pawn.Map == null);
            Toil firstToil = new Toil {
                initAction = delegate
                {
                    WalkRandomNearby();
                }
            };

            firstToil.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(firstToil);

            Toil toil = new Toil
            {
                tickAction = delegate
                {
                    if (this.Followee.jobs.curJob.def == JobDefOf.LayDown ||
                        this.Followee.jobs.curJob.def == JobDefOf.Research ||
                        this.Followee.InMentalState ||
                        this.Followee.Dead ||
                        this.Followee.Downed ||
                        this.Followee.CurJobDef == GUC_JobDefOf.Mount ||
                        this.Followee.Map == null ||
                        pawn.health.HasHediffsNeedingTend() ||
                        (pawn.needs.food != null && pawn.needs.food.CurCategory >= HungerCategory.UrgentlyHungry) ||
                        pawn.needs.rest != null && pawn.needs.rest.CurCategory >= RestCategory.VeryTired ||
                        (this.Followee.GetRoom() != null && !(this.Followee.GetRoom().Role == GU_RR_DefOf.Barn || this.Followee.GetRoom().Role == RoomRoleDefOf.None)))//Don't allow animals to follow pawns inside
                    {
                        Log.Message("ending job, room: " + this.Followee.GetRoom().Role.defName);
                        this.EndJobWith(JobCondition.Incompletable);
                    }

                    if (pawn.IsHashIntervalTick(moveInterval) && !this.pawn.pather.Moving)
                    {
                        WalkRandomNearby();
                        moveInterval = Rand.Range(300, 1200);
                    }
                    if (TimeUntilExpire(pawn.CurJob) < 10 && Followee.CurJobDef == initialJob)
                    {
                        pawn.CurJob.expiryInterval += 1000;
                    }
                },
                defaultCompleteMode = ToilCompleteMode.Never
            };

            toil.AddFinishAction(() =>
            {
                if (Base.Instance.GetExtendedDataStorage() is ExtendedDataStorage store)
                {
                    ExtendedPawnData animalData = store.GetExtendedDataFor(pawn);
                    ExtendedPawnData pawnData   = store.GetExtendedDataFor(Followee);
                    pawnData.owning             = null;
                    animalData.ownedBy          = null;
                }
            });
            yield return(toil);
        }
        private void DrawIcons(Rect rect, Pawn colonist)
        {
            if (colonist.Dead)
            {
                return;
            }
            float   num    = 20f * this.ColonistBar.Scale;
            Vector2 vector = new Vector2(rect.x + 1f, rect.yMax - num - 1f);
            bool    flag   = false;

            if (colonist.CurJob != null)
            {
                JobDef def = colonist.CurJob.def;
                if (def == JobDefOf.AttackMelee || def == JobDefOf.AttackStatic)
                {
                    flag = true;
                }
                else if (def == JobDefOf.WaitCombat)
                {
                    Stance_Busy stance_Busy = colonist.stances.curStance as Stance_Busy;
                    if (stance_Busy != null && stance_Busy.focusTarg.IsValid)
                    {
                        flag = true;
                    }
                }
            }
            if (colonist.InAggroMentalState)
            {
                this.DrawIcon(ColonistBarColonistDrawer.Icon_MentalStateAggro, ref vector, colonist.MentalStateDef.LabelCap);
            }
            else if (colonist.InMentalState)
            {
                this.DrawIcon(ColonistBarColonistDrawer.Icon_MentalStateNonAggro, ref vector, colonist.MentalStateDef.LabelCap);
            }
            else if (colonist.InBed() && colonist.CurrentBed().Medical)
            {
                this.DrawIcon(ColonistBarColonistDrawer.Icon_MedicalRest, ref vector, "ActivityIconMedicalRest".Translate());
            }
            else if (colonist.CurJob != null && colonist.jobs.curDriver.asleep)
            {
                this.DrawIcon(ColonistBarColonistDrawer.Icon_Sleeping, ref vector, "ActivityIconSleeping".Translate());
            }
            else if (colonist.CurJob != null && colonist.CurJob.def == JobDefOf.FleeAndCower)
            {
                this.DrawIcon(ColonistBarColonistDrawer.Icon_Fleeing, ref vector, "ActivityIconFleeing".Translate());
            }
            else if (flag)
            {
                this.DrawIcon(ColonistBarColonistDrawer.Icon_Attacking, ref vector, "ActivityIconAttacking".Translate());
            }
            else if (colonist.mindState.IsIdle && GenDate.DaysPassed >= 1)
            {
                this.DrawIcon(ColonistBarColonistDrawer.Icon_Idle, ref vector, "ActivityIconIdle".Translate());
            }
            if (colonist.IsBurning())
            {
                this.DrawIcon(ColonistBarColonistDrawer.Icon_Burning, ref vector, "ActivityIconBurning".Translate());
            }
        }
예제 #23
0
    public ResourceJobObj AddJob(JobDef newJobDef, BuildingObj bldg)
    {
        ResourceJobObj newJobObj = new ResourceJobObj(newJobDef, bldg);

        newJobObj.UpdateBonuses(jobBonusList);
        jobList.Add(newJobObj);
        return(newJobObj);
    }
예제 #24
0
    public DemoJobObj AddDemolitionJob(JobDef newJobDef, int iLoc, int jLoc)
    {
        DemoJobObj newJobObj = new DemoJobObj(newJobDef, iLoc, jLoc);

        newJobObj.UpdateBonuses(jobBonusList);
        jobList.Add(newJobObj);
        return(newJobObj);
    }
예제 #25
0
    public BuildingJobObj AddConstructionJob(JobDef newJobDef, int iLoc, int jLoc)
    {
        BuildingJobObj newJobObj = new BuildingJobObj(newJobDef, iLoc, jLoc);

        newJobObj.UpdateBonuses(jobBonusList);
        jobList.Add(newJobObj);
        return(newJobObj);
    }
예제 #26
0
 public bool CanStartNow(JobDef def = null, IncidentDef incident = null)
 {
     if (ModBound)
     {
         return(!Locked && requisites.IsFulfilled(def, incident) && ModLoaded);
     }
     return(!Locked && requisites.IsFulfilled(def, incident));
 }
예제 #27
0
 public bool IsFulfilled(JobDef job = null, IncidentDef incident = null, bool isIncident = false, Map map = null)
 {
     if (anyList)
     {
         return(ResearchDone || ObjectivesReady || MissionsReady || OwnsAllThings || IncidentReady(incident) || (isIncident ? JobsBeingDone(map) : JobReady(job)));
     }
     return(ResearchDone && ObjectivesReady && MissionsReady && OwnsAllThings && (IncidentReady(incident) || (isIncident ? JobsBeingDone(map) : JobReady(job))));
 }
예제 #28
0
 public Job(JobDef def, LocalTargetInfo targetA, int expiryInterval, bool checkOverrideOnExpiry = false)
 {
     this.def                   = def;
     this.targetA               = targetA;
     this.expiryInterval        = expiryInterval;
     this.checkOverrideOnExpire = checkOverrideOnExpiry;
     this.loadID                = Find.UniqueIDsManager.GetNextJobID();
 }
 public ActivityJobNode(JobDef headJob, JobDef memberJob)
 {
     if (Scribe.mode == LoadSaveMode.Inactive)
     {
         this.organizerJob    = headJob;
         this.congregationJob = memberJob;
     }
 }
 public Job DoTryGiveJob(Pawn pawn, Thing t, JoyGiverDef def, JobDef defj)
 {
     if (!WatchBuildingUtility.TryFindBestWatchCell(t, pawn, def.desireSit, out var result, out var chair))
     {
         return null;
     }
     return JobMaker.MakeJob(defj, t, result, chair);
 }