暂存feat(maintenance): 添加维护舱及相关需求机制

为乌拉族引入了新的“机体维护”需求,通过`WULA_Maintenance_Neglect`健康状况(Hediff)体现。该状况会随时间推移而恶化,影响角色能力。

新增建筑“维护舱”(`WULA_MaintenancePod`),乌拉族成员可进入其中进行维护,以清除“维护疏忽”的负面效果。维护过程需要消耗电力和零部件,所需零部件数量与负面效果的严重程度相关。

实现了配套的自动化工作逻辑:
- 当维护需求达到阈值时,角色会自动进入维护舱。
- 当维护舱缺少零部件时,搬运工会自动为其装填。

此外,事件系统中增加了一个新的条件 `Condition_FactionExists`。
This commit is contained in:
2025-08-08 19:31:29 +08:00
parent b5d72ad886
commit fa442bd7fd
15 changed files with 840 additions and 1 deletions

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<HediffDef>
<defName>WULA_Maintenance_Neglect</defName>
<label>维护</label>
<description>如果缺乏定期维护,身体机能将会出现衰退迹象。需要进入维护舱进行修复。</description>
<hediffClass>HediffWithComps</hediffClass>
<defaultLabelColor>(0.8, 0.35, 0.35)</defaultLabelColor>
<isBad>true</isBad>
<comps>
<li Class="WulaFallenEmpire.HediffCompProperties_MaintenanceNeed">
<thresholdDays>60</thresholdDays>
<severityPerDayBeforeThreshold>0.004</severityPerDayBeforeThreshold>
<severityPerDayAfterThreshold>0.02</severityPerDayAfterThreshold>
</li>
</comps>
<stages>
<li>
<label>极佳</label>
<minSeverity>0</minSeverity>
<capMods>
<li>
<capacity>Consciousness</capacity>
<offset>0.1</offset>
</li>
</capMods>
</li>
<li>
<label>稳定</label>
<minSeverity>0.5</minSeverity>
<capMods>
<li>
<capacity>Consciousness</capacity>
<offset>0</offset>
</li>
</capMods>
</li>
<li>
<label>需要</label>
<minSeverity>0.75</minSeverity>
<capMods>
<li>
<capacity>Consciousness</capacity>
<offset>-0.10</offset>
</li>
</capMods>
</li>
<li>
<label>损坏</label>
<minSeverity>1.0</minSeverity>
<capMods>
<li>
<capacity>Consciousness</capacity>
<offset>-0.25</offset>
</li>
</capMods>
</li>
</stages>
</HediffDef>
</Defs>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<JobDef>
<defName>WULA_LoadComponentsToMaintenancePod</defName>
<driverClass>WulaFallenEmpire.JobDriver_LoadComponents</driverClass>
<reportString>正在为维护舱装填零部件。</reportString>
<haulMode>ToCellNonStorage</haulMode>
</JobDef>
<JobDef>
<defName>WULA_EnterMaintenancePod</defName>
<driverClass>WulaFallenEmpire.JobDriver_EnterMaintenancePod</driverClass>
<reportString>正在进入维护舱。</reportString>
</JobDef>
</Defs>

View File

