存奇怪的植物

This commit is contained in:
2025-09-27 13:50:40 +08:00
parent 3195df694e
commit 58d57dbb2e
6 changed files with 283 additions and 10 deletions

Binary file not shown.

View File

@@ -59,7 +59,8 @@
<label>菌毯加成:治疗</label>
<description>这只阿拉克捏督虫所着织物使其获得了治疗他人的能力。</description>
<hediffClass>HediffWithComps</hediffClass>
<maxSeverity>0.02</maxSeverity>
<initialSeverity>1.0</initialSeverity>
<maxSeverity>1.0</maxSeverity>
<minSeverity>0.01</minSeverity>
<isBad>false</isBad>
<comps>

View File

@@ -33,12 +33,95 @@
</sowResearchPrerequisites>
</plant>
</ThingDef>
<ThingDef ParentName="PlantBase">
<defName>ARA_AcidlingTrapPlant</defName>
<label>酸爆巢花</label>
<thingClass>ArachnaeSwarm.Plant_Transforming</thingClass>
<description>一种只能在阿拉克涅菌毯上生长的奇特植物,几乎不消耗肥力即可通过菌毯的营养管道茁壮生长,并转换成阿拉克涅酸爆茧。</description>
<statBases>
<MaxHitPoints>85</MaxHitPoints>
<Beauty>4</Beauty>
<Nutrition>0.2</Nutrition>
</statBases>
<graphicData>
<texPath>Things/Plant/Glowstool</texPath>
<graphicClass>Graphic_Random</graphicClass>
</graphicData>
<selectable>true</selectable>
<pathCost>10</pathCost>
<plant>
<fertilityMin>0.05</fertilityMin>
<fertilitySensitivity>0.05</fertilitySensitivity>
<growDays>10</growDays>
<harvestYield>10</harvestYield>
<harvestedThingDef>ARA_CreepFungus</harvestedThingDef>
<sowTags>
<li>Ground</li>
</sowTags>
<wildTerrainTags>
<li>ARA_Creep</li>
</wildTerrainTags>
<visualSizeRange>0.3~0.8</visualSizeRange>
<sowResearchPrerequisites>
<li>ARA_Technology_8CPE</li>
</sowResearchPrerequisites>
</plant>
<modExtensions>
<li Class="ArachnaeSwarm.PlantTransformExtension">
<buildingDef>Arachnae_AcidlingTrap</buildingDef>
<transformAtGrowth>0.8</transformAtGrowth>
</li>
</modExtensions>
</ThingDef>
<ThingDef ParentName="PlantBase">
<defName>ARA_BeeSpikePlant</defName>
<label>蜂刺巢花</label>
<thingClass>ArachnaeSwarm.Plant_Transforming</thingClass>
<description>一种只能在阿拉克涅菌毯上生长的奇特植物,几乎不消耗肥力即可通过菌毯的营养管道茁壮生长,并转换成蜂刺射手。</description>
<statBases>
<MaxHitPoints>85</MaxHitPoints>
<Beauty>4</Beauty>
<Nutrition>0.2</Nutrition>
</statBases>
<graphicData>
<texPath>Things/Plant/Glowstool</texPath>
<graphicClass>Graphic_Random</graphicClass>
</graphicData>
<selectable>true</selectable>
<pathCost>10</pathCost>
<plant>
<fertilityMin>0.05</fertilityMin>
<fertilitySensitivity>0.05</fertilitySensitivity>
<growDays>10</growDays>
<harvestYield>10</harvestYield>
<harvestedThingDef>ARA_CreepFungus</harvestedThingDef>
<sowTags>
<li>Ground</li>
</sowTags>
<wildTerrainTags>
<li>ARA_Creep</li>
</wildTerrainTags>
<visualSizeRange>0.3~0.8</visualSizeRange>
<sowResearchPrerequisites>
<li>ARA_Technology_8CPE</li>
</sowResearchPrerequisites>
</plant>
<modExtensions>
<li Class="ArachnaeSwarm.PlantTransformExtension">
<buildingDef>ARA_Turret_Beespikeshooter</buildingDef>
<transformAtGrowth>0.8</transformAtGrowth>
</li>
</modExtensions>
</ThingDef>
<ThingDef ParentName="PlantFoodRawBase">
<defName>ARA_CreepFungus</defName>
<label>菌毯真菌</label>
<description>从菌毯奇花上收获的真菌。可以直接生吃,但烹饪后味道更佳。</description>
<graphicData>
<texPath>Things/Item/Resource/PlantFoodRaw/RawFungus</texPath> <!-- 暂时使用原版真菌的贴图 -->
<texPath>Things/Item/Resource/PlantFoodRaw/RawFungus</texPath> <!-- 暂时使用原版真菌的贴图 -->
</graphicData>
<statBases>
<MarketValue>1.1</MarketValue>

