This commit is contained in:
2025-09-28 23:32:13 +08:00
15 changed files with 818 additions and 112 deletions

View File

@@ -1,32 +1,7 @@
{
"Version": 1,
"WorkspaceRootPath": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\abilities\\ara_showtemperaturerange\\compabilityeffect_abilityshowtemperaturerange.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:abilities\\ara_showtemperaturerange\\compabilityeffect_abilityshowtemperaturerange.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_hediffdefof.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:ara_hediffdefof.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\\mainharmony.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:mainharmony.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\\supercarryextension.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:supercarryextension.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\\floatmenuoptionprovider_supercarry.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:floatmenuoptionprovider_supercarry.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\\jobdriver_supercarry.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:jobdriver_supercarry.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"Documents": [],
"DocumentGroupContainers": [
{
"Orientation": 0,
@@ -34,84 +9,11 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"SelectedChildIndex": -1,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "CompAbilityEffect_AbilityShowTemperatureRange.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_ShowTemperatureRange\\CompAbilityEffect_AbilityShowTemperatureRange.cs",
"RelativeDocumentMoniker": "Abilities\\ARA_ShowTemperatureRange\\CompAbilityEffect_AbilityShowTemperatureRange.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_ShowTemperatureRange\\CompAbilityEffect_AbilityShowTemperatureRange.cs",
"RelativeToolTip": "Abilities\\ARA_ShowTemperatureRange\\CompAbilityEffect_AbilityShowTemperatureRange.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAkAAAA9AAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-09-27T08:23:51.83Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "ARA_HediffDefOf.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ARA_HediffDefOf.cs",
"RelativeDocumentMoniker": "ARA_HediffDefOf.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ARA_HediffDefOf.cs",
"RelativeToolTip": "ARA_HediffDefOf.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAA4AAAAJAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-09-27T03:14:05.334Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "MainHarmony.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\MainHarmony.cs",
"RelativeDocumentMoniker": "MainHarmony.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\MainHarmony.cs",
"RelativeToolTip": "MainHarmony.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-09-27T03:13:34.632Z"
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "SuperCarryExtension.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\SuperCarryExtension.cs",
"RelativeDocumentMoniker": "SuperCarryExtension.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\SuperCarryExtension.cs",
"RelativeToolTip": "SuperCarryExtension.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-09-27T03:13:32.751Z"
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "FloatMenuOptionProvider_SuperCarry.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\FloatMenuOptionProvider_SuperCarry.cs",
"RelativeDocumentMoniker": "FloatMenuOptionProvider_SuperCarry.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\FloatMenuOptionProvider_SuperCarry.cs",
"RelativeToolTip": "FloatMenuOptionProvider_SuperCarry.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-09-27T03:13:31.262Z"
},
{
"$type": "Document",
"DocumentIndex": 5,
"Title": "JobDriver_SuperCarry.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\JobDriver_SuperCarry.cs",
"RelativeDocumentMoniker": "JobDriver_SuperCarry.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\JobDriver_SuperCarry.cs",
"RelativeToolTip": "JobDriver_SuperCarry.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-09-27T03:13:30.358Z"
}
]
}

View File

