将种族限定区域hediff挪过来

This commit is contained in:
2025-09-09 10:56:15 +08:00
parent 6b8fb58777
commit 025881a310
10 changed files with 137 additions and 120 deletions

Binary file not shown.

View File

@@ -111,44 +111,6 @@
</east>
</offsets>
</li>
<!--<li>
<name>ArachnaeNode Hair BG</name>
<userCustomizable>true</userCustomizable>
<path></path>
<inFrontOfBody>false</inFrontOfBody>
<layerInvert>false</layerInvert>
<colorChannel>hair</colorChannel>
<defaultOffset>Center</defaultOffset>
<drawSize>1</drawSize>
<alignWithHead>true</alignWithHead>
<scaleWithPawnDrawsize>true</scaleWithPawnDrawsize>
<linkVariantIndexWithPrevious>true</linkVariantIndexWithPrevious>
<conditions>
<BodyPart>
<bodyPart>Head</bodyPart>
</BodyPart>
<Posture>
<drawnStanding>true</drawnStanding>
<drawnInBed>false</drawnInBed>
<drawnLaying>true</drawnLaying>
</Posture>
<RotStage>Fresh,Rotting</RotStage>
</conditions>
<offsets>
<west>
<layerOffset>-0.275</layerOffset>
</west>
<south>
<layerOffset>-0.299</layerOffset>
</south>
<north>
<layerOffset>-0.275</layerOffset>
</north>
<east>
<layerOffset>-0.275</layerOffset>
</east>
</offsets>
</li>-->
<li>
<path>ArachnaeSwarm/Things/ARA_HiveNode/Addons/ArachnaeNode_Race_Addons_Base</path>
<inFrontOfBody>true</inFrontOfBody>
@@ -598,7 +560,7 @@
</lifeStageWorkSettings>
<lifeStageAges Inherit="False">
<li>
<def>ARA_Queen_Adult</def>
<def>ArachnaeNode_Myrmecocystus_Adult</def>
<minAge>0</minAge>
<soundWounded>Pawn_BigInsect_Pain</soundWounded>
<soundDeath>Pawn_BigInsect_Death</soundDeath>
@@ -670,9 +632,30 @@
<li Class="CompProperties_DrugAddict"/> -->
</comps>
</AlienRace.ThingDef_AlienRace>
<AlienRace.ThingDef_AlienRace Name="ARA_NodeBase_Huge" ParentName="ARA_NodeBase">
<alienRace>
<generalSettings>
<!-- 各种零件定义 -->
<alienPartGenerator>
<!-- 图像放大 -->
<customDrawSize>(1.2,1.2)</customDrawSize>
<customHeadDrawSize>(1.05,1.05)</customHeadDrawSize>
<customPortraitDrawSize>(0.9,0.9)</customPortraitDrawSize>
<borderScale>1.2</borderScale>
<atlasScale>1.2</atlasScale>
</alienPartGenerator>
</generalSettings>
</alienRace>
<race>
<baseBodySize>2.5</baseBodySize>
<baseHealthScale>4</baseHealthScale>
<lifeExpectancy>10</lifeExpectancy>
</race>
</AlienRace.ThingDef_AlienRace>
<!-- 定义阿拉克涅节点虫种族 -->
<AlienRace.ThingDef_AlienRace ParentName="ARA_NodeBase">
<AlienRace.ThingDef_AlienRace ParentName="ARA_NodeBase_Huge">
<defName>ArachnaeNode_Race_Myrmecocystus</defName>
<label>阿拉克涅蜜罐种</label>
<description>阿拉克涅督虫之一,拥有非常广泛的食谱,可以吞下许多未经处理的生物并将其分解为阿拉克涅虫蜜,以滋养虫群。这种督虫除了生产虫蜜外也能执行烹饪和种植工作。\n\n作为督虫她可以繁育并监管若干阿拉克涅食腐种辅虫以协助巢穴进行收割和播种工作。</description>
@@ -685,8 +668,7 @@
<li>
<path>ArachnaeSwarm/Things/ARA_HiveNode/Addons/ArachnaeNode_Race_Myrmecocystus_Addons_Stomach</path>
<inFrontOfBody>false</inFrontOfBody>
<conditions>
</conditions>
<scaleWithPawnDrawsize>true</scaleWithPawnDrawsize>
</li>
</bodyAddons>
</alienPartGenerator>
@@ -766,12 +748,6 @@
<baseHealthScale>3</baseHealthScale>
<!-- 蜜罐虫的寿命很低 -->
<lifeExpectancy>1.5</lifeExpectancy>
<lifeStageAges Inherit="False">
<li>
<def>ArachnaeNode_Myrmecocystus_Adult</def>
<minAge>0</minAge>
</li>
</lifeStageAges>
</race>
</AlienRace.ThingDef_AlienRace>
<AlienRace.ThingDef_AlienRace ParentName="ARA_NodeBase">
@@ -801,6 +777,7 @@
</west>
</offsets>
<inFrontOfBody>true</inFrontOfBody>
<scaleWithPawnDrawsize>true</scaleWithPawnDrawsize>
</li>
<li>
<path>ArachnaeSwarm/Things/ARA_HiveNode/Addons/ArachnaeNode_Race_Addons_ShieldBody</path>
@@ -820,6 +797,7 @@
</offsets>
<inFrontOfBody>true</inFrontOfBody>
<layerInvert>false</layerInvert>
<scaleWithPawnDrawsize>true</scaleWithPawnDrawsize>
</li>
</bodyAddons>
</alienPartGenerator>
@@ -890,12 +868,6 @@
<baseHealthScale>5</baseHealthScale>
<!-- 蜜罐虫的寿命很低 -->
<lifeExpectancy>2</lifeExpectancy>
<lifeStageAges Inherit="False">
<li>
<def>ArachnaeNode_Myrmecocystus_Adult</def>
<minAge>0</minAge>
</li>
</lifeStageAges>
</race>
</AlienRace.ThingDef_AlienRace>
<AlienRace.ThingDef_AlienRace ParentName="ARA_NodeBase">
@@ -911,6 +883,7 @@
<li>
<path>ArachnaeSwarm/Things/ARA_HiveNode/Addons/ArachnaeNode_Race_Addons_WeaponSmith</path>
<inFrontOfBody>false</inFrontOfBody>
<scaleWithPawnDrawsize>true</scaleWithPawnDrawsize>
<offsets>
<north>
<layerOffset>-0.275</layerOffset>
@@ -979,12 +952,6 @@
<baseBodySize>0.8</baseBodySize>
<baseHealthScale>0.75</baseHealthScale>
<lifeExpectancy>5</lifeExpectancy>
<lifeStageAges Inherit="False">
<li>
<def>ArachnaeNode_Myrmecocystus_Adult</def>
<minAge>0</minAge>
</li>
</lifeStageAges>
</race>
</AlienRace.ThingDef_AlienRace>
<AlienRace.ThingDef_AlienRace ParentName="ARA_NodeBase">
@@ -1000,10 +967,12 @@
<li>
<path>ArachnaeSwarm/Things/ARA_HiveNode/Addons/ArachnaeNode_Race_Addons_Fighter_Claw</path>
<inFrontOfBody>true</inFrontOfBody>
<scaleWithPawnDrawsize>true</scaleWithPawnDrawsize>
</li>
<li>
<path>ArachnaeSwarm/Things/ARA_HiveNode/Addons/ArachnaeNode_Race_Addons_Fighter_Tail</path>
<inFrontOfBody>false</inFrontOfBody>
<scaleWithPawnDrawsize>true</scaleWithPawnDrawsize>
<offsets>
<north>
<layerOffset>-0.275</layerOffset>
@@ -1068,12 +1037,6 @@
<baseBodySize>0.85</baseBodySize>
<baseHealthScale>2</baseHealthScale>
<lifeExpectancy>5</lifeExpectancy>
<lifeStageAges Inherit="False">
<li>
<def>ArachnaeNode_Myrmecocystus_Adult</def>
<minAge>0</minAge>
</li>
</lifeStageAges>
</race>
</AlienRace.ThingDef_AlienRace>
<AlienRace.ThingDef_AlienRace ParentName="ARA_NodeBase">
@@ -1124,12 +1087,6 @@
<baseBodySize>0.5</baseBodySize>
<baseHealthScale>0.25</baseHealthScale>
<lifeExpectancy>30</lifeExpectancy>
<lifeStageAges Inherit="False">
<li>
<def>ArachnaeNode_Myrmecocystus_Adult</def>
<minAge>0</minAge>
</li>
</lifeStageAges>
</race>
<comps>
<li Class="ArachnaeSwarm.CompProperties_HediffGiver">
@@ -1141,7 +1098,7 @@
</li>
</comps>
</AlienRace.ThingDef_AlienRace>
<AlienRace.ThingDef_AlienRace ParentName="ARA_NodeBase">
<AlienRace.ThingDef_AlienRace ParentName="ARA_NodeBase_Huge">
<defName>ArachnaeNode_Race_Smokepop</defName>
<label>阿拉克涅浓雾种</label>
<description>阿拉克涅督虫之一,。\n\n作为督虫她可以向敌人投射寿命有限但是非常恼人的阿拉克涅酸噬种辅虫以阻止敌人的远程火力开火。</description>
@@ -1175,9 +1132,6 @@
<atlasScale>4</atlasScale> -->
</alienPartGenerator>
</generalSettings>
<raceRestriction>
<onlyEatRaceRestrictedFood>true</onlyEatRaceRestrictedFood>
</raceRestriction>
</alienRace>
<comps>
</comps>
@@ -1215,12 +1169,6 @@
<baseBodySize>2.5</baseBodySize>
<baseHealthScale>4</baseHealthScale>
<lifeExpectancy>10</lifeExpectancy>
<lifeStageAges Inherit="False">
<li>
<def>ArachnaeNode_Myrmecocystus_Adult</def>
<minAge>0</minAge>
</li>
</lifeStageAges>
</race>
</AlienRace.ThingDef_AlienRace>
<AlienRace.ThingDef_AlienRace ParentName="ARA_NodeBase">
@@ -1236,10 +1184,12 @@
<li>
<path>ArachnaeSwarm/Things/ARA_HiveNode/Addons/ArachnaeNode_Race_Addons_Fighter_Claw</path>
<inFrontOfBody>true</inFrontOfBody>
<scaleWithPawnDrawsize>true</scaleWithPawnDrawsize>
</li>
<li>
<path>ArachnaeSwarm/Things/ARA_HiveNode/Addons/ArachnaeNode_Race_Addons_Fighter_Tail</path>
<inFrontOfBody>false</inFrontOfBody>
<scaleWithPawnDrawsize>true</scaleWithPawnDrawsize>
<offsets>
<north>
<layerOffset>-0.275</layerOffset>
@@ -1322,12 +1272,6 @@
<baseBodySize>0.85</baseBodySize>
<baseHealthScale>2</baseHealthScale>
<lifeExpectancy>5</lifeExpectancy>
<lifeStageAges Inherit="False">
<li>
<def>ArachnaeNode_Myrmecocystus_Adult</def>
<minAge>0</minAge>
</li>
</lifeStageAges>
</race>
</AlienRace.ThingDef_AlienRace>
</Defs>

