This commit is contained in:
2025-10-04 14:21:58 +08:00
parent 33e3081c69
commit 6f9996c5df
5 changed files with 263 additions and 164 deletions

Binary file not shown.

View File

@@ -499,80 +499,7 @@
</li>
</comps>
</ThingDef>
<ThingDef ParentName="BuildingBase">
<defName>ARA_MorphableResearchBench</defName>
<!-- <hasInteractionCell>true</hasInteractionCell>
<interactionCellOffset>(0,0,-1)</interactionCellOffset> -->
<label>阿拉克涅织域种织座</label>
<description>以阿拉克涅织域种为核心形成的活体结构,是推进虫群高级研究的必须建筑。该建筑无法建造,只能通过阿拉克涅织域种变形得到。</description>
<thingClass>ArachnaeSwarm.Building_Morphable</thingClass>
<tickerType>Normal</tickerType>
<size>(2,2)</size>
<graphicData>
<texPath>ArachnaeSwarm/Building/ARA_MorphableResearchBench</texPath>
<graphicClass>Graphic_Single</graphicClass>
<shaderType>CutoutComplex</shaderType>
<drawSize>(2.5,2.5)</drawSize>
</graphicData>
<altitudeLayer>Building</altitudeLayer>
<passability>Impassable</passability>
<castEdgeShadows>false</castEdgeShadows>
<fillPercent>0.8</fillPercent>
<staticSunShadowHeight>0</staticSunShadowHeight>
<terrainAffordanceNeeded>ARA_Creep</terrainAffordanceNeeded>
<statBases>
<MaxHitPoints>1000</MaxHitPoints>
<WorkToBuild>2800</WorkToBuild>
<Flammability>1.0</Flammability>
<ResearchSpeedFactor>1.0</ResearchSpeedFactor>
</statBases>
<uiOrder>2600</uiOrder>
<surfaceType>Item</surfaceType>
<building>
<workTableRoomRole>Laboratory</workTableRoomRole>
<workTableNotInRoomRoleFactor>0.8</workTableNotInRoomRoleFactor>
<deconstructible>false</deconstructible>
</building>
<!-- 不可建造,只能通过变形生成 -->
<comps Inherit="False">
<li Class="ArachnaeSwarm.CompProperties_DelayedTerrainSpawn">
<terrainToSpawn>ARA_InsectCreep</terrainToSpawn>
<spawnRadius>3</spawnRadius>
</li>
<li Class="CompProperties_ReportWorkSpeed">
<workSpeedStat>ResearchSpeedFactor</workSpeedStat>
</li>
<li Class="ArachnaeSwarm.CompProperties_Morphable">
<!-- 休息速度增益例如1.0代表200%的速度 -->
<restGainMultiplier>1.0</restGainMultiplier>
<!-- 操作按钮的自定义标签 -->
<gizmoLabel>离开织座</gizmoLabel>
<!-- 操作按钮的自定义描述 -->
<gizmoDesc>使织域种离开织座,恢复移动状态。</gizmoDesc>
<gizmoIconPath>ArachnaeSwarm/UI/Abilities/ARA_Ability_Morph</gizmoIconPath>
</li>
<li Class="ArachnaeSwarm.CompProperties_RefuelableNutrition">
<fuelFilter>
<thingDefs>
<li>ARA_InsectJelly</li>
</thingDefs>
</fuelFilter>
<fuelCapacity>2.0</fuelCapacity>
<targetFuelLevelConfigurable>false</targetFuelLevelConfigurable>
<fuelGizmoLabel>虫蜜</fuelGizmoLabel>
<outOfFuelMessage>没有营养</outOfFuelMessage>
</li>
<li Class="CompProperties_AffectedByFacilities">
<linkableFacilities>
<li>ARA_NutrientNetworkTower</li>
</linkableFacilities>
</li>
</comps>
</ThingDef>
<ThingDef ParentName="BuildingBase">
<defName>ARA_SmartThermostat</defName>
<label>阿拉克涅纤管虫</label>
@@ -643,93 +570,4 @@
</comps>
</ThingDef>
<ThingDef ParentName="BuildingBase">
<defName>ARA_JellyVat</defName> <!-- defName is changed to reflect its purpose -->
<label>生物质酿造池</label>
<description>一个阿拉克涅虫族活体组织,可以充分利用活体钜菌的溶解能力,通过消化生物质,来分泌出营养丰富的阿拉克涅虫蜜。</description>
<thingClass>Building</thingClass>
<graphicData>
<texPath>ArachnaeSwarm/Building/ARA_JellyVat</texPath>
<graphicClass>Graphic_Single</graphicClass>
<shaderType>CutoutComplex</shaderType>
<drawSize>(2.2,2.2)</drawSize>
<shadowData>
<volume>(1.6, 0.5, 1.6)</volume>
<offset>(0,0,-0.1)</offset>
</shadowData>
</graphicData>
<researchPrerequisites>
<li>ARA_Technology_6GUT</li>
</researchPrerequisites>
<size>(2,2)</size>
<tickerType>Normal</tickerType>
<stuffCategories Inherit="False" />
<costStuffCount>0</costStuffCount>
<costList>
<ARA_Carapace>150</ARA_Carapace>
<ARA_Activated_Bacterium>25</ARA_Activated_Bacterium>
</costList>
<castEdgeShadows>false</castEdgeShadows>
<staticSunShadowHeight>0</staticSunShadowHeight>
<altitudeLayer>Building</altitudeLayer>
<passability>PassThroughOnly</passability>
<terrainAffordanceNeeded>ARA_Creep</terrainAffordanceNeeded>
<pathCost>50</pathCost>
<statBases>
<MaxHitPoints>250</MaxHitPoints>
<WorkToBuild>2800</WorkToBuild>
<Flammability>1.0</Flammability>
</statBases>
<placeWorkers>
<li>PlaceWorker_PreventInteractionSpotOverlap</li>
</placeWorkers>
<fillPercent>0.8</fillPercent>
<interactionCellOffset>(0,0,-1)</interactionCellOffset>
<hasInteractionCell>true</hasInteractionCell>
<designationCategory>ARA_Buildings</designationCategory>
<uiOrder>2600</uiOrder>
<surfaceType>Item</surfaceType>
<building>
<workTableRoomRole>Laboratory</workTableRoomRole>
<workTableNotInRoomRoleFactor>0.8</workTableNotInRoomRoleFactor>
</building>
<terrainAffordanceNeeded>ARA_Creep</terrainAffordanceNeeded>
<comps>
<li Class="CompProperties_Flickable"/>
<li Class="ArachnaeSwarm.CompProperties_MultiFuelSpawner">
<spawnIntervalRange>
<min>120000</min> <!-- 2天 -->
<max>120000</max>
</spawnIntervalRange>
<products>
<li>
<thingDef>ARA_InsectJelly</thingDef>
<count>60</count>
</li>
</products>
<showMessageIfOwned>true</showMessageIfOwned>
</li>
<li Class="ArachnaeSwarm.CompProperties_RefuelableNutrition_WithKey">
<saveKeysPrefix>Biomass</saveKeysPrefix>
<fuelLabel>生物质</fuelLabel>
<fuelFilter>
<categories>
<li>MeatRaw</li>
<li>PlantFoodRaw</li>
</categories>
<disallowedThingDefs>
<li>Milk</li>
<li>InsectJelly</li>
</disallowedThingDefs>
</fuelFilter>
<fuelCapacity>50</fuelCapacity>
<fuelConsumptionRate>30</fuelConsumptionRate>
<consumeFuelOnlyWhenUsed>true</consumeFuelOnlyWhenUsed>
</li>
<li Class="ArachnaeSwarm.CompProperties_DelayedTerrainSpawn">
<terrainToSpawn>ARA_InsectCreep</terrainToSpawn>
<spawnRadius>6</spawnRadius>
</li>
</comps>
</ThingDef>
</Defs>

