public override ThinkNode DeepCopy(bool resolve = true) { JobGiver_HealColonists jobGiver_HealColonists = (JobGiver_HealColonists)base.DeepCopy(resolve); jobGiver_HealColonists.jobMaxDuration = this.jobMaxDuration; return(jobGiver_HealColonists); }
public void SendMedicIfNeeded() { if (Find.TickManager.TicksGame >= this.nextTendableColonistCheckTick) { this.nextTendableColonistCheckTick = Find.TickManager.TicksGame + tendableColonistCheckPeriodInTicks; // Check if spaceship is about to take off. if (IsTakeOffImminent(2 * Util_Spaceship.medicsRecallBeforeTakeOffMarginInTicks)) { return; } // Get a healthy medic. Pawn medic = null; foreach (Pawn pawn in this.medics.InRandomOrder()) { if (this.pawnsAboard.Contains(pawn) && (pawn.health.HasHediffsNeedingTend() == false)) { medic = pawn; break; } } if (medic == null) { return; } // Look for tendable colonist. Pawn patient = JobGiver_HealColonists.GetTendableColonist(this.Position, this.Map); if (patient == null) { return; } // Spawn needed medikits if available. if (this.availableMedikitsCount > 0) { int neededMedikitsCount = Medicine.GetMedicineCountToFullyHeal(patient); int medikitsToSpawnCount = Math.Min(this.availableMedikitsCount, neededMedikitsCount); if (medikitsToSpawnCount > 0) { SpawnItem(ThingDefOf.MedicineIndustrial, null, medikitsToSpawnCount, this.Position, this.Map, 0f); this.availableMedikitsCount -= medikitsToSpawnCount; } } // Spawn medic. GenSpawn.Spawn(medic, this.Position, this.Map); this.pawnsAboard.Remove(medic); Lord lord = LordMaker.MakeNewLord(Util_Faction.MiningCoFaction, new LordJob_HealColonists(this.Position), this.Map); lord.AddPawn(medic); } }