@@ -0,0 +1,62 @@
using RimWorld;
using System.Collections.Generic;
using System.Linq;
using Verse;
namespace ArachnaeSwarm
{
public class CompAbilityEffect_DestroyOwnBodyPart : CompAbilityEffect
{
public new CompProperties_AbilityDestroyOwnBodyPart Props => (CompProperties_AbilityDestroyOwnBodyPart)props;
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
{
base.Apply(target, dest);
Pawn caster = parent.pawn;
if (caster == null || caster.Dead)
return;
// 获取要破坏的身体部位
List<BodyPartRecord> partsToDestroy = GetBodyPartsToDestroy(caster);
if (partsToDestroy.Count == 0)
return;
// 对每个部位执行破坏
foreach (BodyPartRecord part in partsToDestroy)
{
DestroyBodyPart(caster, part);
}
}
// 获取要破坏的身体部位列表
private List<BodyPartRecord> GetBodyPartsToDestroy(Pawn pawn)
{
List<BodyPartRecord> validParts = new List<BodyPartRecord>();
// 获取指定的身体部位
foreach (BodyPartDef partDef in Props.bodyPartsToDestroy)
{
var parts = pawn.RaceProps.body.GetPartsWithDef(partDef);
foreach (BodyPartRecord part in parts)
{
// 检查部位是否已经缺失
if (!pawn.health.hediffSet.PartIsMissing(part))
{
validParts.Add(part);
}
}
}
return validParts;
}
// 实际执行身体部位的破坏
private void DestroyBodyPart(Pawn pawn, BodyPartRecord part)
{
// 直接添加缺失部位hediff
pawn.health.AddHediff(HediffDefOf.MissingBodyPart, part);
}
}
}

View File

@@ -0,0 +1,17 @@
using RimWorld;
using System.Collections.Generic;
using Verse;
namespace ArachnaeSwarm
{
public class CompProperties_AbilityDestroyOwnBodyPart : CompProperties_AbilityEffect
{
// 要破坏的身体部位列表
public List<BodyPartDef> bodyPartsToDestroy;
public CompProperties_AbilityDestroyOwnBodyPart()
{
compClass = typeof(CompAbilityEffect_DestroyOwnBodyPart);
}
}
}

View File

@@ -0,0 +1,146 @@
using RimWorld;
using Verse;
namespace ArachnaeSwarm
{
public class CompAbilityEffect_HediffRestriction : CompAbilityEffect
{
public new CompProperties_AbilityHediffRestriction Props => (CompProperties_AbilityHediffRestriction)props;
// 检查能力是否可用
public override bool GizmoDisabled(out string reason)
{
if (!IsTargetValid(null)) // 对Gizmo检查没有具体目标
{
reason = Props.disabledReasonKey.Translate(GetHediffList());
return true;
}
reason = null;
return false;
}
// 验证目标是否有效
public override bool Valid(LocalTargetInfo target, bool throwMessages = false)
{
if (!base.Valid(target, throwMessages))
return false;
// 检查目标hediff条件
if (!IsTargetValid(target))
{
if (throwMessages)
{
Messages.Message(Props.targetHediffFailMessage.Translate(GetHediffList()), parent.pawn, MessageTypeDefOf.RejectInput, historical: false);
}
return false;
}
return true;
}
// 应用效果前的最终验证
public override bool CanApplyOn(LocalTargetInfo target, LocalTargetInfo dest)
{
if (!IsTargetValid(target))
{
Messages.Message(Props.targetHediffFailMessage.Translate(GetHediffList()), parent.pawn, MessageTypeDefOf.RejectInput, historical: false);
return false;
}
return base.CanApplyOn(target, dest);
}
// 检查目标是否满足hediff条件
private bool IsTargetValid(LocalTargetInfo target)
{
// 如果目标不是pawn始终允许如地面、物品等
Pawn targetPawn = target.Thing as Pawn;
if (targetPawn == null)
return true;
// 检查必须有的hediff
if (Props.requiredHediff != null)
{
if (!targetPawn.health.hediffSet.HasHediff(Props.requiredHediff))
return false;
}
// 检查禁止的hediff
if (Props.forbiddenHediff != null)
{
if (targetPawn.health.hediffSet.HasHediff(Props.forbiddenHediff))
return false;
}
// 检查必须有的hediff列表
if (Props.requiredHediffs != null && Props.requiredHediffs.Count > 0)
{
bool hasAnyRequired = false;
foreach (var hediff in Props.requiredHediffs)
{
if (targetPawn.health.hediffSet.HasHediff(hediff))
{
hasAnyRequired = true;
break;
}
}
if (!hasAnyRequired)
return false;
}
// 检查禁止的hediff列表
if (Props.forbiddenHediffs != null && Props.forbiddenHediffs.Count > 0)
{
foreach (var hediff in Props.forbiddenHediffs)
{
if (targetPawn.health.hediffSet.HasHediff(hediff))
return false;
}
}
return true;
}
// 获取hediff列表的字符串表示
private string GetHediffList()
{
string hediffList = "";
// 添加必须有的hediff
if (Props.requiredHediff != null)
{
hediffList += Props.requiredHediff.label;
}
else if (Props.requiredHediffs != null && Props.requiredHediffs.Count > 0)
{
foreach (var hediff in Props.requiredHediffs)
{
if (hediffList.Length > 0)
hediffList += ", ";
hediffList += hediff.label;
}
}
// 添加禁止的hediff
if (Props.forbiddenHediff != null)
{
if (hediffList.Length > 0)
hediffList += "; ";
hediffList += "不能有: " + Props.forbiddenHediff.label;
}
else if (Props.forbiddenHediffs != null && Props.forbiddenHediffs.Count > 0)
{
if (hediffList.Length > 0)
hediffList += "; ";
hediffList += "不能有: ";
foreach (var hediff in Props.forbiddenHediffs)
{
if (hediffList.EndsWith("不能有: "))
hediffList += hediff.label;
else
hediffList += ", " + hediff.label;
}
}
return hediffList;
}
}
}

