hediff能量
This commit is contained in:
Binary file not shown.
@@ -185,8 +185,10 @@
|
||||
<subNodes>
|
||||
<li Class="JobGiver_Autofeed" MayRequire="Ludeon.RimWorld.Biotech" />
|
||||
<li Class="WulaFallenEmpire.JobGiver_WulaGetEnergy">
|
||||
<leaveJoinableLordIfIssuesJob>true</leaveJoinableLordIfIssuesJob>
|
||||
<minEnergyLevelPercentage>0.3</minEnergyLevelPercentage>
|
||||
<maxEnergyLevelPercentage>0.9</maxEnergyLevelPercentage>
|
||||
<emergencyPriority>9.5</emergencyPriority>
|
||||
</li>
|
||||
<li Class="JobGiver_GetRest"/>
|
||||
<li Class="JobGiver_SatisfyChemicalNeed"/>
|
||||
@@ -275,8 +277,6 @@
|
||||
<subNodes>
|
||||
<li Class="WulaFallenEmpire.JobGiver_WulaGetEnergy">
|
||||
<leaveJoinableLordIfIssuesJob>true</leaveJoinableLordIfIssuesJob>
|
||||
<searchRadius>30</searchRadius> <!-- 搜索半径调整为30 -->
|
||||
<ingestCount>1</ingestCount> <!-- 每次摄取1个能量核心 -->
|
||||
<minEnergyLevelPercentage>0.3</minEnergyLevelPercentage>
|
||||
<maxEnergyLevelPercentage>0.9</maxEnergyLevelPercentage>
|
||||
<emergencyPriority>9.5</emergencyPriority>
|
||||
|
||||
Binary file not shown.
@@ -29,7 +29,8 @@ namespace WulaFallenEmpire
|
||||
protected override IEnumerable<Toil> 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))
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace WulaFallenEmpire
|
||||
|
||||
public override IEnumerable<Thing> PotentialWorkThingsGlobal(Pawn pawn)
|
||||
{
|
||||
return pawn.Map.mapPawns.AllPawns.Where(p => p.needs.TryGetNeed<Need_WulaEnergy>() != null && FeedPatientUtility.ShouldBeFed(p));
|
||||
return pawn.Map.mapPawns.AllPawns.Where(p => p.needs.TryGetNeed<Need_WulaEnergy>() != 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;
|
||||
}
|
||||
|
||||
@@ -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<ThingDefExtension_EnergySource>() != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool TryFindBestEnergySourceFor(Pawn getter, Pawn eater, out Thing energySource, out ThingDef energyDef)
|
||||
{
|
||||
energySource = null;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -81,7 +81,6 @@
|
||||
<Compile Include="VerbPropertiesExplosiveBeam.cs" />
|
||||
<Compile Include="HediffComp_WulaCharging.cs" />
|
||||
<Compile Include="JobGiver_WulaGetEnergy.cs" />
|
||||
<Compile Include="JobGiverDefExtension_WulaGetEnergy.cs" />
|
||||
<Compile Include="JobGiver_WulaPackEnergy.cs" />
|
||||
<Compile Include="JobGiverDefExtension_WulaPackEnergy.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user