View File

@@ -1,14 +1,10 @@
{
"Version": 1,
"WorkspaceRootPath": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\",
"WorkspaceRootPath": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|e:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\ara_buildingterrainspawn\\compdelayedterrainspawn.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:ara_buildingterrainspawn\\compdelayedterrainspawn.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|e:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\ara_buildingterrainspawn\\compproperties_delayedterrainspawn.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:ara_buildingterrainspawn\\compproperties_delayedterrainspawn.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\ara_hivemind\\compabilityeffect_binddrone.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:ara_hivemind\\compabilityeffect_binddrone.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
@@ -23,27 +19,14 @@
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "CompDelayedTerrainSpawn.cs",
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ARA_BuildingTerrainSpawn\\CompDelayedTerrainSpawn.cs",
"RelativeDocumentMoniker": "ARA_BuildingTerrainSpawn\\CompDelayedTerrainSpawn.cs",
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ARA_BuildingTerrainSpawn\\CompDelayedTerrainSpawn.cs",
"RelativeToolTip": "ARA_BuildingTerrainSpawn\\CompDelayedTerrainSpawn.cs",
"ViewState": "AgIAAAAAAAAAAAAAAADwvxcAAAAfAAAAAAAAAA==",
"Title": "CompAbilityEffect_BindDrone.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ARA_HiveMind\\CompAbilityEffect_BindDrone.cs",
"RelativeDocumentMoniker": "ARA_HiveMind\\CompAbilityEffect_BindDrone.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ARA_HiveMind\\CompAbilityEffect_BindDrone.cs",
"RelativeToolTip": "ARA_HiveMind\\CompAbilityEffect_BindDrone.cs",
"ViewState": "AgIAAAMAAAAAAAAAAAAAABEAAABkAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-09-05T11:17:51.595Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "CompProperties_DelayedTerrainSpawn.cs",
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ARA_BuildingTerrainSpawn\\CompProperties_DelayedTerrainSpawn.cs",
"RelativeDocumentMoniker": "ARA_BuildingTerrainSpawn\\CompProperties_DelayedTerrainSpawn.cs",
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ARA_BuildingTerrainSpawn\\CompProperties_DelayedTerrainSpawn.cs",
"RelativeToolTip": "ARA_BuildingTerrainSpawn\\CompProperties_DelayedTerrainSpawn.cs",
"ViewState": "AgIAAAAAAAAAAAAAAADwvwAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-09-05T11:17:48.391Z",
"WhenOpened": "2025-09-09T02:52:35.777Z",
"EditorCaption": ""
},
{

View File

@@ -0,0 +1,23 @@
using RimWorld;
using System.Collections.Generic;
using Verse;
namespace ArachnaeSwarm
{
public class HediffCompProperties_GiveHediffsInRangeToRace : HediffCompProperties
{
public float range;
public TargetingParameters targetingParameters;
public HediffDef hediff;
public ThingDef mote;
public bool hideMoteWhenNotDrafted;
public float initialSeverity = 1f;
public bool onlyPawnsInSameFaction = true;
public List<ThingDef> targetRaces; // 新增:可配置的目标种族列表
public HediffCompProperties_GiveHediffsInRangeToRace()
{
compClass = typeof(HediffComp_GiveHediffsInRangeToRace);
}
}
}

View File

@@ -0,0 +1,63 @@
using RimWorld;
using System.Collections.Generic;
using UnityEngine;
using Verse;
namespace ArachnaeSwarm
{
public class HediffComp_GiveHediffsInRangeToRace : HediffComp
{
private Mote mote;
public HediffCompProperties_GiveHediffsInRangeToRace Props => (HediffCompProperties_GiveHediffsInRangeToRace)props;
public override void CompPostTick(ref float severityAdjustment)
{
if (!parent.pawn.Awake() || parent.pawn.health == null || parent.pawn.health.InPainShock || !parent.pawn.Spawned)
{
return;
}
if (!Props.hideMoteWhenNotDrafted || parent.pawn.Drafted)
{
if (Props.mote != null && (mote == null || mote.Destroyed))
{
mote = MoteMaker.MakeAttachedOverlay(parent.pawn, Props.mote, Vector3.zero);
}
if (mote != null)
{
mote.Maintain();
}
}
IReadOnlyList<Pawn> pawns = ((!Props.onlyPawnsInSameFaction || parent.pawn.Faction == null) ? parent.pawn.Map.mapPawns.AllPawnsSpawned : parent.pawn.Map.mapPawns.SpawnedPawnsInFaction(parent.pawn.Faction));
foreach (Pawn pawn in pawns)
{
// 修改点检查种族是否在我们的目标列表中如果列表为空或null则不进行任何操作
if ((Props.targetRaces.NullOrEmpty() || !Props.targetRaces.Contains(pawn.def)) || pawn.Dead || pawn.health == null || pawn == parent.pawn || !(pawn.Position.DistanceTo(parent.pawn.Position) <= Props.range) || !Props.targetingParameters.CanTarget(pawn))
{
continue;
}
Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(Props.hediff);
if (hediff == null)
{
hediff = pawn.health.AddHediff(Props.hediff, pawn.health.hediffSet.GetBrain());
hediff.Severity = Props.initialSeverity;
HediffComp_Link hediffComp_Link = hediff.TryGetComp<HediffComp_Link>();
if (hediffComp_Link != null)
{
hediffComp_Link.drawConnection = true;
hediffComp_Link.other = parent.pawn;
}
}
HediffComp_Disappears hediffComp_Disappears = hediff.TryGetComp<HediffComp_Disappears>();
if (hediffComp_Disappears == null)
{
Log.Error("HediffComp_GiveHediffsInRangeToRace has a hediff in props which does not have a HediffComp_Disappears");
}
else
{
hediffComp_Disappears.ticksToDisappear = 5;
}
}
}
}
}

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -69,6 +68,8 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ARA_GiveHediffsInRangeToRace\HediffCompProperties_GiveHediffsInRangeToRace.cs" />
<Compile Include="ARA_GiveHediffsInRangeToRace\HediffComp_GiveHediffsInRangeToRace.cs" />
<Compile Include="ARA_SpawnPawnFromList\CompProperties_SpawnPawnFromList.cs" />
<Compile Include="ARA_SpawnPawnFromList\CompSpawnPawnFromList.cs" />
<Compile Include="ARA_SpawnPawnFromList\JobDriver_Incubate.cs" />
@@ -109,9 +110,9 @@
<Compile Include="ARA_BuildingTerrainSpawn\CompDelayedTerrainSpawn.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="WULA_AutoMechCarrier\CompAutoMechCarrier.cs" />
<Compile Include="WULA_AutoMechCarrier\CompProperties_AutoMechCarrier.cs" />
<Compile Include="WULA_AutoMechCarrier\PawnProductionEntry.cs" />
<Compile Include="ARA_AutoMechCarrier\CompAutoMechCarrier.cs" />
<Compile Include="ARA_AutoMechCarrier\CompProperties_AutoMechCarrier.cs" />
<Compile Include="ARA_AutoMechCarrier\PawnProductionEntry.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="ARA_CompInteractiveProducer\CompInteractiveProducer.cs" />
@@ -148,6 +149,9 @@
<Compile Include="Abilities\PawnFlyer_TrackingCharge.cs" />
<Compile Include="Abilities\Verb_CastAbilityTrackingCharge.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="NewFolder1\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 自定义清理任务删除obj文件夹中的临时文件 -->
<Target Name="CleanDebugFiles" AfterTargets="Build">