View File

@@ -176,7 +176,7 @@
<li>ARA_NutrientNetworkTower</li>
</linkableFacilities>
</li>
<li Class="ArachnaeSwarm.CompProperties_DelayedTerrainSpawn">
<terrainToSpawn>ARA_InsectCreep</terrainToSpawn>
<spawnRadius>6</spawnRadius>
@@ -495,4 +495,206 @@
</li>
</comps>
</ThingDef>
<ThingDef ParentName="BuildingBase">
<defName>ARA_MorphableResearchBench</defName>
<!-- <hasInteractionCell>true</hasInteractionCell>
<interactionCellOffset>(0,0,-1)</interactionCellOffset> -->
<label>阿拉克涅织域种织座</label>
<description>以阿拉克涅织域种为核心形成的活体结构,是推进虫群高级研究的必须建筑。该建筑无法建造,只能通过阿拉克涅织域种变形得到。</description>
<thingClass>ArachnaeSwarm.Building_Morphable</thingClass>
<tickerType>Normal</tickerType>
<size>(2,2)</size>
<graphicData>
<texPath>ArachnaeSwarm/Building/ARA_MorphableResearchBench</texPath>
<graphicClass>Graphic_Single</graphicClass>
<shaderType>CutoutComplex</shaderType>
<drawSize>(2.5,2.5)</drawSize>
</graphicData>
<altitudeLayer>Building</altitudeLayer>
<passability>Impassable</passability>
<castEdgeShadows>false</castEdgeShadows>
<fillPercent>0.8</fillPercent>
<staticSunShadowHeight>0</staticSunShadowHeight>
<terrainAffordanceNeeded>ARA_Creep</terrainAffordanceNeeded>
<statBases>
<MaxHitPoints>1000</MaxHitPoints>
<WorkToBuild>2800</WorkToBuild>
<Flammability>1.0</Flammability>
<ResearchSpeedFactor>1.0</ResearchSpeedFactor>
</statBases>
<uiOrder>2600</uiOrder>
<surfaceType>Item</surfaceType>
<building>
<workTableRoomRole>Laboratory</workTableRoomRole>
<workTableNotInRoomRoleFactor>0.8</workTableNotInRoomRoleFactor>
<deconstructible>false</deconstructible>
</building>
<!-- 不可建造,只能通过变形生成 -->
<comps Inherit="False">
<li Class="ArachnaeSwarm.CompProperties_DelayedTerrainSpawn">
<terrainToSpawn>ARA_InsectCreep</terrainToSpawn>
<spawnRadius>3</spawnRadius>
</li>
<li Class="CompProperties_ReportWorkSpeed">
<workSpeedStat>ResearchSpeedFactor</workSpeedStat>
</li>
<li Class="ArachnaeSwarm.CompProperties_Morphable">
<!-- 休息速度增益例如1.0代表200%的速度 -->
<restGainMultiplier>1.0</restGainMultiplier>
<!-- 操作按钮的自定义标签 -->
<gizmoLabel>离开织座</gizmoLabel>
<!-- 操作按钮的自定义描述 -->
<gizmoDesc>使织域种离开织座,恢复移动状态。</gizmoDesc>
<gizmoIconPath>ArachnaeSwarm/UI/Abilities/ARA_Ability_Morph</gizmoIconPath>
</li>
<li Class="ArachnaeSwarm.CompProperties_RefuelableNutrition">
<fuelFilter>
<thingDefs>
<li>ARA_InsectJelly</li>
</thingDefs>
</fuelFilter>
<fuelCapacity>2.0</fuelCapacity>
<targetFuelLevelConfigurable>false</targetFuelLevelConfigurable>
<fuelGizmoLabel>虫蜜</fuelGizmoLabel>
<outOfFuelMessage>没有营养</outOfFuelMessage>
</li>
<li Class="CompProperties_AffectedByFacilities">
<linkableFacilities>
<li>ARA_NutrientNetworkTower</li>
</linkableFacilities>
</li>
</comps>
</ThingDef>
<ThingDef ParentName="BuildingBase">
<defName>ARA_JellyVat</defName> <!-- defName is changed to reflect its purpose -->
<label>生物质酿造池</label>
<description>一个阿拉克涅虫族活体组织,可以充分利用活体钜菌的溶解能力,通过消化生物质,来分泌出营养丰富的阿拉克涅虫蜜。</description>
<thingClass>Building</thingClass>
<graphicData>
<texPath>ArachnaeSwarm/Building/ARA_JellyVat</texPath>
<graphicClass>Graphic_Single</graphicClass>
<shaderType>CutoutComplex</shaderType>
<drawSize>(2.2,2.2)</drawSize>
<shadowData>
<volume>(1.6, 0.5, 1.6)</volume>
<offset>(0,0,-0.1)</offset>
</shadowData>
</graphicData>
<researchPrerequisites>
<li>ARA_Technology_6GUT</li>
</researchPrerequisites>
<size>(2,2)</size>
<tickerType>Normal</tickerType>
<stuffCategories Inherit="False" />
<costStuffCount>0</costStuffCount>
<costList>
<ARA_Carapace>150</ARA_Carapace>
<ARA_Activated_Bacterium>25</ARA_Activated_Bacterium>
</costList>
<castEdgeShadows>false</castEdgeShadows>
<staticSunShadowHeight>0</staticSunShadowHeight>
<altitudeLayer>Building</altitudeLayer>
<passability>PassThroughOnly</passability>
<terrainAffordanceNeeded>ARA_Creep</terrainAffordanceNeeded>
<pathCost>50</pathCost>
<statBases>
<MaxHitPoints>250</MaxHitPoints>
<WorkToBuild>2800</WorkToBuild>
<Flammability>1.0</Flammability>
</statBases>
<placeWorkers>
<li>PlaceWorker_PreventInteractionSpotOverlap</li>
</placeWorkers>
<fillPercent>0.8</fillPercent>
<interactionCellOffset>(0,0,-1)</interactionCellOffset>
<hasInteractionCell>true</hasInteractionCell>
<designationCategory>ARA_Buildings</designationCategory>
<uiOrder>2600</uiOrder>
<surfaceType>Item</surfaceType>
<building>
<workTableRoomRole>Laboratory</workTableRoomRole>
<workTableNotInRoomRoleFactor>0.8</workTableNotInRoomRoleFactor>
</building>
<terrainAffordanceNeeded>ARA_Creep</terrainAffordanceNeeded>
<comps>
<li Class="CompProperties_Flickable"/>
<!--<li Class="ArachnaeSwarm.CompProperties_MultiFuelSpawner">
<spawnIntervalRange>
<min>120000</min>
<max>120000</max>
</spawnIntervalRange>
<products>
<li>
<thingDef>ARA_InsectJelly</thingDef>
<count>60</count>
</li>
</products>
<showMessageIfOwned>true</showMessageIfOwned>
</li>-->
<li Class="ArachnaeSwarm.CompProperties_RefuelableNutrition_WithKey">
<saveKeysPrefix>Biomass</saveKeysPrefix>
<fuelLabel>生物质</fuelLabel>
<fuelGizmoLabel>生物质</fuelGizmoLabel>
<fuelFilter>
<categories>
<li>MeatRaw</li>
<li>PlantFoodRaw</li>
</categories>
<disallowedThingDefs>
<li>Milk</li>
<li>InsectJelly</li>
</disallowedThingDefs>
</fuelFilter>
<fuelCapacity>50</fuelCapacity>
<fuelConsumptionRate>0</fuelConsumptionRate>
<consumeFuelOnlyWhenUsed>true</consumeFuelOnlyWhenUsed>
<targetFuelLevelConfigurable>true</targetFuelLevelConfigurable>
<showAllowAutoRefuelToggle>true</showAllowAutoRefuelToggle>
</li>
<li Class="CompProperties_Refuelable">
<fuelLabel>虫蜜</fuelLabel>
<fuelGizmoLabel>虫蜜</fuelGizmoLabel>
<fuelCapacity>100.0</fuelCapacity>
<fuelConsumptionRate>0</fuelConsumptionRate>
<consumeFuelOnlyWhenUsed>true</consumeFuelOnlyWhenUsed>
<fuelFilter>
<thingDefs>
<li>ARA_InsectJelly</li>
</thingDefs>
</fuelFilter>
<targetFuelLevelConfigurable>true</targetFuelLevelConfigurable>
<showAllowAutoRefuelToggle>true</showAllowAutoRefuelToggle>
<canEjectFuel>true</canEjectFuel>
</li>
<li Class="ArachnaeSwarm.CompProperties_NutritionToFuelConverter">
<checkInterval>200</checkInterval>
<nutritionCost>1</nutritionCost>
<workAmount>2000</workAmount>
<fuelAmount>1</fuelAmount>
</li>
<!-- 燃料满了自动弹出 -->
<li Class="ArachnaeSwarm.CompProperties_AutoEjector">
<!-- 精确指定要监控的燃料组件 -->
<targetComp>CompRefuelable</targetComp>
<!-- 在燃料达到99%时弹出 -->
<ejectAtPercent>0.99</ejectAtPercent>
</li>
<li Class="ArachnaeSwarm.CompProperties_DelayedTerrainSpawn">
<terrainToSpawn>ARA_InsectCreep</terrainToSpawn>
<spawnRadius>6</spawnRadius>
</li>
</comps>
</ThingDef>
</Defs>