View File

@@ -0,0 +1,33 @@
using RimWorld;
using System.Collections.Generic;
using Verse;
namespace ArachnaeSwarm
{
public class CompProperties_AbilityHediffRestriction : CompProperties_AbilityEffect
{
// 必须有的hediff单个
public HediffDef requiredHediff;
// 必须有的hediff多个满足任意一个即可
public List<HediffDef> requiredHediffs;
// 禁止的hediff单个
public HediffDef forbiddenHediff;
// 禁止的hediff多个有任意一个就不行
public List<HediffDef> forbiddenHediffs;
// 失败消息配置
[MustTranslate]
public string targetHediffFailMessage = "AbilityTargetHediffRestriction";
[MustTranslate]
public string disabledReasonKey = "AbilityDisabledHediffRestriction";
public CompProperties_AbilityHediffRestriction()
{
compClass = typeof(CompAbilityEffect_HediffRestriction);
}
}
}

View File

@@ -73,8 +73,12 @@
<Compile Include="Abilities\ARA_AbilitySwitch\WeaponSwitch.cs" />
<Compile Include="Abilities\ARA_AddExtraExp\CompAbilityEffect_AddExtraExp.cs" />
<Compile Include="Abilities\ARA_AddExtraExp\CompProperties_AddExtraExp.cs" />
<Compile Include="Abilities\ARA_DestroyOwnBodyPart\CompAbilityEffect_DestroyOwnBodyPart.cs" />
<Compile Include="Abilities\ARA_DestroyOwnBodyPart\CompProperties_AbilityDestroyOwnBodyPart.cs" />
<Compile Include="Abilities\ARA_GiveHediffWithSkillDuration\CompAbilityEffect_GiveHediffWithSkillDuration.cs" />
<Compile Include="Abilities\ARA_GiveHediffWithSkillDuration\CompProperties_GiveHediffWithSkillDuration.cs" />
<Compile Include="Abilities\ARA_HediffRestriction\CompAbilityEffect_HediffRestriction.cs" />
<Compile Include="Abilities\ARA_HediffRestriction\CompProperties_AbilityHediffRestriction.cs" />
<Compile Include="Abilities\ARA_HuggingFace\CompAbilityEffect_Possess.cs" />
<Compile Include="Abilities\ARA_HuggingFace\CompProperties_AbilityPossess.cs" />
<Compile Include="Abilities\ARA_HuggingFace\Hediff_Possession.cs" />