This commit is contained in:
2025-10-29 17:32:33 +08:00
parent e503192955
commit a3fb539bbe
9 changed files with 664 additions and 68 deletions

Binary file not shown.

View File

@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Defs>
<!-- 能力定义 -->
<AbilityDef>
<defName>ARA_SpawnFlyOverTest</defName>
<label>召唤飞越物体</label>
<description>测试召唤不同类型的飞越物体</description>
<label>母舰召唤</label>
<description>召唤虫巢母舰,启动攻击事件链(测试用)</description>
<iconPath>ArachnaeSwarm/UI/Abilities/ARA_Ability_Morph</iconPath>
<cooldownTicksRange>1</cooldownTicksRange>
<hotKey>Misc12</hotKey>
@@ -33,11 +32,10 @@
</li>
</comps>
</AbilityDef>
<!-- 能力定义 -->
<AbilityDef>
<defName>ARA_Spawn_ARA_HiveCorvette_Rocket</defName>
<label>天巫巡航:酸烧炮扫射</label>
<description>召唤天巫种兽虫,高速掠过战场,使用其迅捷天灾炮对目标区域发起打击。在飞行期间,它会使用血链棘刺炮打击遇到的敌人。</description>
<description>召唤天巫种兽虫,高速掠过战场,使用其迅捷天灾炮对目标区域发起打击。\n\n在飞行期间,它会使用血链棘刺炮打击遇到的敌人由于攻击区间较少血链棘刺炮只能打击前7个遇到的目标</description>
<iconPath>ArachnaeSwarm/UI/Abilities/ARA_Ability_Morph</iconPath>
<cooldownTicksRange>1</cooldownTicksRange>
<hotKey>Misc12</hotKey>
@@ -84,11 +82,10 @@
</li>
</comps>
</AbilityDef>
<!-- 能力定义 -->
<AbilityDef>
<defName>ARA_Spawn_ARA_HiveCorvette_Bombardment</defName>
<label>天巫攻击:酸液轰炸</label>
<description>召唤天巫种兽虫,慢速掠过战场,对大范围目标区域进行酸团轰炸。在飞行期间,它会使用血链棘刺炮打击遇到的敌人。</description>
<label>天巫巡航:酸液轰炸</label>
<description>召唤天巫种兽虫,慢速掠过战场,对大范围目标区域进行酸团轰炸。\n\n在飞行期间,它会使用血链棘刺炮打击遇到的所有敌人。</description>
<iconPath>ArachnaeSwarm/UI/Abilities/ARA_Ability_Morph</iconPath>
<cooldownTicksRange>1</cooldownTicksRange>
<hotKey>Misc12</hotKey>
@@ -106,6 +103,11 @@
</targetParams>
</verbProperties>
<comps>
<li Class="ArachnaeSwarm.CompProperties_AircraftStrike">
<requiredAircraftType>ARA_HiveCorvette_Entity</requiredAircraftType>
<aircraftCooldownTicks>120</aircraftCooldownTicks> <!-- 2天冷却 -->
<aircraftsPerUse>1</aircraftsPerUse>
</li>
<li Class="ArachnaeSwarm.CompProperties_AbilitySpawnFlyOver">
<flyOverDef>ARA_HiveCorvette_Bombardment</flyOverDef>
<flyOverType>GroundStrafing</flyOverType>

View File