View File

@@ -39,10 +39,10 @@
<thingClass>ArachnaeSwarm.Filth_Toxic</thingClass>
<modExtensions>
<li Class="ArachnaeSwarm.OPToxicDefs">
<OPToxicHediff>ARA_AcidCoverd</OPToxicHediff> <!-- Name of HediffDef to apply, change to own
<OPToxicHediff>ARA_AcidCoverd</OPToxicHediff> <!-- Name of HediffDef to apply, change to own
HediffDef -->
<OPToxicSeverity>0.1</OPToxicSeverity> <!-- Severity build up per Tick period -->
<OPSevUpTickPeriod>240</OPSevUpTickPeriod> <!-- No of game ticks per each build up, recommend
<OPToxicSeverity>0.1</OPToxicSeverity> <!-- Severity build up per Tick period -->
<OPSevUpTickPeriod>240</OPSevUpTickPeriod> <!-- No of game ticks per each build up, recommend
>= 120 -->
</li>
</modExtensions>
@@ -91,6 +91,119 @@
</children>
</EffecterDef>
<ThingDef ParentName="BuildingBase">
<defName>ARA_Turret_Beespikeshooter</defName>
<label>蜂刺射手</label>
<description>射出毒刺的小炮塔.</description>
<thingClass>Building_TurretGun</thingClass>
<drawerType>MapMeshAndRealTime</drawerType>
<graphicData>
<texPath>Things/Building/TacticalTurret/TacticalTurret_Base</texPath>
<graphicClass>Graphic_Single</graphicClass>
<damageData>
<rect>(0.2,0.2,0.6,0.6)</rect>
</damageData>
<shadowData>
<volume>(0.27,0.25,0.27)</volume>
<offset>(0,0,0)</offset>
</shadowData>
<drawSize>(1.2, 1.2)</drawSize>
</graphicData>
<altitudeLayer>Building</altitudeLayer>
<stealable>false</stealable>
<rotatable>false</rotatable>
<statBases>
<MaxHitPoints>100</MaxHitPoints>
<Flammability>0.7</Flammability>
<WorkToBuild>1800</WorkToBuild>
<Mass>8</Mass>
<Beauty>-20</Beauty>
<ShootingAccuracyTurret>0.96</ShootingAccuracyTurret>
</statBases>
<tickerType>Normal</tickerType>
<comps>
<li Class="CompProperties_Forbiddable"/>
<li Class="ArachnaeSwarm.CompProperties_ForceTargetable" />
<li Class="CompProperties_Refuelable">
<fuelLabel>弹药</fuelLabel>
<fuelGizmoLabel>弹药</fuelGizmoLabel>
<outOfFuelMessage>缺少弹药</outOfFuelMessage>
<fuelFilter>
<thingDefs>
<li>ARA_DummyAmmo</li>
</thingDefs>
</fuelFilter>
<fuelCapacity>100</fuelCapacity>
<initialFuelPercent>1</initialFuelPercent>
<autoRefuelPercent>1</autoRefuelPercent>
<showFuelGizmo>true</showFuelGizmo>
<consumeFuelOnlyWhenUsed>true</consumeFuelOnlyWhenUsed>
</li>
<li Class="ArachnaeSwarm.CompProperties_NodeSwarmLifetime">
<lifetimeDays>10</lifetimeDays>
<labelOverride>寿命</labelOverride>
<tooltipOverride>这种半植物生命的寿命转瞬即逝。</tooltipOverride>
<showGizmoOnNonPlayerControlled>true</showGizmoOnNonPlayerControlled>
</li>
</comps>
<passability>PassThroughOnly</passability>
<pathCost>50</pathCost>
<fillPercent>0.4</fillPercent>
<hasTooltip>true</hasTooltip>
<costList>
<Steel>40</Steel>
</costList>
<terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
<building>
<combatPower>45</combatPower> <!-- same as a scavenger -->
<ai_combatDangerous>true</ai_combatDangerous>
<turretGunDef>ARA_Gun_Beespikeshooter</turretGunDef>
<turretBurstWarmupTime>0.5</turretBurstWarmupTime>
<turretBurstCooldownTime>2.4</turretBurstCooldownTime>
<claimable>false</claimable>
<expandHomeArea>false</expandHomeArea>
<turretTopDrawSize>1.2</turretTopDrawSize>
</building>
<placeWorkers>
<li>PlaceWorker_TurretTop</li>
<li>PlaceWorker_ShowTurretRadius</li>
</placeWorkers>
<designationHotKey>Misc2</designationHotKey>
</ThingDef>
<ThingDef ParentName="BaseWeaponTurret">
<defName>ARA_Gun_Beespikeshooter</defName>
<label>蜂刺射手</label>
<description>会发射小毒刺的组织.</description>
<graphicData>
<texPath>Things/Building/TacticalTurret/TacticalTurret_Top</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<statBases>
<AccuracyTouch>0.77</AccuracyTouch>
<AccuracyShort>0.70</AccuracyShort>
<AccuracyMedium>0.45</AccuracyMedium>
<AccuracyLong>0.24</AccuracyLong>
<RangedWeapon_Cooldown>4.8</RangedWeapon_Cooldown>
<DeteriorationRate>0</DeteriorationRate>
<Mass>5</Mass>
<Flammability>0</Flammability>
</statBases>
<verbs>
<li>
<verbClass>Verb_Shoot</verbClass>
<defaultProjectile>Bullet_ARA_RW_Basic_Fist_Needle_Gun</defaultProjectile>
<warmupTime>0</warmupTime>
<range>19.9</range> <!-- Must be kept in sync with "explosion radius" of Grenade_TurretPack -->
<ticksBetweenBurstShots>2</ticksBetweenBurstShots>
<burstShotCount>2</burstShotCount>
<soundCast>SpitterSpit</soundCast>
<muzzleFlashScale>9</muzzleFlashScale>
<consumeFuelPerShot>1</consumeFuelPerShot>
</li>
</verbs>
</ThingDef>
<ThingDef ParentName="BuildingBase">
<defName>ARA_AutoSniperCannon</defName>
<label>血链千兆炮组织</label>
@@ -181,7 +294,7 @@
<multiplier>0</multiplier>
</li>
</damageMultipliers>
<generateCommonality>4</generateCommonality> <!-- generate more often than other problem causers
<generateCommonality>4</generateCommonality> <!-- generate more often than other problem causers
for mech clusters -->
<building>
<turretGunDef>Gun_ARA_AutoSniperCannonTurret</turretGunDef>
@@ -192,8 +305,8 @@
<terrainAffordanceNeeded>ARA_Creep</terrainAffordanceNeeded>
<constructionSkillPrerequisite>8</constructionSkillPrerequisite>
</ThingDef>
<ThingDef ParentName="BaseWeaponTurret"> <!-- Should reorganize this XML relation at some point -->
<defName>Gun_ARA_AutoSniperCannonTurret</defName> <!-- Should be called ChargeBlasterLightTurret,
<ThingDef ParentName="BaseWeaponTurret"> <!-- Should reorganize this XML relation at some point -->
<defName>Gun_ARA_AutoSniperCannonTurret</defName> <!-- Should be called ChargeBlasterLightTurret,
but we keep this defName for compatibility -->
<label>血链千兆机炮</label>
<description>血链千兆机炮.</description>
@@ -317,7 +430,7 @@
<multiplier>0</multiplier>
</li>
</damageMultipliers>
<generateCommonality>4</generateCommonality> <!-- generate more often than other problem causers
<generateCommonality>4</generateCommonality> <!-- generate more often than other problem causers
for mech clusters -->
<building>
<buildingTags>
@@ -344,7 +457,7 @@
</weaponTags>
<verbs>
<li>
<verbClass>ArachnaeSwarm.Verb_ShootConsumeNutrition</verbClass>
<verbClass>Verb_Shoot</verbClass>
<defaultProjectile>ArachnaeBase_Race_Acidling_Proj</defaultProjectile>
<ai_AvoidFriendlyFireRadius>3</ai_AvoidFriendlyFireRadius>
<warmupTime>2</warmupTime>