View File

@@ -145,6 +145,7 @@
<Compile Include="Building_Comps\WULA_MutiFuelSpawner\IFuelSource.cs" />
<Compile Include="Building_Comps\WULA_MutiFuelSpawner\Patch_CompRefuelableWithKey.cs" />
<Compile Include="Building_Comps\CompNutritionToFuelConverter.cs" />
<Compile Include="Building_Comps\CompAutoEjector.cs" />
<Compile Include="Hediffs\ARA_ConfigurableMutant\Hediff_ConfigurableMutant.cs" />
<Compile Include="Hediffs\ARA_ConfigurableMutant\Hediff_NecroticVirus_Configurable.cs" />
<Compile Include="Hediffs\ARA_ConfigurableMutant\HediffComp_NecroticTransformation.cs" />

View File

@@ -0,0 +1,58 @@
using System;
using System.Linq;
using RimWorld;
using Verse;
namespace ArachnaeSwarm
{
// Properties for the new component
public class CompProperties_AutoEjector : CompProperties
{
public int checkInterval = 250; // Check roughly every 4 seconds
public float ejectAtPercent = 1.0f; // Eject when fuel reaches this percentage of max capacity (1.0 = 100%)
public Type targetComp = typeof(CompRefuelable); // The specific CompRefuelable class to target, can be overridden in XML
public CompProperties_AutoEjector()
{
this.compClass = typeof(CompAutoEjector);
}
}
// The component logic
public class CompAutoEjector : ThingComp
{
private CompProperties_AutoEjector Props => (CompProperties_AutoEjector)this.props;
private CompRefuelable refuelableComp;
public override void PostSpawnSetup(bool respawningAfterLoad)
{
base.PostSpawnSetup(respawningAfterLoad);
// Find the specific refuelable component specified in XML
this.refuelableComp = this.parent.GetComps<CompRefuelable>()
.FirstOrDefault(comp => comp.GetType() == this.Props.targetComp);
if (this.refuelableComp == null)
{
Log.Warning($"[ArachnaeSwarm] CompAutoEjector on {parent.def.defName} could not find a CompRefuelable of type '{this.Props.targetComp.FullName}' to monitor.");
}
}
public override void CompTick()
{
base.CompTick();
// Check if we have a valid refuelable comp and it's time to check
if (this.refuelableComp != null &&
this.parent.IsHashIntervalTick(this.Props.checkInterval))
{
// Check if fuel has reached or exceeded the configured percentage of the MAX capacity
if (this.refuelableComp.FuelPercentOfMax >= this.Props.ejectAtPercent)
{
// Call the public EjectFuel() method.
this.refuelableComp.EjectFuel();
}
}
}
}
}