@@ -1,5 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<Defs>
<ThingDef ParentName="BuildingBase">
<defName>ARA_HiveCorvette_Building</defName>
<label>天巫种兽虫</label>
<description>天巫种兽虫</description>
<thingClass>Building_PassengerShuttle</thingClass>
<preventDroppingThingsOn>true</preventDroppingThingsOn>
<altitudeLayer>Building</altitudeLayer>
<pathCost>50</pathCost>
<blockWind>true</blockWind>
<passability>PassThroughOnly</passability>
<fillPercent>0.5</fillPercent>
<size>(5,5)</size>
<drawHighlight>true</drawHighlight>
<highlightColor>(0.56, 0.62, 0.9)</highlightColor>
<uiIconScale>1</uiIconScale>
<graphicData>
<texPath>ArachnaeSwarm/FlyOverThing/ARA_HiveCorvette_Shadow</texPath>
<graphicClass>Graphic_Single</graphicClass>
<shaderType>TransparentPostLight</shaderType>
<drawSize>(5,5)</drawSize>
<color>(195,195,195,255)</color>
</graphicData>
<statBases>
<MaxHitPoints>600</MaxHitPoints>
<Flammability>0.5</Flammability>
<WorkToBuild>36000</WorkToBuild>
<Mass>125</Mass>
<Comfort>0.65</Comfort>
</statBases>
<tickerType>Normal</tickerType>
<designationCategory>ARA_Buildings</designationCategory>
<constructionSkillPrerequisite>6</constructionSkillPrerequisite>
<costList>
<Steel>250</Steel>
<Plasteel>150</Plasteel>
<ComponentIndustrial>6</ComponentIndustrial>
<ShuttleEngine>1</ShuttleEngine>
</costList>
<canOverlapZones>true</canOverlapZones>
<killedLeavings>
</killedLeavings>
<rotatable>true</rotatable>
<hasInteractionCell>false</hasInteractionCell>
<defaultPlacingRot>East</defaultPlacingRot>
<selectable>true</selectable>
<terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
<soundImpactDefault>BulletImpact_Metal</soundImpactDefault>
<preventSkyfallersLandingOn>true</preventSkyfallersLandingOn>
<drawerType>RealtimeOnly</drawerType>
<repairEffect>ConstructMetal</repairEffect>
<forceDebugSpawnable>true</forceDebugSpawnable>
<building>
<destroySound>BuildingDestroyed_Metal_Big</destroySound>
<paintable>true</paintable>
<isInert>true</isInert>
</building>
<comps>
<li Class="ArachnaeSwarm.CompProperties_AircraftHangar">
<aircraftDef>ARA_HiveCorvette_Entity</aircraftDef>
<aircraftCount>1</aircraftCount>
<skyfallerLeaving>PassengerShuttleLeaving</skyfallerLeaving>
</li>
</comps>
<placeWorkers>
<li>PlaceWorker_NotUnderRoof</li>
</placeWorkers>
<uiOrder>2600</uiOrder>
</ThingDef>
<ThingDef>
<defName>ARA_HiveCorvette_Entity</defName>
<label>天巫种兽虫</label>
<description>什么这是个记录数量用的thingdef你不应该在任何场合下看到这个。</description>
</ThingDef>
<ThingDef Parent="EtherealThingBase">
<defName>ARA_HiveShip</defName>
<label>虫巢母舰</label>

View File

