diff --git a/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/Assemblies/WulaFallenEmpire.dll index 5fdb18bb..08ded61b 100644 Binary files a/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/1.6/Defs/ThinkTreeDefs/WULA_ThinkTrees.xml b/1.6/Defs/ThinkTreeDefs/WULA_ThinkTrees.xml index 248dfafd..381947bd 100644 --- a/1.6/Defs/ThinkTreeDefs/WULA_ThinkTrees.xml +++ b/1.6/Defs/ThinkTreeDefs/WULA_ThinkTrees.xml @@ -185,8 +185,10 @@
  • + true 0.3 0.9 + 9.5
  • @@ -275,8 +277,6 @@
  • true - 30 - 1 0.3 0.9 9.5 diff --git a/Source/WulaFallenEmpire/.vs/WulaFallenEmpire/v17/.suo b/Source/WulaFallenEmpire/.vs/WulaFallenEmpire/v17/.suo index 555d3d8c..f4e6a586 100644 Binary files a/Source/WulaFallenEmpire/.vs/WulaFallenEmpire/v17/.suo and b/Source/WulaFallenEmpire/.vs/WulaFallenEmpire/v17/.suo differ diff --git a/Source/WulaFallenEmpire/JobDriver_FeedWulaPatient.cs b/Source/WulaFallenEmpire/JobDriver_FeedWulaPatient.cs index 03143dfd..07e5d124 100644 --- a/Source/WulaFallenEmpire/JobDriver_FeedWulaPatient.cs +++ b/Source/WulaFallenEmpire/JobDriver_FeedWulaPatient.cs @@ -29,7 +29,8 @@ namespace WulaFallenEmpire protected override IEnumerable MakeNewToils() { this.FailOnDespawnedNullOrForbidden(PatientInd); - this.FailOn(() => !FeedPatientUtility.ShouldBeFed(Patient)); + // The job should fail if the patient is no longer in bed. + this.FailOn(() => !Patient.InBed()); if (pawn.inventory != null && pawn.inventory.Contains(Food)) { diff --git a/Source/WulaFallenEmpire/WorkGiver_FeedWulaPatient.cs b/Source/WulaFallenEmpire/WorkGiver_FeedWulaPatient.cs index bdadd0db..d7cf0668 100644 --- a/Source/WulaFallenEmpire/WorkGiver_FeedWulaPatient.cs +++ b/Source/WulaFallenEmpire/WorkGiver_FeedWulaPatient.cs @@ -16,7 +16,7 @@ namespace WulaFallenEmpire public override IEnumerable PotentialWorkThingsGlobal(Pawn pawn) { - return pawn.Map.mapPawns.AllPawns.Where(p => p.needs.TryGetNeed() != null && FeedPatientUtility.ShouldBeFed(p)); + return pawn.Map.mapPawns.AllPawns.Where(p => p.needs.TryGetNeed() != null && p.InBed()); } public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false) @@ -39,12 +39,8 @@ namespace WulaFallenEmpire return false; } - if (!FeedPatientUtility.ShouldBeFed(patient)) - { - return false; - } - - if (WardenFeedUtility.ShouldBeFed(patient)) + // A Wula patient should be fed if they are in bed. If the job is not forced, they must also be unable to move. + if (!patient.InBed() || (!forced && patient.health.capacities.CapableOf(PawnCapacityDefOf.Moving))) { return false; } diff --git a/Source/WulaFallenEmpire/WorkGiver_Warden_DeliverEnergy.cs b/Source/WulaFallenEmpire/WorkGiver_Warden_DeliverEnergy.cs index ceac6c22..b64dd690 100644 --- a/Source/WulaFallenEmpire/WorkGiver_Warden_DeliverEnergy.cs +++ b/Source/WulaFallenEmpire/WorkGiver_Warden_DeliverEnergy.cs @@ -19,6 +19,11 @@ namespace WulaFallenEmpire return null; } + if (EnergyAvailableInRoomTo(prisoner)) + { + return null; + } + if (!TryFindBestEnergySourceFor(pawn, prisoner, out Thing energySource, out _)) { return null; @@ -26,10 +31,27 @@ namespace WulaFallenEmpire Job job = JobMaker.MakeJob(JobDefOf.DeliverFood, energySource, prisoner); job.count = 1; - job.targetC = RCellFinder.SpotToChewStandingNear(prisoner, energySource); return job; } + private bool EnergyAvailableInRoomTo(Pawn prisoner) + { + if (prisoner.GetRoom() == null) + { + return false; + } + + var allThings = prisoner.GetRoom().ContainedAndAdjacentThings; + foreach (Thing thing in allThings) + { + if (thing.def.GetModExtension() != null) + { + return true; + } + } + return false; + } + private bool TryFindBestEnergySourceFor(Pawn getter, Pawn eater, out Thing energySource, out ThingDef energyDef) { energySource = null; diff --git a/Source/WulaFallenEmpire/WorkGiver_Warden_FeedWula.cs b/Source/WulaFallenEmpire/WorkGiver_Warden_FeedWula.cs index c5f0caad..dc069ff3 100644 --- a/Source/WulaFallenEmpire/WorkGiver_Warden_FeedWula.cs +++ b/Source/WulaFallenEmpire/WorkGiver_Warden_FeedWula.cs @@ -26,6 +26,12 @@ namespace WulaFallenEmpire return null; } + // The prisoner must be in bed to be fed by a warden. If the job is not forced, they must also be unable to move. + if (!prisoner.InBed() || (!forced && prisoner.health.capacities.CapableOf(PawnCapacityDefOf.Moving))) + { + return null; + } + if (!TryFindBestEnergySourceFor(pawn, prisoner, out Thing energySource, out _)) { return null; diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj index 7f3f35ce..21f71995 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj +++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj @@ -81,7 +81,6 @@ -