This commit is contained in:
2025-09-29 17:58:56 +08:00
parent a611a400cc
commit ed3f9a6b32
14 changed files with 1017 additions and 417 deletions

View File

@@ -1,7 +1,16 @@
{
"Version": 1,
"WorkspaceRootPath": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\",
"Documents": [],
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\abilities\\ara_destroyownbodypart\\compabilityeffect_destroyownbodypart.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:abilities\\ara_destroyownbodypart\\compabilityeffect_destroyownbodypart.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\\abilities\\ara_destroyownbodypart\\compproperties_abilitydestroyownbodypart.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:abilities\\ara_destroyownbodypart\\compproperties_abilitydestroyownbodypart.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
@@ -9,11 +18,36 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": -1,
"SelectedChildIndex": 2,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "CompProperties_AbilityDestroyOwnBodyPart.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_DestroyOwnBodyPart\\CompProperties_AbilityDestroyOwnBodyPart.cs",
"RelativeDocumentMoniker": "Abilities\\ARA_DestroyOwnBodyPart\\CompProperties_AbilityDestroyOwnBodyPart.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_DestroyOwnBodyPart\\CompProperties_AbilityDestroyOwnBodyPart.cs",
"RelativeToolTip": "Abilities\\ARA_DestroyOwnBodyPart\\CompProperties_AbilityDestroyOwnBodyPart.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-09-28T08:57:43.206Z"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "CompAbilityEffect_DestroyOwnBodyPart.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_DestroyOwnBodyPart\\CompAbilityEffect_DestroyOwnBodyPart.cs",
"RelativeDocumentMoniker": "Abilities\\ARA_DestroyOwnBodyPart\\CompAbilityEffect_DestroyOwnBodyPart.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_DestroyOwnBodyPart\\CompAbilityEffect_DestroyOwnBodyPart.cs",
"RelativeToolTip": "Abilities\\ARA_DestroyOwnBodyPart\\CompAbilityEffect_DestroyOwnBodyPart.cs",
"ViewState": "AgIAADUAAAAAAAAAAAAzwDkAAAAcAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-09-28T08:57:31.224Z",
"EditorCaption": ""
}
]
}

View File

@@ -30,6 +30,41 @@ namespace ArachnaeSwarm
}
}
public override bool GizmoDisabled(out string reason)
{
Pawn caster = parent.pawn;
if (caster == null || caster.Dead)
{
reason = "CasterDead".Translate();
return true;
}
List<BodyPartRecord> partsToDestroy = GetBodyPartsToDestroy(caster);
if (partsToDestroy.Count == 0)
{
reason = "NoValidBodyParts".Translate();
return true;
}
reason = null;
return false;
}
// 在能力描述中显示会破坏的部位
public override string ExtraLabelMouseAttachment(LocalTargetInfo target)
{
Pawn caster = parent.pawn;
if (caster == null || caster.Dead)
return null;
List<BodyPartRecord> partsToDestroy = GetBodyPartsToDestroy(caster);
if (partsToDestroy.Count == 0)
return null;
string partsText = GetBodyPartNames(partsToDestroy);
return "WillDestroyBodyPart".Translate(partsText);
}
// 获取要破坏的身体部位列表
private List<BodyPartRecord> GetBodyPartsToDestroy(Pawn pawn)
{
@@ -58,5 +93,29 @@ namespace ArachnaeSwarm
// 直接添加缺失部位hediff
pawn.health.AddHediff(HediffDefOf.MissingBodyPart, part);
}
// 获取身体部位名称列表
private string GetBodyPartNames(List<BodyPartRecord> parts)
{
if (parts.Count == 0)
return "";
if (parts.Count == 1)
return parts[0].Label;
string result = "";
for (int i = 0; i < parts.Count; i++)
{
if (i > 0)
{
if (i == parts.Count - 1)
result += " and ";
else
result += ", ";
}
result += parts[i].Label;
}
return result;
}
}
}