@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<ThingDef ParentName="BuildingBase">
<defName>WULA_MaintenancePod</defName>
<label>维护舱</label>
<description>一个为乌拉族设计的全自动维护舱。乌拉族需要定期进入其中进行身体机能的维护和校准,否则他们的身体会逐渐衰弱。维护过程需要消耗零部件。</description>
<containedPawnsSelectable>true</containedPawnsSelectable>
<graphicData>
<texPath>Things/Building/Misc/BiosculpterPod/BiosculpterPod</texPath>
<graphicClass>Graphic_Multi</graphicClass>
<shadowData>
<volume>(2.9,0.6,1.9)</volume>
</shadowData>
<drawSize>(3, 2)</drawSize>
</graphicData>
<drawerType>RealtimeOnly</drawerType>
<drawGUIOverlay>true</drawGUIOverlay>
<defaultPlacingRot>South</defaultPlacingRot>
<altitudeLayer>Building</altitudeLayer>
<passability>PassThroughOnly</passability>
<pathCost>42</pathCost>
<blockWind>true</blockWind>
<fillPercent>0.5</fillPercent>
<canOverlapZones>false</canOverlapZones>
<statBases>
<MaxHitPoints>250</MaxHitPoints>
<WorkToBuild>20000</WorkToBuild>
<Mass>50</Mass>
<Flammability>0.5</Flammability>
<Beauty>-5</Beauty>
</statBases>
<size>(3,2)</size>
<interactionCellOffset>(0,0,2)</interactionCellOffset>
<hasInteractionCell>true</hasInteractionCell>
<costList>
<Steel>150</Steel>
<ComponentIndustrial>10</ComponentIndustrial>
<ComponentSpacer>2</ComponentSpacer>
</costList>
<constructionSkillPrerequisite>8</constructionSkillPrerequisite>
<building>
<destroySound>BuildingDestroyed_Metal_Big</destroySound>
<uninstallWork>1800</uninstallWork>
<defaultStorageSettings>
<filter>
<thingDefs>
<li>ComponentIndustrial</li>
</thingDefs>
</filter>
</defaultStorageSettings>
</building>
<designationCategory>Misc</designationCategory>
<minifiedDef>MinifiedThing</minifiedDef>
<thingCategories>
<li>BuildingsMisc</li>
</thingCategories>
<tickerType>Normal</tickerType>
<comps>
<li Class="CompProperties_Power">
<compClass>CompPowerTrader</compClass>
<basePowerConsumption>50</basePowerConsumption> <!-- This is now idle power -->
</li>
<li Class="CompProperties_Flickable"/>
<li Class="WulaFallenEmpire.CompProperties_MaintenancePod">
<durationTicks>60000</durationTicks> <!-- 1 day -->
<powerConsumptionRunning>250</powerConsumptionRunning>
<powerConsumptionIdle>50</powerConsumptionIdle>
<hediffToRemove>WULA_Maintenance_Neglect</hediffToRemove>
<componentDef>ComponentIndustrial</componentDef>
<componentCostPerSeverity>5</componentCostPerSeverity> <!-- 5 components per 100% severity -->
<baseComponentCost>0</baseComponentCost>
<minSeverityToMaintain>0.75</minSeverityToMaintain>
<enterSound>BiosculpterPod_Enter</enterSound>
<exitSound>BiosculpterPod_Exit</exitSound>
<operatingEffecter>BiosculpterPod_Operating</operatingEffecter>
</li>
</comps>
<placeWorkers>
<li>PlaceWorker_PreventInteractionSpotOverlap</li>
</placeWorkers>
<inspectorTabs>
<li>ITab_Storage</li>
</inspectorTabs>
</ThingDef>
</Defs>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<WorkGiverDef>
<defName>WULA_LoadComponentsToMaintenancePod</defName>
<label>装填维护舱</label>
<giverClass>WulaFallenEmpire.WorkGiver_LoadComponents</giverClass>
<workType>Hauling</workType>
<verb>装填</verb>
<gerund>装填于</gerund>
<priorityInType>110</priorityInType> <!-- High priority for hauling -->
<requiredCapacities>
<li>Manipulation</li>
</requiredCapacities>
</WorkGiverDef>
<WorkGiverDef>
<defName>WULA_EnterMaintenancePod</defName>
<label>进行机体维护</label>
<giverClass>WulaFallenEmpire.WorkGiver_EnterMaintenancePod</giverClass>
<workType>Patient</workType>
<verb>进行维护</verb>
<gerund>进行维护于</gerund>
<priorityInType>100</priorityInType> <!-- High priority for self-care -->
</WorkGiverDef>
</Defs>