hediff能量
This commit is contained in:
Binary file not shown.
@@ -185,8 +185,10 @@
|
|||||||
<subNodes>
|
<subNodes>
|
||||||
<li Class="JobGiver_Autofeed" MayRequire="Ludeon.RimWorld.Biotech" />
|
<li Class="JobGiver_Autofeed" MayRequire="Ludeon.RimWorld.Biotech" />
|
||||||
<li Class="WulaFallenEmpire.JobGiver_WulaGetEnergy">
|
<li Class="WulaFallenEmpire.JobGiver_WulaGetEnergy">
|
||||||
|
<leaveJoinableLordIfIssuesJob>true</leaveJoinableLordIfIssuesJob>
|
||||||
<minEnergyLevelPercentage>0.3</minEnergyLevelPercentage>
|
<minEnergyLevelPercentage>0.3</minEnergyLevelPercentage>
|
||||||
<maxEnergyLevelPercentage>0.9</maxEnergyLevelPercentage>
|
<maxEnergyLevelPercentage>0.9</maxEnergyLevelPercentage>
|
||||||
|
<emergencyPriority>9.5</emergencyPriority>
|
||||||
</li>
|
</li>
|
||||||
<li Class="JobGiver_GetRest"/>
|
<li Class="JobGiver_GetRest"/>
|
||||||
<li Class="JobGiver_SatisfyChemicalNeed"/>
|
<li Class="JobGiver_SatisfyChemicalNeed"/>
|
||||||
@@ -275,8 +277,6 @@
|
|||||||
<subNodes>
|
<subNodes>
|
||||||
<li Class="WulaFallenEmpire.JobGiver_WulaGetEnergy">
|
<li Class="WulaFallenEmpire.JobGiver_WulaGetEnergy">
|
||||||
<leaveJoinableLordIfIssuesJob>true</leaveJoinableLordIfIssuesJob>
|
<leaveJoinableLordIfIssuesJob>true</leaveJoinableLordIfIssuesJob>
|
||||||
<searchRadius>30</searchRadius> <!-- 搜索半径调整为30 -->
|
|
||||||
<ingestCount>1</ingestCount> <!-- 每次摄取1个能量核心 -->
|
|
||||||
<minEnergyLevelPercentage>0.3</minEnergyLevelPercentage>
|
<minEnergyLevelPercentage>0.3</minEnergyLevelPercentage>
|
||||||
<maxEnergyLevelPercentage>0.9</maxEnergyLevelPercentage>
|
<maxEnergyLevelPercentage>0.9</maxEnergyLevelPercentage>
|
||||||
<emergencyPriority>9.5</emergencyPriority>
|
<emergencyPriority>9.5</emergencyPriority>
|
||||||
|
|||||||
Binary file not shown.
@@ -29,7 +29,8 @@ namespace WulaFallenEmpire
|
|||||||
protected override IEnumerable<Toil> MakeNewToils()
|
protected override IEnumerable<Toil> MakeNewToils()
|
||||||
{
|
{
|
||||||
this.FailOnDespawnedNullOrForbidden(PatientInd);
|
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))
|
if (pawn.inventory != null && pawn.inventory.Contains(Food))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace WulaFallenEmpire
|
|||||||
|
|
||||||
public override IEnumerable<Thing> PotentialWorkThingsGlobal(Pawn pawn)
|
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)
|
public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
|
||||||
@@ -39,12 +39,8 @@ namespace WulaFallenEmpire
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FeedPatientUtility.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (WardenFeedUtility.ShouldBeFed(patient))
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ namespace WulaFallenEmpire
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (EnergyAvailableInRoomTo(prisoner))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!TryFindBestEnergySourceFor(pawn, prisoner, out Thing energySource, out _))
|
if (!TryFindBestEnergySourceFor(pawn, prisoner, out Thing energySource, out _))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@@ -26,10 +31,27 @@ namespace WulaFallenEmpire
|
|||||||
|
|
||||||
Job job = JobMaker.MakeJob(JobDefOf.DeliverFood, energySource, prisoner);
|
Job job = JobMaker.MakeJob(JobDefOf.DeliverFood, energySource, prisoner);
|
||||||
job.count = 1;
|
job.count = 1;
|
||||||
job.targetC = RCellFinder.SpotToChewStandingNear(prisoner, energySource);
|
|
||||||
return job;
|
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)
|
private bool TryFindBestEnergySourceFor(Pawn getter, Pawn eater, out Thing energySource, out ThingDef energyDef)
|
||||||
{
|
{
|
||||||
energySource = null;
|
energySource = null;
|
||||||
|
|||||||
@@ -26,6 +26,12 @@ namespace WulaFallenEmpire
|
|||||||
return null;
|
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 _))
|
if (!TryFindBestEnergySourceFor(pawn, prisoner, out Thing energySource, out _))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -81,7 +81,6 @@
|
|||||||
<Compile Include="VerbPropertiesExplosiveBeam.cs" />
|
<Compile Include="VerbPropertiesExplosiveBeam.cs" />
|
||||||
<Compile Include="HediffComp_WulaCharging.cs" />
|
<Compile Include="HediffComp_WulaCharging.cs" />
|
||||||
<Compile Include="JobGiver_WulaGetEnergy.cs" />
|
<Compile Include="JobGiver_WulaGetEnergy.cs" />
|
||||||
<Compile Include="JobGiverDefExtension_WulaGetEnergy.cs" />
|
|
||||||
<Compile Include="JobGiver_WulaPackEnergy.cs" />
|
<Compile Include="JobGiver_WulaPackEnergy.cs" />
|
||||||
<Compile Include="JobGiverDefExtension_WulaPackEnergy.cs" />
|
<Compile Include="JobGiverDefExtension_WulaPackEnergy.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user