暂存
This commit is contained in:
Binary file not shown.
@@ -14,6 +14,14 @@
|
||||
<Wildness>0.3</Wildness>
|
||||
</statBases>
|
||||
<uiIconScale>1.1</uiIconScale>
|
||||
<comps>
|
||||
<li Class="ArachnaeSwarm.CompProperties_InstantTrain">
|
||||
<trainables>
|
||||
<li>ARA_Sowing</li>
|
||||
<li>ARA_PlantCutting</li>
|
||||
</trainables>
|
||||
</li>
|
||||
</comps>
|
||||
<tools>
|
||||
<li>
|
||||
<label>head claw</label>
|
||||
@@ -38,6 +46,7 @@
|
||||
</tools>
|
||||
<race>
|
||||
<body>BeetleLikeWithClaw</body>
|
||||
<thinkTreeMain>ARA_Insect_WithPlanting</thinkTreeMain>
|
||||
<baseHungerRate>0.25</baseHungerRate>
|
||||
<baseBodySize>0.8</baseBodySize>
|
||||
<baseHealthScale>1.7</baseHealthScale>
|
||||
@@ -46,6 +55,8 @@
|
||||
<trainability>Advanced</trainability>
|
||||
<specialTrainables>
|
||||
<li MayRequire="Ludeon.RimWorld.Odyssey">Dig</li>
|
||||
<li>ARA_Sowing</li>
|
||||
<li>ARA_PlantCutting</li>
|
||||
</specialTrainables>
|
||||
<lifeStageAges>
|
||||
<li>
|
||||
|
||||
@@ -1,7 +1,466 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Defs>
|
||||
|
||||
<ThinkTreeDef>
|
||||
<defName>ARA_Humanlike</defName> <!-- 更改defName以避免与原版Humanlike冲突 -->
|
||||
<defName>ARA_Insect_WithPlanting</defName>
|
||||
<thinkRoot Class="ThinkNode_Priority">
|
||||
<subNodes>
|
||||
<!-- Start of Copied Insect ThinkTree -->
|
||||
<li Class="ThinkNode_ConditionalMustKeepLyingDown">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_QueuedJob">
|
||||
<inBedOnly>true</inBedOnly>
|
||||
</li>
|
||||
|
||||
<!-- Keep lying down -->
|
||||
<li Class="JobGiver_KeepLyingDown"/>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<li Class="ThinkNode_Subtree">
|
||||
<treeDef>Downed</treeDef>
|
||||
</li>
|
||||
<li Class="ThinkNode_Subtree">
|
||||
<treeDef>BurningResponse</treeDef>
|
||||
</li>
|
||||
<li Class="ThinkNode_Subtree">
|
||||
<treeDef>MentalStateCritical</treeDef>
|
||||
</li>
|
||||
|
||||
<!-- React to close melee threat -->
|
||||
<li Class="JobGiver_ReactToCloseMeleeThreat"/>
|
||||
|
||||
<!-- Do a queued job -->
|
||||
<li Class="ThinkNode_QueuedJob"/>
|
||||
|
||||
<!-- Wild insects dig out if no path to map edge and starving -->
|
||||
<li Class="ThinkNode_ConditionalHasFaction">
|
||||
<invert>true</invert>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_ConditionalStarving">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_ConditionalBodySize">
|
||||
<min>0.7</min>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Subtree">
|
||||
<treeDef>DigOutIfCannotReachMapEdge</treeDef>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Leave if timed out -->
|
||||
<li Class="ThinkNode_ConditionalExitTimedOut">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Misc</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_ExitMapRandom">
|
||||
<defaultLocomotion>Walk</defaultLocomotion>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Mental state non critical -->
|
||||
<li Class="ThinkNode_Subtree">
|
||||
<treeDef>MentalStateNonCritical</treeDef>
|
||||
</li>
|
||||
|
||||
<!-- Forced goto -->
|
||||
<li Class="ThinkNode_ConditionalForcedGoto">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Misc</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_ForcedGoto"/>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Behavior when roped -->
|
||||
<li Class="ThinkNode_Subtree">
|
||||
<treeDef>RopedPawn</treeDef>
|
||||
</li>
|
||||
|
||||
<!-- Lord directives -->
|
||||
<li Class="ThinkNode_Subtree">
|
||||
<treeDef>LordDuty</treeDef>
|
||||
</li>
|
||||
|
||||
<!-- Insertion hook for modders -->
|
||||
<li Class="ThinkNode_SubtreesByTag">
|
||||
<insertTag>Animal_PreMain</insertTag>
|
||||
</li>
|
||||
<li Class="ThinkNode_SubtreesByTag">
|
||||
<insertTag>Insect_PreMain</insertTag>
|
||||
</li>
|
||||
|
||||
<!-- OUR CUSTOM LOGIC INJECTION: PLANTING -->
|
||||
<li Class="ArachnaeSwarm.ThinkNode_ConditionalAnimalShouldSow">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>TrainedAnimalBehavior</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="RimWorld.JobGiver_Work">
|
||||
<workType>Growing</workType>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- OUR CUSTOM LOGIC INJECTION: PLANT CUTTING -->
|
||||
<li Class="ArachnaeSwarm.ThinkNode_ConditionalAnimalShouldPlantCut">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>TrainedAnimalBehavior</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="RimWorld.JobGiver_Work">
|
||||
<workType>PlantCutting</workType>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<li Class="ThinkNode_ConditionalHasFaction">
|
||||
<invert>true</invert>
|
||||
<subNodes>
|
||||
<!-- Wild insects with no lord will fight nearby enemies -->
|
||||
<li Class="JobGiver_AIFightEnemies">
|
||||
<targetAcquireRadius>30</targetAcquireRadius> <!-- Same as DefendAndExpandHive -->
|
||||
<targetKeepRadius>35</targetKeepRadius>
|
||||
</li>
|
||||
|
||||
<!-- Wild insects leave map in some conditions -->
|
||||
<li Class="ThinkNode_Subtree">
|
||||
<treeDef>LeaveIfWrongSeason</treeDef>
|
||||
</li>
|
||||
<li Class="ThinkNode_Subtree">
|
||||
<treeDef>LeaveIfStarving</treeDef>
|
||||
</li>
|
||||
|
||||
<!-- Wild insects randomly leave map -->
|
||||
<li Class="ThinkNode_ChancePerHour_Constant">
|
||||
<mtbDays>60</mtbDays>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Misc</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_ExitMapRandom">
|
||||
<defaultLocomotion>Walk</defaultLocomotion>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Insects of a faction that's not the players without a lord leave randomly -->
|
||||
<li Class="ThinkNode_ConditionalOfPlayerFaction">
|
||||
<invert>true</invert>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_ConditionalHasFaction">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_ConditionalNoLord">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_ChancePerHour_Constant">
|
||||
<mtbDays>60</mtbDays>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Misc</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_ExitMapRandom">
|
||||
<defaultLocomotion>Walk</defaultLocomotion>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Tame insects -->
|
||||
<li Class="ThinkNode_ConditionalOfPlayerFaction">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>TrainedAnimalBehavior</tagToGive>
|
||||
<subNodes>
|
||||
<!-- Trained behavior: obedience: Follow and defend master -->
|
||||
<li Class="ThinkNode_ConditionalTrainableCompleted">
|
||||
<trainable>Obedience</trainable>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_ConditionalShouldFollowMaster">
|
||||
<subNodes>
|
||||
<li Class="JobGiver_AIDefendMaster">
|
||||
<attackMeleeThreatEvenIfNotHostile>true</attackMeleeThreatEvenIfNotHostile>
|
||||
</li>
|
||||
<li Class="JobGiver_AIFollowMaster"/>
|
||||
<li Class="JobGiver_WanderNearMaster"/>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Trained behavior: Rescue-->
|
||||
<li Class="ThinkNode_ConditionalTrainableCompleted">
|
||||
<trainable>Rescue</trainable>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_RescueNearby">
|
||||
<radius>75</radius>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Take care of critical needs (below rescue - so heroic!)-->
|
||||
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>RestingForMedicalReasons</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_PatientGoToBed"/> <!-- This was the problematic line -->
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<li Class="JobGiver_SeekAllowedArea"/>
|
||||
<li Class="JobGiver_SeekSafeTemperature"/>
|
||||
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Eat random things out of curiosity -->
|
||||
<li Class="ThinkNode_ChancePerHour_Constant">
|
||||
<mtbDays>60</mtbDays>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>SatisfyingNeeds</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_EatRandom"/>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Satisfy basic needs -->
|
||||
<li Class="ThinkNode_Subtree">
|
||||
<treeDef>SatisfyBasicNeeds</treeDef>
|
||||
</li>
|
||||
|
||||
<li Class="ThinkNode_ConditionalHasFaction">
|
||||
<subNodes>
|
||||
<!-- Try to mate -->
|
||||
<li Class="ThinkNode_ChancePerHour_Mate">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>SatisfyingNeeds</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_Mate"/>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Nuzzle randoms -->
|
||||
<li Class="ThinkNode_ChancePerHour_Nuzzle">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Misc</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_Nuzzle"/>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Roamers gonna roam -->
|
||||
<li Class="ThinkNode_ChancePerDay_Roam">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Misc</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_StartRoaming"/>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Trained behavior: Haul-->
|
||||
<li Class="ThinkNode_ChancePerHour_Constant">
|
||||
<mtbHours>1.5</mtbHours>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_ConditionalRequireCapacities">
|
||||
<requiredCapacities>
|
||||
<li>Manipulation</li>
|
||||
</requiredCapacities>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_ConditionalTrainableCompleted">
|
||||
<trainable>Haul</trainable>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>TrainedAnimalBehavior</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_Haul"/>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Trained behavior: Forage -->
|
||||
<li Class="ThinkNode_ConditionalTrainableCompleted" MayRequire="Ludeon.RimWorld.Odyssey">
|
||||
<trainable>Forage</trainable>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_ChancePerHour_Forage">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_ConditionalAnimalShouldForage">
|
||||
<subNodes>
|
||||
<li Class="JobGiver_Forage" />
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Trained behavior: Mine -->
|
||||
<li Class="ThinkNode_ConditionalTrainableCompleted" MayRequire="Ludeon.RimWorld.Odyssey">
|
||||
<trainable>Dig</trainable>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_ConditionalAnimalShouldDig">
|
||||
<subNodes>
|
||||
<li Class="JobGiver_Mine" />
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Insertion hook for modders -->
|
||||
<li Class="ThinkNode_SubtreesByTag">
|
||||
<insertTag>Animal_PreWander</insertTag>
|
||||
</li>
|
||||
<li Class="ThinkNode_SubtreesByTag">
|
||||
<insertTag>Insect_PreWander</insertTag>
|
||||
</li>
|
||||
|
||||
<!-- Tame insect: wander near colony if possible -->
|
||||
<li Class="ThinkNode_ConditionalOfPlayerFaction">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Idle</tagToGive>
|
||||
<subNodes>
|
||||
<!-- Wander near your current position if in hostile map -->
|
||||
<li Class="ThinkNode_ConditionalAnyEnemyInHostileMap">
|
||||
<subNodes>
|
||||
<li Class="JobGiver_WanderAnywhere">
|
||||
<maxDanger>None</maxDanger>
|
||||
<ticksBetweenWandersRange>120~240</ticksBetweenWandersRange>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<li Class="ThinkNode_ConditionalRoamer">
|
||||
<subNodes>
|
||||
<li Class="JobGiver_WanderInRoofedCellsInPen">
|
||||
<maxDanger>None</maxDanger>
|
||||
<ticksBetweenWandersRange>120~240</ticksBetweenWandersRange>
|
||||
<expiryInterval>500</expiryInterval>
|
||||
</li>
|
||||
|
||||
<!-- tame roamers should not wander too far, and if unenclosed wander near a suitable pen marker 10% of the time -->
|
||||
<li Class="ThinkNode_ConditionalRandom">
|
||||
<chance>0.1</chance>
|
||||
<subNodes>
|
||||
<li class="JobGiver_WanderInPen">
|
||||
<maxDanger>None</maxDanger>
|
||||
<ticksBetweenWandersRange>120~240</ticksBetweenWandersRange>
|
||||
<expiryInterval>500</expiryInterval>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<li Class="JobGiver_WanderAnywhere">
|
||||
<maxDanger>None</maxDanger>
|
||||
<ticksBetweenWandersRange>120~240</ticksBetweenWandersRange>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Wander near colony -->
|
||||
<li Class="JobGiver_WanderColony">
|
||||
<maxDanger>None</maxDanger>
|
||||
<ticksBetweenWandersRange>120~240</ticksBetweenWandersRange>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Of neutral faction: rest and then exit the map -->
|
||||
<li Class="ThinkNode_ConditionalNonPlayerNonHostileFaction">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>RestingForMedicalReasons</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_PatientGoToBed"/>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Misc</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_ExitMapBest">
|
||||
<defaultLocomotion>Walk</defaultLocomotion>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Wander -->
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Idle</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_ConditionalHerdAnimal">
|
||||
<subNodes>
|
||||
<li Class="JobGiver_WanderHerd">
|
||||
<maxDanger>Deadly</maxDanger>
|
||||
<ticksBetweenWandersRange>120~240</ticksBetweenWandersRange>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<li Class="JobGiver_WanderAnywhere">
|
||||
<maxDanger>Deadly</maxDanger>
|
||||
<ticksBetweenWandersRange>120~240</ticksBetweenWandersRange>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<li Class="JobGiver_IdleError"/>
|
||||
</subNodes>
|
||||
</thinkRoot>
|
||||
</ThinkTreeDef>
|
||||
|
||||
<ThinkTreeDef>
|
||||
<defName>ARA_Humanlike</defName> <!-- 更改defName以避免与原版Humanlike冲突 -->
|
||||
<thinkRoot Class="ThinkNode_Priority">
|
||||
<subNodes>
|
||||
|
||||
@@ -20,7 +479,7 @@
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
|
||||
<!-- If we HAVE to keep lying down... -->
|
||||
<li Class="ThinkNode_ConditionalMustKeepLyingDown">
|
||||
<subNodes>
|
||||
@@ -45,12 +504,12 @@
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
|
||||
<!-- Keep lying down -->
|
||||
<li Class="JobGiver_KeepLyingDown" />
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
|
||||
<li Class="ThinkNode_Subtree">
|
||||
<treeDef>Downed</treeDef>
|
||||
</li>
|
||||
@@ -65,7 +524,7 @@
|
||||
<li Class="ThinkNode_Subtree" MayRequire="Ludeon.RimWorld.Biotech">
|
||||
<treeDef>Abilities_Escape</treeDef>
|
||||
</li>
|
||||
|
||||
|
||||
<!-- React to close melee threat -->
|
||||
<li Class="JobGiver_ReactToCloseMeleeThreat" />
|
||||
|
||||
@@ -83,7 +542,7 @@
|
||||
<li Class="ThinkNode_SubtreesByTag">
|
||||
<insertTag>Humanlike_PostMentalState</insertTag>
|
||||
</li>
|
||||
|
||||
|
||||
<!-- Do a queued job -->
|
||||
<li Class="ThinkNode_QueuedJob" />
|
||||
|
||||
@@ -109,393 +568,4 @@
|
||||
|
||||
<!-- Lord directives (high priority) -->
|
||||
<li Class="ThinkNode_JoinVoluntarilyJoinableLord">
|
||||
<dutyHook>HighPriority</dutyHook>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Subtree">
|
||||
<treeDef>LordDuty</treeDef>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Insertion hook for modders -->
|
||||
<li Class="ThinkNode_SubtreesByTag">
|
||||
<insertTag>Humanlike_PostDuty</insertTag>
|
||||
</li>
|
||||
|
||||
<!-- JobGiver_MaintainBuildings start -->
|
||||
<li Class="ThinkNode_ChancePerHour_Constant">
|
||||
<mtbHours>2.5</mtbHours>
|
||||
<subNodes>
|
||||
<li Class="ArachnaeSwarm.JobGiver_MaintainBuildings">
|
||||
<maintainableThingDefs>
|
||||
<li>ARA_InteractiveEggSac</li> <!-- 默认维护Hive -->
|
||||
</maintainableThingDefs>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.JobGiver_MaintainBuildings">
|
||||
<maintainableThingDefs>
|
||||
<li>ARA_InteractiveEggSac</li> <!-- 默认维护Hive -->
|
||||
</maintainableThingDefs>
|
||||
<onlyIfDamagingState>true</onlyIfDamagingState>
|
||||
</li>
|
||||
<!-- JobGiver_MaintainBuildings end -->
|
||||
|
||||
<!-- Prisoner -->
|
||||
<li Class="ThinkNode_ConditionalPrisoner">
|
||||
<leaveJoinableLordIfIssuesJob>true</leaveJoinableLordIfIssuesJob>
|
||||
<subNodes>
|
||||
<!-- If it's the player home map... -->
|
||||
<li Class="ThinkNode_ConditionalInNonPlayerHomeMap">
|
||||
<invert>true</invert>
|
||||
<subNodes>
|
||||
<!-- Wait instead of escaping if should -->
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Idle</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_PrisonerWaitInsteadOfEscaping">
|
||||
<maxDanger>Deadly</maxDanger>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Escape -->
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Escaping</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_PrisonerEscape" />
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Exit map if released -->
|
||||
<li Class="ThinkNode_ConditionalReleased">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Misc</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_ExitMapBest">
|
||||
<defaultLocomotion>Walk</defaultLocomotion>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>RestingForMedicalReasons</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_PatientGoToBed" />
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>ChangingApparel</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_PrisonerGetDressed" />
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>SatisfyingNeeds</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_PrioritySorter">
|
||||
<subNodes>
|
||||
<li Class="JobGiver_Autofeed" MayRequire="Ludeon.RimWorld.Biotech" />
|
||||
<li Class="JobGiver_GetFood"/>
|
||||
<li Class="JobGiver_GetRest"/>
|
||||
<li Class="JobGiver_SatisfyChemicalNeed"/>
|
||||
<li Class="JobGiver_SatifyChemicalDependency" MayRequire="Ludeon.RimWorld.Biotech" />
|
||||
<li Class="JobGiver_GetHemogen" MayRequire="Ludeon.RimWorld.Biotech" />
|
||||
<li Class="JobGiver_GetDeathrest" MayRequire="Ludeon.RimWorld.Biotech" />
|
||||
<li Class="ThinkNode_Priority_GetJoy">
|
||||
<subNodes>
|
||||
<li Class="JobGiver_GetJoy"/>
|
||||
<li Class="JobGiver_GetJoyInBed"/>
|
||||
</subNodes>
|
||||
</li>
|
||||
<li Class="JobGiver_Meditate"/>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- If in non-PlayerHomeMap -->
|
||||
<li Class="ThinkNode_ConditionalInNonPlayerHomeMap">
|
||||
<subNodes>
|
||||
<!-- No colonist spawned in the map -->
|
||||
<li Class="ThinkNode_ConditionalAnyUndownedColonistSpawnedNearby">
|
||||
<invert>true</invert>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Escaping</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_PrisonerEscape" />
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
<!-- Wander -->
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Idle</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_WanderColony">
|
||||
<maxDanger>Deadly</maxDanger>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Idle</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_WanderCurrentRoom">
|
||||
<maxDanger>Deadly</maxDanger>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<li Class="JobGiver_IdleError" />
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- If on colonist team, do forced and emergency work -->
|
||||
<li Class="ThinkNode_ConditionalColonist">
|
||||
<subNodes>
|
||||
<!-- Seek allowed area -->
|
||||
<li Class="JobGiver_SeekAllowedArea" />
|
||||
|
||||
<!-- Seek safe temperatures -->
|
||||
<li Class="JobGiver_BringBabyToSafety" />
|
||||
<li Class="JobGiver_SeekSafeTemperature" />
|
||||
|
||||
<!-- Drop unnused inventory -->
|
||||
<li Class="JobGiver_DropUnusedInventory" />
|
||||
|
||||
<!-- Emergency work -->
|
||||
<li Class="JobGiver_Work">
|
||||
<leaveJoinableLordIfIssuesJob>true</leaveJoinableLordIfIssuesJob>
|
||||
<emergency>true</emergency>
|
||||
</li>
|
||||
|
||||
<!-- Get food (only if starving) -->
|
||||
<li Class="ThinkNode_ConditionalStarving">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>SatisfyingNeeds</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_GetFood">
|
||||
<leaveJoinableLordIfIssuesJob>true</leaveJoinableLordIfIssuesJob>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Breastfeed -->
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Misc</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_Autofeed" MayRequire="Ludeon.RimWorld.Biotech" />
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Lord directives (medium priority) -->
|
||||
<li Class="ThinkNode_JoinVoluntarilyJoinableLord">
|
||||
<dutyHook>MediumPriority</dutyHook>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Subtree">
|
||||
<treeDef>LordDuty</treeDef>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Pick up a weapon dropped while previously downed -->
|
||||
<li Class="JobGiver_PickupDroppedWeapon">
|
||||
<ignoreForbidden>true</ignoreForbidden>
|
||||
</li>
|
||||
|
||||
<!-- Optimize apparel -->
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>ChangingApparel</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_OptimizeApparel">
|
||||
<leaveJoinableLordIfIssuesJob>true</leaveJoinableLordIfIssuesJob>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Look change -->
|
||||
<li MayRequire="Ludeon.RimWorld.Ideology" Class="ThinkNode_ConditionalWantsLookChange">
|
||||
<subNodes>
|
||||
<li Class="JobGiver_UseStylingStationAutomatic" />
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Dye hair -->
|
||||
<li MayRequire="Ludeon.RimWorld.Ideology" Class="JobGiver_DyeHair" />
|
||||
|
||||
<!-- Take for inventory stock -->
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>TakeForInventoryStock</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_TakeForInventoryStock">
|
||||
<leaveJoinableLordIfIssuesJob>true</leaveJoinableLordIfIssuesJob>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Unload your inventory -->
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>UnloadingOwnInventory</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_UnloadYourInventory" />
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Pack food if not hungry-->
|
||||
<li Class="ThinkNode_ConditionalNeedPercentageAbove">
|
||||
<need>Food</need>
|
||||
<threshold>0.6</threshold>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_PackFood">
|
||||
<leaveJoinableLordIfIssuesJob>true</leaveJoinableLordIfIssuesJob>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Behavior from traits -->
|
||||
<li Class="ThinkNode_TraitBehaviors" />
|
||||
|
||||
<!-- Insertion hook for modders -->
|
||||
<li Class="ThinkNode_SubtreesByTag">
|
||||
<insertTag>Humanlike_PreMain</insertTag>
|
||||
</li>
|
||||
|
||||
<!-- Main colonist behavior core -->
|
||||
<li Class="ThinkNode_ConditionalColonist">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Subtree">
|
||||
<treeDef>MainColonistBehaviorCore</treeDef>
|
||||
<leaveJoinableLordIfIssuesJob>true</leaveJoinableLordIfIssuesJob>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
<!-- Main wild man behavior core -->
|
||||
<li Class="ThinkNode_ConditionalPawnKind">
|
||||
<pawnKind>WildMan</pawnKind>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Subtree">
|
||||
<treeDef>MainWildManBehaviorCore</treeDef>
|
||||
<leaveJoinableLordIfIssuesJob>true</leaveJoinableLordIfIssuesJob>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Insertion hook for modders -->
|
||||
<li Class="ThinkNode_SubtreesByTag">
|
||||
<insertTag>Humanlike_PostMain</insertTag>
|
||||
</li>
|
||||
|
||||
<!-- Idle colonist -->
|
||||
<li Class="ThinkNode_ConditionalColonist">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Idle</tagToGive>
|
||||
<subNodes>
|
||||
<!-- Do random joy activity -->
|
||||
<li Class="ThinkNode_ConditionalNeedPercentageAbove">
|
||||
<need>Joy</need>
|
||||
<threshold>0.9</threshold>
|
||||
<invert>true</invert>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_IdleJoy" />
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Wander -->
|
||||
<li Class="JobGiver_WanderColony">
|
||||
<maxDanger>None</maxDanger>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Idle wild man -->
|
||||
<li Class="ThinkNode_ConditionalPawnKind">
|
||||
<pawnKind>WildMan</pawnKind>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Idle</tagToGive>
|
||||
<subNodes>
|
||||
<!-- Wander -->
|
||||
<li Class="JobGiver_WanderAnywhere">
|
||||
<maxDanger>Deadly</maxDanger>
|
||||
<ticksBetweenWandersRange>120~240</ticksBetweenWandersRange>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- If you're a neutral guest, if you're not hurt exit the map, otherwise use a medical bed -->
|
||||
<li Class="ThinkNode_ConditionalGuest">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_ConditionalNonPlayerNonHostileFactionOrFactionless">
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>RestingForMedicalReasons</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_PatientGoToBed" />
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Misc</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_ExitMapBest">
|
||||
<defaultLocomotion>Walk</defaultLocomotion>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- Final backup: If you're just here for no apparent reason, and not a colonist, leave the map
|
||||
e.g. This happens for pawns who are downed during combat, then later self-heal -->
|
||||
<li Class="ThinkNode_ConditionalColonist">
|
||||
<invert>true</invert>
|
||||
<subNodes>
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Misc</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_ExitMapBest">
|
||||
<defaultLocomotion>Walk</defaultLocomotion>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<!-- If you can't leave, just wander -->
|
||||
<li Class="ThinkNode_Tagger">
|
||||
<tagToGive>Idle</tagToGive>
|
||||
<subNodes>
|
||||
<li Class="JobGiver_WanderAnywhere">
|
||||
<maxDanger>Deadly</maxDanger>
|
||||
</li>
|
||||
</subNodes>
|
||||
</li>
|
||||
|
||||
<li Class="JobGiver_IdleError" />
|
||||
</subNodes>
|
||||
</thinkRoot>
|
||||
</ThinkTreeDef>
|
||||
</Defs>
|
||||
<dutyHook>HighPriority</dutyHook>
|
||||
19
1.6/1.6/Defs/TrainableDefs/ARA_PlantCutting.xml
Normal file
19
1.6/1.6/Defs/TrainableDefs/ARA_PlantCutting.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Defs>
|
||||
|
||||
<TrainableDef>
|
||||
<defName>ARA_PlantCutting</defName>
|
||||
<label>植物割除</label>
|
||||
<description>允许该生物执行植物割除任务。</description>
|
||||
|
||||
<specialTrainable>true</specialTrainable>
|
||||
|
||||
<difficulty>3</difficulty>
|
||||
<requiredTrainability>Advanced</requiredTrainability>
|
||||
|
||||
<steps>1</steps>
|
||||
|
||||
<listPriority>99</listPriority>
|
||||
</TrainableDef>
|
||||
|
||||
</Defs>
|
||||
23
1.6/1.6/Defs/TrainableDefs/ARA_Sowing.xml
Normal file
23
1.6/1.6/Defs/TrainableDefs/ARA_Sowing.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Defs>
|
||||
|
||||
<TrainableDef>
|
||||
<defName>ARA_Sowing</defName>
|
||||
<label>播种</label>
|
||||
<description>允许该生物执行播种任务。</description>
|
||||
|
||||
<!-- 标记为特殊训练,这样它就会被 PawnColumnWorker_Trainable_Special 统一管理 -->
|
||||
<specialTrainable>true</specialTrainable>
|
||||
|
||||
<!-- 训练难度和所需智力 -->
|
||||
<difficulty>5</difficulty>
|
||||
<requiredTrainability>Advanced</requiredTrainability>
|
||||
|
||||
<!-- 训练所需步骤 -->
|
||||
<steps>1</steps>
|
||||
|
||||
<!-- 在UI中的排序 -->
|
||||
<listPriority>100</listPriority>
|
||||
</TrainableDef>
|
||||
|
||||
</Defs>
|
||||
@@ -89,6 +89,14 @@
|
||||
<Compile Include="CompProperties_DelayedTerrainSpawn.cs" />
|
||||
<Compile Include="CompDelayedTerrainSpawn.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CompInstantTrain.cs" />
|
||||
<Compile Include="MainHarmony.cs" />
|
||||
<Compile Include="Patch_TrainingTracker_TickRare.cs" />
|
||||
<Compile Include="CompNoTrainingDecay.cs" />
|
||||
<Compile Include="ThinkNode_ConditionalAnimalShouldSow.cs" />
|
||||
<Compile Include="ThinkNode_ConditionalAnimalShouldPlantCut.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="WULA_AutoMechCarrier\CompAutoMechCarrier.cs" />
|
||||
<Compile Include="WULA_AutoMechCarrier\CompProperties_AutoMechCarrier.cs" />
|
||||
|
||||
51
Source/ArachnaeSwarm/CompInstantTrain.cs
Normal file
51
Source/ArachnaeSwarm/CompInstantTrain.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
using RimWorld;
|
||||
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
// 定义在 XML 中使用的属性
|
||||
public class CompProperties_InstantTrain : CompProperties
|
||||
{
|
||||
public List<TrainableDef> trainables = new List<TrainableDef>();
|
||||
|
||||
public CompProperties_InstantTrain()
|
||||
{
|
||||
this.compClass = typeof(CompInstantTrain);
|
||||
}
|
||||
}
|
||||
|
||||
// 实现组件的逻辑
|
||||
public class CompInstantTrain : ThingComp
|
||||
{
|
||||
// 方便地访问属性
|
||||
public CompProperties_InstantTrain Props => (CompProperties_InstantTrain)this.props;
|
||||
|
||||
// 在 Pawn 生成到地图上后被调用
|
||||
public override void PostSpawnSetup(bool respawningAfterLoad)
|
||||
{
|
||||
base.PostSpawnSetup(respawningAfterLoad);
|
||||
|
||||
// 如果不是在加载存档时重生,则执行训练逻辑
|
||||
if (!respawningAfterLoad)
|
||||
{
|
||||
Pawn pawn = this.parent as Pawn;
|
||||
if (pawn == null || pawn.training == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 遍历在 XML 中定义的需要训练的技能列表
|
||||
foreach (TrainableDef trainableDef in Props.trainables)
|
||||
{
|
||||
// 检查 Pawn 是否还未学会此技能
|
||||
if (!pawn.training.HasLearned(trainableDef))
|
||||
{
|
||||
// 调用原版方法,瞬间完成训练
|
||||
pawn.training.Train(trainableDef, null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Source/ArachnaeSwarm/CompNoTrainingDecay.cs
Normal file
15
Source/ArachnaeSwarm/CompNoTrainingDecay.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Verse;
|
||||
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
// 这是一个“标记”组件。它的唯一目的就是在 XML 中被添加到 ThingDef,
|
||||
// 以便我们的 Harmony 补丁可以识别哪些 Pawn 的训练不应该衰减。
|
||||
// 它本身不需要任何逻辑。
|
||||
public class CompProperties_NoTrainingDecay : CompProperties
|
||||
{
|
||||
public CompProperties_NoTrainingDecay()
|
||||
{
|
||||
this.compClass = typeof(ThingComp); // 我们可以使用一个通用的、空的 ThingComp
|
||||
}
|
||||
}
|
||||
}
|
||||
21
Source/ArachnaeSwarm/MainHarmony.cs
Normal file
21
Source/ArachnaeSwarm/MainHarmony.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Verse;
|
||||
using HarmonyLib;
|
||||
using System.Reflection;
|
||||
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
// [StaticConstructorOnStartup] 属性确保这个类的静态构造函数在游戏启动时被调用
|
||||
[StaticConstructorOnStartup]
|
||||
public static class MainHarmony
|
||||
{
|
||||
static MainHarmony()
|
||||
{
|
||||
// 创建一个 Harmony 实例。ID 应该是唯一的,通常使用 "作者.Mod名称" 的格式。
|
||||
var harmony = new Harmony("com.kalospacer.arachnaeswarm");
|
||||
|
||||
// Harmony 会自动扫描当前整个程序集(我们的 .dll 文件),
|
||||
// 寻找所有带有 [HarmonyPatch] 属性的类,并应用它们。
|
||||
harmony.PatchAll(Assembly.GetExecutingAssembly());
|
||||
}
|
||||
}
|
||||
}
|
||||
31
Source/ArachnaeSwarm/Patch_TrainingTracker_TickRare.cs
Normal file
31
Source/ArachnaeSwarm/Patch_TrainingTracker_TickRare.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Verse;
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
[HarmonyPatch(typeof(Pawn_TrainingTracker), "TrainingTrackerTickRare")]
|
||||
public static class Patch_TrainingTracker_TickRare
|
||||
{
|
||||
// [HarmonyPrefix] 表示这是一个“前缀”补丁,在原方法执行前运行
|
||||
// 它返回一个 bool 值:
|
||||
// - return true: 继续执行原方法 (TrainingTrackerTickRare)
|
||||
// - return false: 阻止执行原方法,直接跳过
|
||||
[HarmonyPrefix]
|
||||
public static bool PreventDecayForSpecialAnimals(Pawn_TrainingTracker __instance)
|
||||
{
|
||||
// __instance 是原方法的实例对象,我们可以通过它访问 pawn
|
||||
Pawn pawn = __instance.pawn;
|
||||
|
||||
// 检查 Pawn 的 ThingDef 是否有我们的“标记”组件
|
||||
if (pawn.def.HasComp(typeof(CompProperties_NoTrainingDecay)))
|
||||
{
|
||||
// 如果有,则这是一个不应衰减训练度的特殊动物,返回 false 阻止原方法执行
|
||||
return false;
|
||||
}
|
||||
|
||||
// 如果没有,则这是一个普通动物,返回 true 让原版的衰减逻辑正常执行
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
using RimWorld;
|
||||
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
public class ThinkNode_ConditionalAnimalShouldPlantCut : ThinkNode_Conditional
|
||||
{
|
||||
protected override bool Satisfied(Pawn pawn)
|
||||
{
|
||||
if (pawn.training == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 使用我们之前创建的静态 DefOf 类来安全地引用 Def
|
||||
return pawn.training.HasLearned(ARA_TrainableDefOf.ARA_PlantCutting) &&
|
||||
pawn.training.GetWanted(ARA_TrainableDefOf.ARA_PlantCutting);
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Source/ArachnaeSwarm/ThinkNode_ConditionalAnimalShouldSow.cs
Normal file
37
Source/ArachnaeSwarm/ThinkNode_ConditionalAnimalShouldSow.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
using RimWorld;
|
||||
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
// 使用 [DefOf] 属性,让游戏在启动时自动为我们填充这些字段
|
||||
[DefOf]
|
||||
public static class ARA_TrainableDefOf
|
||||
{
|
||||
// 确保这些字段名与你在 XML 中定义的 defName 完全一致
|
||||
public static TrainableDef ARA_Sowing;
|
||||
public static TrainableDef ARA_PlantCutting;
|
||||
|
||||
// 静态构造函数,确保 DefOf 被初始化
|
||||
static ARA_TrainableDefOf()
|
||||
{
|
||||
DefOfHelper.EnsureInitializedInCtor(typeof(ARA_TrainableDefOf));
|
||||
}
|
||||
}
|
||||
|
||||
public class ThinkNode_ConditionalAnimalShouldSow : ThinkNode_Conditional
|
||||
{
|
||||
protected override bool Satisfied(Pawn pawn)
|
||||
{
|
||||
// MCP 已证实:对于野生动物等情况,pawn.training 可能为 null,此检查是必要的。
|
||||
if (pawn.training == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 使用静态缓存的 Def,检查动物是否学会了该技能,并且玩家是否在“动物”标签页中勾选了允许
|
||||
return pawn.training.HasLearned(ARA_TrainableDefOf.ARA_Sowing) &&
|
||||
pawn.training.GetWanted(ARA_TrainableDefOf.ARA_Sowing);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user