@@ -1,41 +1,57 @@
{
"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\\flyover\\ara_sectorsurveillance\\compsectorsurveillance.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\\flyover\\ara_aircrafthangar\\worldcomponent_aircraftmanager.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:flyover\\ara_aircrafthangar\\worldcomponent_aircraftmanager.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\\flyover\\ara_aircrafthangar\\compaircrafthangar.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:flyover\\ara_aircrafthangar\\compaircrafthangar.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\\flyover\\ara_aircrafthangar\\compabilityeffect_aircraftstrike.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:flyover\\ara_aircrafthangar\\compabilityeffect_aircraftstrike.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\\building_comps\\comprefuelablenutrition.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:building_comps\\comprefuelablenutrition.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\\flyover\\ara_sectorsurveillance\\compsectorsurveillance.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:flyover\\ara_sectorsurveillance\\compsectorsurveillance.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\\flyover\\ara_groundstrafing\\compgroundstrafing.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:flyover\\ara_groundstrafing\\compgroundstrafing.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\\flyover\\thingclassflyover.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\\flyover\\thingclassflyover.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:flyover\\thingclassflyover.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\\flyover\\ara_spawnflyover\\compabilityeffect_spawnflyover.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\\flyover\\ara_spawnflyover\\compabilityeffect_spawnflyover.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:flyover\\ara_spawnflyover\\compabilityeffect_spawnflyover.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\\flyover\\ara_spawnflyover\\compproperties_abilityspawnflyover.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\\flyover\\ara_spawnflyover\\compproperties_abilityspawnflyover.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:flyover\\ara_spawnflyover\\compproperties_abilityspawnflyover.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\\flyover\\ara_flyoverescort\\compflyoverescort.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\\flyover\\ara_groundstrafing\\compgroundstrafing.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:flyover\\ara_groundstrafing\\compgroundstrafing.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\\flyover\\ara_flyoverescort\\compflyoverescort.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:flyover\\ara_flyoverescort\\compflyoverescort.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\\flyover\\ara_flyoverescort\\compproperties_flyoverescort.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\\flyover\\ara_flyoverescort\\compproperties_flyoverescort.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:flyover\\ara_flyoverescort\\compproperties_flyoverescort.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\\flyover\\ara_shipartillery\\compshipartillery.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\\flyover\\ara_shipartillery\\compshipartillery.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:flyover\\ara_shipartillery\\compshipartillery.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\\flyover\\ara_shipartillery\\compproperties_shipartillery.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\\flyover\\ara_shipartillery\\compproperties_shipartillery.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:flyover\\ara_shipartillery\\compproperties_shipartillery.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
@@ -46,81 +62,135 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"SelectedChildIndex": 4,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "CompAircraftHangar.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_AircraftHangar\\CompAircraftHangar.cs",
"RelativeDocumentMoniker": "Flyover\\ARA_AircraftHangar\\CompAircraftHangar.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_AircraftHangar\\CompAircraftHangar.cs",
"RelativeToolTip": "Flyover\\ARA_AircraftHangar\\CompAircraftHangar.cs",
"ViewState": "AgIAAEoAAAAAAAAAAAAswFkAAAAdAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-10-29T06:31:52.619Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "CompRefuelableNutrition.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Building_Comps\\CompRefuelableNutrition.cs",
"RelativeDocumentMoniker": "Building_Comps\\CompRefuelableNutrition.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Building_Comps\\CompRefuelableNutrition.cs",
"RelativeToolTip": "Building_Comps\\CompRefuelableNutrition.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAUAAAAXAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-10-29T06:31:46.148Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "CompAbilityEffect_AircraftStrike.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_AircraftHangar\\CompAbilityEffect_AircraftStrike.cs",
"RelativeDocumentMoniker": "Flyover\\ARA_AircraftHangar\\CompAbilityEffect_AircraftStrike.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_AircraftHangar\\CompAbilityEffect_AircraftStrike.cs",
"RelativeToolTip": "Flyover\\ARA_AircraftHangar\\CompAbilityEffect_AircraftStrike.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAACMAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-10-29T06:30:49.523Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "WorldComponent_AircraftManager.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_AircraftHangar\\WorldComponent_AircraftManager.cs",
"RelativeDocumentMoniker": "Flyover\\ARA_AircraftHangar\\WorldComponent_AircraftManager.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_AircraftHangar\\WorldComponent_AircraftManager.cs",
"RelativeToolTip": "Flyover\\ARA_AircraftHangar\\WorldComponent_AircraftManager.cs",
"ViewState": "AgIAAKsAAAAAAAAAAAAowBEAAAASAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-10-29T06:30:44.854Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "CompSectorSurveillance.cs",
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_SectorSurveillance\\CompSectorSurveillance.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_SectorSurveillance\\CompSectorSurveillance.cs",
"RelativeDocumentMoniker": "Flyover\\ARA_SectorSurveillance\\CompSectorSurveillance.cs",
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_SectorSurveillance\\CompSectorSurveillance.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_SectorSurveillance\\CompSectorSurveillance.cs",
"RelativeToolTip": "Flyover\\ARA_SectorSurveillance\\CompSectorSurveillance.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAACwCAAAOAAAAAAAAAA==",
"ViewState": "AgIAAMYAAAAAAAAAAAAqwNUAAAARAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-10-29T02:30:42.063Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"DocumentIndex": 8,
"Title": "CompGroundStrafing.cs",
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_GroundStrafing\\CompGroundStrafing.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_GroundStrafing\\CompGroundStrafing.cs",
"RelativeDocumentMoniker": "Flyover\\ARA_GroundStrafing\\CompGroundStrafing.cs",
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_GroundStrafing\\CompGroundStrafing.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_GroundStrafing\\CompGroundStrafing.cs",
"RelativeToolTip": "Flyover\\ARA_GroundStrafing\\CompGroundStrafing.cs",
"ViewState": "AgIAAB0AAAAAAAAAAAAQwCYAAABFAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-10-28T16:19:23.118Z",
"WhenOpened": "2025-10-28T16:19:23.118Z"
},
{
"$type": "Document",
"DocumentIndex": 6,
"Title": "CompAbilityEffect_SpawnFlyOver.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_SpawnFlyOver\\CompAbilityEffect_SpawnFlyOver.cs",
"RelativeDocumentMoniker": "Flyover\\ARA_SpawnFlyOver\\CompAbilityEffect_SpawnFlyOver.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_SpawnFlyOver\\CompAbilityEffect_SpawnFlyOver.cs",
"RelativeToolTip": "Flyover\\ARA_SpawnFlyOver\\CompAbilityEffect_SpawnFlyOver.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABYAAABOAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-10-28T14:51:14.836Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "CompAbilityEffect_SpawnFlyOver.cs",
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_SpawnFlyOver\\CompAbilityEffect_SpawnFlyOver.cs",
"RelativeDocumentMoniker": "Flyover\\ARA_SpawnFlyOver\\CompAbilityEffect_SpawnFlyOver.cs",
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_SpawnFlyOver\\CompAbilityEffect_SpawnFlyOver.cs",
"RelativeToolTip": "Flyover\\ARA_SpawnFlyOver\\CompAbilityEffect_SpawnFlyOver.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABYAAABOAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-10-28T14:51:14.836Z"
},
{
"$type": "Document",
"DocumentIndex": 4,
"DocumentIndex": 7,
"Title": "CompProperties_AbilitySpawnFlyOver.cs",
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_SpawnFlyOver\\CompProperties_AbilitySpawnFlyOver.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_SpawnFlyOver\\CompProperties_AbilitySpawnFlyOver.cs",
"RelativeDocumentMoniker": "Flyover\\ARA_SpawnFlyOver\\CompProperties_AbilitySpawnFlyOver.cs",
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_SpawnFlyOver\\CompProperties_AbilitySpawnFlyOver.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_SpawnFlyOver\\CompProperties_AbilitySpawnFlyOver.cs",
"RelativeToolTip": "Flyover\\ARA_SpawnFlyOver\\CompProperties_AbilitySpawnFlyOver.cs",
"ViewState": "AgIAABgAAAAAAAAAAAAswDQAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-10-28T13:51:12.201Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "ThingclassFlyOver.cs",
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ThingclassFlyOver.cs",
"RelativeDocumentMoniker": "Flyover\\ThingclassFlyOver.cs",
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ThingclassFlyOver.cs",
"RelativeToolTip": "Flyover\\ThingclassFlyOver.cs",
"ViewState": "AgIAAAkCAAAAAAAAAAAqwCYCAAB/AAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-10-28T09:09:22.03Z"
"WhenOpened": "2025-10-28T13:51:12.201Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 5,
"Title": "ThingclassFlyOver.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ThingclassFlyOver.cs",
"RelativeDocumentMoniker": "Flyover\\ThingclassFlyOver.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ThingclassFlyOver.cs",
"RelativeToolTip": "Flyover\\ThingclassFlyOver.cs",
"ViewState": "AgIAAAkCAAAAAAAAAAAqwCYCAAB/AAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-10-28T09:09:22.03Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 9,
"Title": "CompFlyOverEscort.cs",
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_FlyOverEscort\\CompFlyOverEscort.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_FlyOverEscort\\CompFlyOverEscort.cs",
"RelativeDocumentMoniker": "Flyover\\ARA_FlyOverEscort\\CompFlyOverEscort.cs",
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_FlyOverEscort\\CompFlyOverEscort.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_FlyOverEscort\\CompFlyOverEscort.cs",
"RelativeToolTip": "Flyover\\ARA_FlyOverEscort\\CompFlyOverEscort.cs",
"ViewState": "AgIAAKYBAAAAAAAAAAAWwNEBAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
@@ -128,11 +198,11 @@
},
{
"$type": "Document",
"DocumentIndex": 6,
"DocumentIndex": 10,
"Title": "CompProperties_FlyOverEscort.cs",
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_FlyOverEscort\\CompProperties_FlyOverEscort.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_FlyOverEscort\\CompProperties_FlyOverEscort.cs",
"RelativeDocumentMoniker": "Flyover\\ARA_FlyOverEscort\\CompProperties_FlyOverEscort.cs",
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_FlyOverEscort\\CompProperties_FlyOverEscort.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_FlyOverEscort\\CompProperties_FlyOverEscort.cs",
"RelativeToolTip": "Flyover\\ARA_FlyOverEscort\\CompProperties_FlyOverEscort.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABgAAAAPAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
@@ -140,11 +210,11 @@
},
{
"$type": "Document",
"DocumentIndex": 8,
"DocumentIndex": 12,
"Title": "CompProperties_ShipArtillery.cs",
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_ShipArtillery\\CompProperties_ShipArtillery.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_ShipArtillery\\CompProperties_ShipArtillery.cs",
"RelativeDocumentMoniker": "Flyover\\ARA_ShipArtillery\\CompProperties_ShipArtillery.cs",
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_ShipArtillery\\CompProperties_ShipArtillery.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_ShipArtillery\\CompProperties_ShipArtillery.cs",
"RelativeToolTip": "Flyover\\ARA_ShipArtillery\\CompProperties_ShipArtillery.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAA8AAAAhAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
@@ -152,11 +222,11 @@
},
{
"$type": "Document",
"DocumentIndex": 7,
"DocumentIndex": 11,
"Title": "CompShipArtillery.cs",
"DocumentMoniker": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_ShipArtillery\\CompShipArtillery.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_ShipArtillery\\CompShipArtillery.cs",
"RelativeDocumentMoniker": "Flyover\\ARA_ShipArtillery\\CompShipArtillery.cs",
"ToolTip": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_ShipArtillery\\CompShipArtillery.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Flyover\\ARA_ShipArtillery\\CompShipArtillery.cs",
"RelativeToolTip": "Flyover\\ARA_ShipArtillery\\CompShipArtillery.cs",
"ViewState": "AgIAALEAAAAAAAAAAAAywNEAAABcAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",

View File

@@ -138,6 +138,9 @@
<Compile Include="EventSystem\EventVariableManager.cs" />
<Compile Include="EventSystem\Letter_EventChoice.cs" />
<Compile Include="EventSystem\QuestNode_Root_EventLetter.cs" />
<Compile Include="Flyover\ARA_AircraftHangar\CompAbilityEffect_AircraftStrike.cs" />
<Compile Include="Flyover\ARA_AircraftHangar\CompAircraftHangar.cs" />
<Compile Include="Flyover\ARA_AircraftHangar\WorldComponent_AircraftManager.cs" />
<Compile Include="Flyover\ARA_FlyOverEscort\CompFlyOverEscort.cs" />
<Compile Include="Flyover\ARA_FlyOverEscort\CompProperties_FlyOverEscort.cs" />
<Compile Include="Flyover\ARA_GroundStrafing\CompGroundStrafing.cs" />

View File

@@ -0,0 +1,90 @@
using RimWorld;
using Verse;
using RimWorld.Planet;
using System.Collections.Generic;
namespace ArachnaeSwarm
{
public class CompProperties_AircraftStrike : CompProperties_AbilityEffect
{
public ThingDef requiredAircraftType; // 需要的战机类型
public int aircraftCooldownTicks = 60000; // 战机冷却时间默认1天
public int aircraftsPerUse = 1; // 每次使用消耗的战机数量
public CompProperties_AircraftStrike()
{
compClass = typeof(CompAbilityEffect_AircraftStrike);
}
}
public class CompAbilityEffect_AircraftStrike : CompAbilityEffect
{
public new CompProperties_AircraftStrike Props => (CompProperties_AircraftStrike)props;
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
{
base.Apply(target, dest);
// 获取全局战机管理器
WorldComponent_AircraftManager aircraftManager = Find.World.GetComponent<WorldComponent_AircraftManager>();
if (aircraftManager == null)
{
Log.Error("Aircraft manager not found!");
return;
}
// 检查并消耗战机
if (aircraftManager.TryUseAircraft(Props.requiredAircraftType, Props.aircraftsPerUse, parent.pawn.Faction, Props.aircraftCooldownTicks))
{
// 执行打击效果
ExecuteStrikeEffect(target);
Messages.Message($"Aircraft strike initiated: {Props.requiredAircraftType.LabelCap}", MessageTypeDefOf.PositiveEvent);
}
else
{
Messages.Message($"No available aircraft: {Props.requiredAircraftType.LabelCap}", MessageTypeDefOf.NegativeEvent);
}
}
private void ExecuteStrikeEffect(LocalTargetInfo target)
{
// 这里实现具体的打击效果
// 例如:轰炸、空投、侦察等
// 示例:在目标位置创建爆炸效果
GenExplosion.DoExplosion(
target.Cell,
parent.pawn.Map,
radius: 3.5f,
DamageDefOf.Bomb,
instigator: parent.pawn,
damAmount: 50
);
}
public override bool CanApplyOn(LocalTargetInfo target, LocalTargetInfo dest)
{
// 检查是否有可用的战机
WorldComponent_AircraftManager aircraftManager = Find.World.GetComponent<WorldComponent_AircraftManager>();
return base.CanApplyOn(target, dest) &&
aircraftManager != null &&
aircraftManager.HasAvailableAircraft(Props.requiredAircraftType, Props.aircraftsPerUse, parent.pawn.Faction);
}
public override string ExtraLabelMouseAttachment(LocalTargetInfo target)
{
WorldComponent_AircraftManager aircraftManager = Find.World.GetComponent<WorldComponent_AircraftManager>();
if (aircraftManager != null)
{
int available = aircraftManager.GetAvailableAircraftCount(Props.requiredAircraftType, parent.pawn.Faction);
return $"Available {Props.requiredAircraftType.LabelCap}: {available}";
}
return base.ExtraLabelMouseAttachment(target);
}
}
}

View File

@@ -0,0 +1,99 @@
using RimWorld;
using Verse;
using System.Collections.Generic;
using RimWorld.Planet;
namespace ArachnaeSwarm
{
public class CompProperties_AircraftHangar : CompProperties
{
public ThingDef aircraftDef; // 对应的战机定义
public int aircraftCount = 1; // 起飞后提供的战机数量
public ThingDef skyfallerLeaving; // 起飞时的天空坠落者效果
public CompProperties_AircraftHangar()
{
compClass = typeof(CompAircraftHangar);
}
}
public class CompAircraftHangar : ThingComp
{
public CompProperties_AircraftHangar Props => (CompProperties_AircraftHangar)props;
public override IEnumerable<Gizmo> CompGetGizmosExtra()
{
foreach (Gizmo gizmo in base.CompGetGizmosExtra())
{
yield return gizmo;
}
// 起飞命令
Command_Action launchCommand = new Command_Action
{
defaultLabel = "Launch Aircraft",
defaultDesc = "Launch aircraft for orbital support",
icon = TexCommand.Attack,
action = LaunchAircraft
};
// 检查条件:建筑完好
if (parent.HitPoints <= 0)
{
launchCommand.Disable("Hangar damaged");
}
yield return launchCommand;
}
private void LaunchAircraft()
{
// 获取全局战机管理器
WorldComponent_AircraftManager aircraftManager = Find.World.GetComponent<WorldComponent_AircraftManager>();
if (aircraftManager == null)
{
Log.Error("Aircraft manager not found!");
return;
}
// 立即向全局管理器注册战机(在创建 Skyfaller 之前)
aircraftManager.AddAircraft(Props.aircraftDef, Props.aircraftCount, parent.Faction);
// 显示消息
Messages.Message($"Aircraft launched: {Props.aircraftCount}x {Props.aircraftDef.LabelCap}", MessageTypeDefOf.PositiveEvent);
// 创建起飞效果(仅视觉效果)
if (Props.skyfallerLeaving != null)
{
CreateTakeoffEffect();
}
else
{
// 如果没有定义 Skyfaller直接销毁建筑
parent.Destroy();
}
}
private void CreateTakeoffEffect()
{
// 创建起飞天空坠落者
Skyfaller skyfaller = SkyfallerMaker.MakeSkyfaller(Props.skyfallerLeaving, parent);
// 设置起飞位置(建筑当前位置)
IntVec3 takeoffPos = parent.Position;
// 生成 Skyfaller
GenSpawn.Spawn(skyfaller, takeoffPos, parent.Map);
// 立即销毁原建筑Skyfaller 只是视觉效果)
parent.Destroy();
}
public override void PostExposeData()
{
base.PostExposeData();
// 不需要保存状态,因为建筑起飞后就销毁了
}
}
}

View File

@@ -0,0 +1,258 @@
using RimWorld;
using Verse;
using System.Collections.Generic;
using RimWorld.Planet;
using System.Linq;
namespace ArachnaeSwarm
{
public class WorldComponent_AircraftManager : WorldComponent
{
private Dictionary<Faction, Dictionary<ThingDef, AircraftFactionData>> factionAircraftData =
new Dictionary<Faction, Dictionary<ThingDef, AircraftFactionData>>();
private List<AircraftCooldownEvent> cooldownEvents = new List<AircraftCooldownEvent>();
public WorldComponent_AircraftManager(World world) : base(world) { }
// 战机派系数据类
private class AircraftFactionData : IExposable
{
public int totalCount; // 总战机数量
public int availableCount; // 可用战机数量
public void ExposeData()
{
Scribe_Values.Look(ref totalCount, "totalCount");
Scribe_Values.Look(ref availableCount, "availableCount");
}
}
// 冷却事件类
private class AircraftCooldownEvent : IExposable
{
public Faction faction;
public ThingDef aircraftDef;
public int endTick;
public int aircraftCount; // 冷却中的战机数量
public void ExposeData()
{
Scribe_References.Look(ref faction, "faction");
Scribe_Defs.Look(ref aircraftDef, "aircraftDef");
Scribe_Values.Look(ref endTick, "endTick");
Scribe_Values.Look(ref aircraftCount, "aircraftCount");
}
}
// 用于序列化的包装类
private class SerializableFactionAircraftData : IExposable
{
public Faction faction;
public ThingDef aircraftDef;
public AircraftFactionData data;
public void ExposeData()
{
Scribe_References.Look(ref faction, "faction");
Scribe_Defs.Look(ref aircraftDef, "aircraftDef");
Scribe_Deep.Look(ref data, "data");
}
}
public override void ExposeData()
{
base.ExposeData();
// 保存派系战机数据
List<SerializableFactionAircraftData> serializableData = new List<SerializableFactionAircraftData>();
if (Scribe.mode == LoadSaveMode.Saving)
{
// 将字典数据转换为可序列化的列表
foreach (var factionPair in factionAircraftData)
{
foreach (var aircraftPair in factionPair.Value)
{
serializableData.Add(new SerializableFactionAircraftData
{
faction = factionPair.Key,
aircraftDef = aircraftPair.Key,
data = aircraftPair.Value
});
}
}
}
Scribe_Collections.Look(ref serializableData, "factionAircraftData", LookMode.Deep);
if (Scribe.mode == LoadSaveMode.LoadingVars)
{
// 从序列化数据重建字典
factionAircraftData.Clear();
if (serializableData != null)
{
foreach (var item in serializableData)
{
if (item.faction != null && item.aircraftDef != null && item.data != null)
{
if (!factionAircraftData.ContainsKey(item.faction))
{
factionAircraftData[item.faction] = new Dictionary<ThingDef, AircraftFactionData>();
}
factionAircraftData[item.faction][item.aircraftDef] = item.data;
}
}
}
}
// 保存冷却事件 - 显式指定泛型类型
Scribe_Collections.Look(ref cooldownEvents, "cooldownEvents", LookMode.Deep);
}
public override void WorldComponentTick()
{
base.WorldComponentTick();
// 处理冷却事件
int currentTick = Find.TickManager.TicksAbs;
for (int i = cooldownEvents.Count - 1; i >= 0; i--)
{
AircraftCooldownEvent cooldownEvent = cooldownEvents[i];
if (currentTick >= cooldownEvent.endTick)
{
// 冷却结束,恢复战机可用性
RestoreAircraftAfterCooldown(cooldownEvent);
cooldownEvents.RemoveAt(i);
}
}
}
// 添加战机到派系
public void AddAircraft(ThingDef aircraftDef, int count, Faction faction)
{
if (faction == null)
{
Log.Error("Attempted to add aircraft to null faction");
return;
}
if (!factionAircraftData.ContainsKey(faction))
{
factionAircraftData[faction] = new Dictionary<ThingDef, AircraftFactionData>();
}
if (!factionAircraftData[faction].ContainsKey(aircraftDef))
{
factionAircraftData[faction][aircraftDef] = new AircraftFactionData();
}
var data = factionAircraftData[faction][aircraftDef];
data.totalCount += count;
data.availableCount += count;
}
// 尝试使用战机
public bool TryUseAircraft(ThingDef aircraftDef, int count, Faction faction, int cooldownTicks)
{
if (!HasAvailableAircraft(aircraftDef, count, faction))
return false;
var data = factionAircraftData[faction][aircraftDef];
data.availableCount -= count;
// 创建冷却事件
AircraftCooldownEvent cooldownEvent = new AircraftCooldownEvent
{
faction = faction,
aircraftDef = aircraftDef,
endTick = Find.TickManager.TicksAbs + cooldownTicks,
aircraftCount = count
};
cooldownEvents.Add(cooldownEvent);
return true;
}
// 检查是否有可用战机
public bool HasAvailableAircraft(ThingDef aircraftDef, int count, Faction faction)
{
return factionAircraftData.ContainsKey(faction) &&
factionAircraftData[faction].ContainsKey(aircraftDef) &&
factionAircraftData[faction][aircraftDef].availableCount >= count;
}
// 获取可用战机数量
public int GetAvailableAircraftCount(ThingDef aircraftDef, Faction faction)
{
if (factionAircraftData.ContainsKey(faction) &&
factionAircraftData[faction].ContainsKey(aircraftDef))
{
return factionAircraftData[faction][aircraftDef].availableCount;
}
return 0;
}
// 获取总战机数量
public int GetTotalAircraftCount(ThingDef aircraftDef, Faction faction)
{
if (factionAircraftData.ContainsKey(faction) &&
factionAircraftData[faction].ContainsKey(aircraftDef))
{
return factionAircraftData[faction][aircraftDef].totalCount;
}
return 0;
}
// 冷却结束后恢复战机
private void RestoreAircraftAfterCooldown(AircraftCooldownEvent cooldownEvent)
{
if (cooldownEvent.faction != null &&
factionAircraftData.ContainsKey(cooldownEvent.faction) &&
factionAircraftData[cooldownEvent.faction].ContainsKey(cooldownEvent.aircraftDef))
{
var data = factionAircraftData[cooldownEvent.faction][cooldownEvent.aircraftDef];
data.availableCount += cooldownEvent.aircraftCount;
// 可选:显示冷却结束消息
if (cooldownEvent.aircraftDef != null)
{
Messages.Message($"{cooldownEvent.aircraftDef.LabelCap} cooldown ended", MessageTypeDefOf.PositiveEvent);
}
}
}
// 获取战机状态信息用于调试或UI显示
public string GetAircraftStatus(Faction faction)
{
if (!factionAircraftData.ContainsKey(faction))
return "No aircraft";
var status = new List<string>();
foreach (var kvp in factionAircraftData[faction])
{
var data = kvp.Value;
int inCooldown = data.totalCount - data.availableCount;
status.Add($"{kvp.Key.LabelCap}: {data.availableCount}/{data.totalCount} (In cooldown: {inCooldown})");
}
return string.Join("\n", status);
}
// 获取冷却中的战机数量
public int GetCooldownAircraftCount(ThingDef aircraftDef, Faction faction)
{
int totalCooldown = 0;
foreach (var cooldownEvent in cooldownEvents)
{
if (cooldownEvent.faction == faction && cooldownEvent.aircraftDef == aircraftDef)
{
totalCooldown += cooldownEvent.aircraftCount;
}
}
return totalCooldown;
}
}
}