View File

@@ -189,6 +189,7 @@
<Compile Include="Pawn_Comps\ARA_TrainingWork\JobPlant\ThinkNode_ConditionalAnimalShouldDoGrowingWork.cs" />
<Compile Include="Pawn_Comps\ARA_TrainingWork\JobPlant\WorkGiver_ArachnaeSow.cs" />
<Compile Include="Pawn_Comps\ARA_TrainingWork\TrainingSystem_Patcher.cs" />
<Compile Include="Plants\Plant_Transforming.cs" />
<Compile Include="Thing_Comps\ARA_CustomUniqueWeapon\CompCustomUniqueWeapon.cs" />
<Compile Include="Thing_Comps\ARA_CustomUniqueWeapon\CompProperties_CustomUniqueWeapon.cs" />
<Compile Include="Thing_Comps\ARA_IngestionOutcomeDoer_GiveHediff\IngestionOutcomeDoer_GiveHediffByRace.cs" />

View File

@@ -0,0 +1,75 @@
using RimWorld;
using Verse;
namespace ArachnaeSwarm
{
// Define a DefModExtension to hold our custom properties in XML
public class PlantTransformExtension : DefModExtension
{
public ThingDef buildingDef;
public float transformAtGrowth = 0.8f;
}
public class Plant_Transforming : Plant
{
private PlantTransformExtension extension;
private bool transformed = false;
// Caching the extension for performance
public PlantTransformExtension Extension
{
get
{
if (extension == null)
{
extension = this.def.GetModExtension<PlantTransformExtension>();
}
return extension;
}
}
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref transformed, "transformed", false);
}
public override void TickLong()
{
base.TickLong(); // Execute base plant logic first
if (transformed || this.Destroyed || Extension == null)
{
return;
}
if (this.Growth >= Extension.transformAtGrowth)
{
TryTransform();
transformed = true;
}
}
private void TryTransform()
{
if (this.Destroyed || Extension.buildingDef == null) return;
Map map = this.Map;
IntVec3 position = this.Position;
Faction factionToSet = null;
Zone zone = map.zoneManager.ZoneAt(position);
if (zone is Zone_Growing) factionToSet = Faction.OfPlayer;
if (factionToSet == null && map.IsPlayerHome) factionToSet = Faction.OfPlayer;
Thing building = ThingMaker.MakeThing(Extension.buildingDef, null);
if (factionToSet != null && building.def.CanHaveFaction)
{
building.SetFaction(factionToSet);
}
this.Destroy(DestroyMode.Vanish);
GenSpawn.Spawn(building, position, map, WipeMode.Vanish);
}
}
}