1
This commit is contained in:
Binary file not shown.
@@ -1408,64 +1408,65 @@
|
|||||||
</HediffDef>
|
</HediffDef>
|
||||||
|
|
||||||
<!-- 特殊-传送器 -->
|
<!-- 特殊-传送器 -->
|
||||||
<HediffDef>
|
<HediffDef ParentName="ImplantHediffBase">
|
||||||
<defName>WULA_AutoJumpdrive_Hediff</defName>
|
<defName>WULA_AutoJumpdrive</defName>
|
||||||
<label>微型传送装置</label>
|
<label>微型传送装置</label>
|
||||||
<description>安装在乌拉帝国合成人军团体内的微型跃迁引擎,会在合成人到达指定作战时间或死亡时将其回收</description>
|
<description>安装在乌拉帝国合成人军团体内的微型跃迁引擎,会在合成人到达指定作战时间或死亡时将其回收</description>
|
||||||
<hediffClass>HediffWithComps</hediffClass>
|
|
||||||
<defaultLabelColor>(1,0,0.5)</defaultLabelColor>
|
|
||||||
<maxSeverity>1.0</maxSeverity>
|
|
||||||
<initialSeverity>0.0</initialSeverity>
|
|
||||||
<isBad>true</isBad>
|
|
||||||
<spawnThingOnRemoved>WULA_AutoJumpdrive</spawnThingOnRemoved>
|
<spawnThingOnRemoved>WULA_AutoJumpdrive</spawnThingOnRemoved>
|
||||||
<comps>
|
<comps>
|
||||||
<li Class="HediffCompProperties_DissolveGearOnDeath">
|
|
||||||
<fleck>AcidCloud</fleck>
|
|
||||||
<moteCount>6</moteCount>
|
|
||||||
<moteOffsetRange>0.25~0.75</moteOffsetRange>
|
|
||||||
<filth>Filth_Slime</filth>
|
|
||||||
<sound>DeathAcidifier</sound>
|
|
||||||
<injuryCreatedOnDeath>ChemicalBurn</injuryCreatedOnDeath>
|
|
||||||
<injuryCount>3~6</injuryCount>
|
|
||||||
</li>
|
|
||||||
<li Class="HediffCompProperties_Disappears">
|
|
||||||
<disappearsAfterTicks>10000</disappearsAfterTicks> <!-- 2/3 RimWorld days -->
|
|
||||||
</li>
|
|
||||||
<li Class="WulaFallenEmpire.HediffCompProperties_DisappearWithEffect">
|
<li Class="WulaFallenEmpire.HediffCompProperties_DisappearWithEffect">
|
||||||
<disappearsAfterTicks>15000</disappearsAfterTicks>
|
<disappearsAfterTicks>15000</disappearsAfterTicks>
|
||||||
<showRemainingTime>true</showRemainingTime>
|
<showRemainingTime>true</showRemainingTime>
|
||||||
<fleckDef>PsycastAreaEffect</fleckDef>
|
<fleckDef>PsycastAreaEffect</fleckDef>
|
||||||
<fleckScale>2.5</fleckScale>
|
<fleckScale>2.5</fleckScale>
|
||||||
<dropEquipment>false</dropEquipment>
|
<dropEquipment>false</dropEquipment>
|
||||||
<destroyCorpse>true</destroyCorpse>
|
<destroyCorpse>true</destroyCorpse>
|
||||||
<playSound>true</playSound>
|
<playSound>true</playSound>
|
||||||
<messageOnDisappear>{0} 通过传送离开了殖民地</messageOnDisappear>
|
<messageOnDisappear>{0} 通过传送离开了殖民地</messageOnDisappear>
|
||||||
</li>
|
</li>
|
||||||
</comps>
|
</comps>
|
||||||
<stages>
|
|
||||||
<li>
|
|
||||||
<label>微弱</label>
|
|
||||||
<minSeverity>0</minSeverity>
|
|
||||||
</li>
|
|
||||||
</stages>
|
|
||||||
</HediffDef>
|
</HediffDef>
|
||||||
<ThingDef ParentName="BodyPartBase">
|
<ThingDef ParentName="BodyPartBase">
|
||||||
<defName>WULA_AutoJumpdrive</defName>
|
<defName>WULA_AutoJumpdrive</defName>
|
||||||
<label>微型传送装置</label>
|
<label>death acidifier</label>
|
||||||
<description>安装在乌拉帝国合成人军团体内的微型跃迁引擎,会在合成人到达指定作战时间或死亡时将其回收。</description>
|
<description>A chest implant for preventing enemy use of captured equipment. Upon the user's death, it releases powerful chemicals that dissolve gear in contact with the user's body. It doesn't damage others.</description>
|
||||||
|
<techLevel>Spacer</techLevel>
|
||||||
|
<graphicData>
|
||||||
|
<texPath>Things/Item/Health/HealthItem</texPath>
|
||||||
|
<graphicClass>Graphic_Single</graphicClass>
|
||||||
|
<drawSize>0.80</drawSize>
|
||||||
|
<color>(189,169,118)</color>
|
||||||
|
</graphicData>
|
||||||
<statBases>
|
<statBases>
|
||||||
<Mass>0.3</Mass>
|
<MarketValue>400</MarketValue>
|
||||||
<WorkToMake>1</WorkToMake>
|
|
||||||
</statBases>
|
</statBases>
|
||||||
<techHediffsTags>
|
<thingCategories>
|
||||||
<li>WULA_AutoJumpdrive</li>
|
<li>BodyPartsBionic</li>
|
||||||
</techHediffsTags>
|
</thingCategories>
|
||||||
<costList>
|
|
||||||
<ComponentIndustrial>1</ComponentIndustrial>
|
|
||||||
</costList>
|
|
||||||
<recipeMaker>
|
|
||||||
<soundWorking>Recipe_Smith</soundWorking>
|
|
||||||
<recipeUsers Inherit="False" IsNull="True"/>
|
|
||||||
</recipeMaker>
|
|
||||||
</ThingDef>
|
</ThingDef>
|
||||||
</Defs>
|
<RecipeDef ParentName="SurgeryInstallImplantBase">
|
||||||
|
<defName>Install_WULA_AutoJumpdrive</defName>
|
||||||
|
<label>install death acidifier</label>
|
||||||
|
<description>Install a death acidifier.</description>
|
||||||
|
<jobString>Installing death acidifier.</jobString>
|
||||||
|
<ingredients>
|
||||||
|
<li>
|
||||||
|
<filter>
|
||||||
|
<thingDefs>
|
||||||
|
<li>WULA_AutoJumpdrive</li>
|
||||||
|
</thingDefs>
|
||||||
|
</filter>
|
||||||
|
<count>1</count>
|
||||||
|
</li>
|
||||||
|
</ingredients>
|
||||||
|
<fixedIngredientFilter>
|
||||||
|
<thingDefs>
|
||||||
|
<li>WULA_AutoJumpdrive</li>
|
||||||
|
</thingDefs>
|
||||||
|
</fixedIngredientFilter>
|
||||||
|
<appliedOnFixedBodyParts>
|
||||||
|
<li>Torso</li>
|
||||||
|
</appliedOnFixedBodyParts>
|
||||||
|
<addsHediff>WULA_AutoJumpdrive</addsHediff>
|
||||||
|
</RecipeDef>
|
||||||
|
</Defs>
|
||||||
@@ -303,24 +303,31 @@
|
|||||||
<initialWillRange>10~20</initialWillRange>
|
<initialWillRange>10~20</initialWillRange>
|
||||||
<initialResistanceRange>10~20</initialResistanceRange>
|
<initialResistanceRange>10~20</initialResistanceRange>
|
||||||
<itemQuality>Poor</itemQuality>
|
<itemQuality>Poor</itemQuality>
|
||||||
|
<minApparelQuality>Poor</minApparelQuality>
|
||||||
|
<maxApparelQuality>Poor</maxApparelQuality>
|
||||||
<isFighter>true</isFighter>
|
<isFighter>true</isFighter>
|
||||||
<apparelTags>
|
<apparelTags>
|
||||||
<li>Wula_Armor_Super_Heavy</li>
|
<li>Wula_Armor_Super_Heavy</li>
|
||||||
</apparelTags>
|
</apparelTags>
|
||||||
<weaponTags>
|
<weaponTags>
|
||||||
<li>Wula_Melee_Weapon_T1</li>
|
<li>Wula_Melee_Weapon_T1</li>
|
||||||
<li>Wula_Melee_Weapon_T3</li>
|
<li>Wula_Melee_Weapon_T2</li>
|
||||||
<li>Wula_Ranged_Weapon_T2</li>
|
<li>Wula_Ranged_Weapon_T2</li>
|
||||||
</weaponTags>
|
</weaponTags>
|
||||||
<abilities>
|
<apparelRequired>
|
||||||
</abilities>
|
<li>WULA_Heavy_Infantry_PowerArmor</li>
|
||||||
|
<li>WULA_Heavy_Infantry_Helmet</li>
|
||||||
|
</apparelRequired>
|
||||||
<weaponMoney>3000~8000</weaponMoney>
|
<weaponMoney>3000~8000</weaponMoney>
|
||||||
|
<biocodeWeaponChance>1</biocodeWeaponChance>
|
||||||
<apparelAllowHeadgearChance>1</apparelAllowHeadgearChance>
|
<apparelAllowHeadgearChance>1</apparelAllowHeadgearChance>
|
||||||
|
<techHediffsChance>1</techHediffsChance>
|
||||||
<apparelMoney>999999~999999</apparelMoney>
|
<apparelMoney>999999~999999</apparelMoney>
|
||||||
<techHediffsMoney>1000~2000</techHediffsMoney>
|
<techHediffsMoney>999999~999999</techHediffsMoney>
|
||||||
<techHediffsTags>
|
<techHediffsRequired>
|
||||||
<li>WULA_AutoJumpdrive</li>
|
<li>WULA_AutoJumpdrive</li>
|
||||||
</techHediffsTags>
|
<li>DeathAcidifier</li>
|
||||||
|
</techHediffsRequired>
|
||||||
|
|
||||||
<backstoryFiltersOverride>
|
<backstoryFiltersOverride>
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
<!-- 近战 -->
|
<!-- 近战 -->
|
||||||
<ThingDef Name="WULA_ExperienceCore_Weapon_Melee" ParentName="BaseMeleeWeapon_Blunt_Quality" Abstract="True">
|
<ThingDef Name="WULA_ExperienceCore_Weapon_Melee" ParentName="BaseMeleeWeapon_Blunt_Quality" Abstract="True">
|
||||||
<comps>
|
<comps>
|
||||||
|
<li Class="CompProperties_Biocodable"/>
|
||||||
<li Class="WulaFallenEmpire.CompProperties_ProductionCategory">
|
<li Class="WulaFallenEmpire.CompProperties_ProductionCategory">
|
||||||
<category>Weapon</category>
|
<category>Weapon</category>
|
||||||
</li>
|
</li>
|
||||||
@@ -432,6 +433,7 @@
|
|||||||
<!-- 射弹武器 -->
|
<!-- 射弹武器 -->
|
||||||
<ThingDef Name="WULA_ExperienceCore_Weapon_Ranged" ParentName="BaseHumanMakeableGun" Abstract="True">
|
<ThingDef Name="WULA_ExperienceCore_Weapon_Ranged" ParentName="BaseHumanMakeableGun" Abstract="True">
|
||||||
<comps>
|
<comps>
|
||||||
|
<li Class="CompProperties_Biocodable"/>
|
||||||
<li Class="WulaFallenEmpire.CompProperties_ProductionCategory">
|
<li Class="WulaFallenEmpire.CompProperties_ProductionCategory">
|
||||||
<category>Weapon</category>
|
<category>Weapon</category>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -337,4 +337,6 @@
|
|||||||
<WULA_FlyOverCooldown.BombardmentFacilityReady>武器阵列:就绪</WULA_FlyOverCooldown.BombardmentFacilityReady>
|
<WULA_FlyOverCooldown.BombardmentFacilityReady>武器阵列:就绪</WULA_FlyOverCooldown.BombardmentFacilityReady>
|
||||||
|
|
||||||
<SkyfallerPawnLanded>战争机械已部署</SkyfallerPawnLanded>
|
<SkyfallerPawnLanded>战争机械已部署</SkyfallerPawnLanded>
|
||||||
|
|
||||||
|
<DisappearWithEffect_TimeRemaining>剩余时间: {0}</DisappearWithEffect_TimeRemaining>
|
||||||
</LanguageData>
|
</LanguageData>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using RimWorld;
|
||||||
|
using Verse;
|
||||||
|
|
||||||
|
namespace ArachnaeSwarm
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(Hediff_Mechlink), "PostAdd")]
|
||||||
|
public static class Hediff_Mechlink_PostAdd_Patch
|
||||||
|
{
|
||||||
|
public static bool Prefix(Hediff_Mechlink __instance, DamageInfo? dinfo)
|
||||||
|
{
|
||||||
|
// 检查 hediff 的 defName 是否是我们要排除的
|
||||||
|
if (__instance.def.defName == "WULA_Addons_Antenna_Hediff_Base")
|
||||||
|
{
|
||||||
|
// 执行基础逻辑但不弹出信件
|
||||||
|
if (!ModLister.CheckBiotech("Mechlink"))
|
||||||
|
{
|
||||||
|
__instance.pawn.health.RemoveHediff(__instance);
|
||||||
|
return false; // 跳过原始方法
|
||||||
|
}
|
||||||
|
|
||||||
|
PawnComponentsUtility.AddAndRemoveDynamicComponents(__instance.pawn);
|
||||||
|
|
||||||
|
// 不弹出信件,直接返回
|
||||||
|
return false; // 跳过原始方法
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对于其他 hediff,正常执行原始方法
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
121
Source/WulaFallenEmpire/Hediff/HediffGiver_NonPlayerFaction.cs
Normal file
121
Source/WulaFallenEmpire/Hediff/HediffGiver_NonPlayerFaction.cs
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
using RimWorld;
|
||||||
|
using Verse;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace WulaFallenEmpire
|
||||||
|
{
|
||||||
|
public class HediffGiver_NonPlayerFaction : HediffGiver
|
||||||
|
{
|
||||||
|
// 显式重新定义这些字段,确保 XML 解析器能找到它们
|
||||||
|
public float mtbDays;
|
||||||
|
public new HediffDef hediff;
|
||||||
|
|
||||||
|
// 新增:目标派系列表
|
||||||
|
public List<FactionDef> targetFactions;
|
||||||
|
|
||||||
|
// 新增:是否排除玩家派系(默认为true)
|
||||||
|
public bool excludePlayerFaction = true;
|
||||||
|
|
||||||
|
// 新增:是否排除囚犯(默认为true)
|
||||||
|
public bool excludePrisoners = true;
|
||||||
|
|
||||||
|
// 新增:记录已经处理过的 pawn,避免重复处理
|
||||||
|
private HashSet<Pawn> processedPawns = new HashSet<Pawn>();
|
||||||
|
|
||||||
|
public override void OnIntervalPassed(Pawn pawn, Hediff cause)
|
||||||
|
{
|
||||||
|
// 检查 pawn 是否已经处理过
|
||||||
|
if (processedPawns.Contains(pawn))
|
||||||
|
{
|
||||||
|
// 如果已经处理过,检查 hediff 是否还存在
|
||||||
|
Hediff existingHediff = pawn.health?.hediffSet?.GetFirstHediffOfDef(this.hediff);
|
||||||
|
if (existingHediff != null)
|
||||||
|
{
|
||||||
|
// hediff 还存在,不需要再次处理
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// hediff 被移除了,从记录中移除这个 pawn
|
||||||
|
processedPawns.Remove(pawn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查派系条件
|
||||||
|
if (ShouldHaveHediff(pawn))
|
||||||
|
{
|
||||||
|
// 检查是否已经有这个 hediff
|
||||||
|
Hediff existing = pawn.health?.hediffSet?.GetFirstHediffOfDef(this.hediff);
|
||||||
|
if (existing == null)
|
||||||
|
{
|
||||||
|
// 给予 hediff
|
||||||
|
HealthUtility.AdjustSeverity(pawn, this.hediff, 1.0f);
|
||||||
|
// 标记为已处理
|
||||||
|
processedPawns.Add(pawn);
|
||||||
|
Log.Message($"Added hediff {this.hediff.defName} to pawn {pawn.Label}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 移除 hediff
|
||||||
|
if (RemoveHediffIfExists(pawn))
|
||||||
|
{
|
||||||
|
// 如果成功移除了 hediff,也从记录中移除
|
||||||
|
processedPawns.Remove(pawn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ShouldHaveHediff(Pawn pawn)
|
||||||
|
{
|
||||||
|
// 检查派系是否存在
|
||||||
|
if (pawn.Faction == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 检查是否排除玩家派系
|
||||||
|
if (excludePlayerFaction && pawn.Faction == Faction.OfPlayer)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 检查是否排除囚犯
|
||||||
|
if (excludePrisoners && pawn.IsPrisonerOfColony)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 检查目标派系
|
||||||
|
if (targetFactions != null && targetFactions.Count > 0)
|
||||||
|
{
|
||||||
|
// 如果指定了目标派系,只给这些派系添加 hediff
|
||||||
|
return targetFactions.Contains(pawn.Faction.def);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果没有指定目标派系,保持原来的行为:给所有非玩家派系添加
|
||||||
|
return pawn.Faction != Faction.OfPlayer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool RemoveHediffIfExists(Pawn pawn)
|
||||||
|
{
|
||||||
|
Hediff existing = pawn.health?.hediffSet?.GetFirstHediffOfDef(this.hediff);
|
||||||
|
if (existing != null)
|
||||||
|
{
|
||||||
|
pawn.health.RemoveHediff(existing);
|
||||||
|
Log.Message($"Removed hediff {this.hediff.defName} from pawn {pawn.Label}");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增:在 pawn 死亡或被销毁时清理记录
|
||||||
|
public override void Notify_PawnDied(Pawn pawn, DamageInfo? dinfo)
|
||||||
|
{
|
||||||
|
base.Notify_PawnDied(pawn, dinfo);
|
||||||
|
processedPawns.Remove(pawn);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Notify_PawnDespawned(Pawn pawn, Map map)
|
||||||
|
{
|
||||||
|
base.Notify_PawnDespawned(pawn, map);
|
||||||
|
processedPawns.Remove(pawn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,7 +20,7 @@ namespace WulaFallenEmpire
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// HediffComp 实现
|
// HediffComp 实现 - 只处理计时器到期
|
||||||
public class HediffComp_DisappearWithEffect : HediffComp
|
public class HediffComp_DisappearWithEffect : HediffComp
|
||||||
{
|
{
|
||||||
public HediffCompProperties_DisappearWithEffect Props =>
|
public HediffCompProperties_DisappearWithEffect Props =>
|
||||||
@@ -54,21 +54,6 @@ namespace WulaFallenEmpire
|
|||||||
TriggerDisappearEffect();
|
TriggerDisappearEffect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 如果 pawn 已经死亡,立即触发效果
|
|
||||||
else if (Pawn.Dead)
|
|
||||||
{
|
|
||||||
TriggerDisappearEffect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理 pawn 死亡事件 - 修复参数问题
|
|
||||||
public override void Notify_PawnDied(DamageInfo? dinfo, Hediff culprit = null)
|
|
||||||
{
|
|
||||||
base.Notify_PawnDied(dinfo, culprit);
|
|
||||||
if (!triggered)
|
|
||||||
{
|
|
||||||
TriggerDisappearEffect();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 触发消失效果的核心方法
|
// 触发消失效果的核心方法
|
||||||
@@ -85,22 +70,22 @@ namespace WulaFallenEmpire
|
|||||||
IntVec3 position = Pawn.Position;
|
IntVec3 position = Pawn.Position;
|
||||||
Map map = Pawn.Map;
|
Map map = Pawn.Map;
|
||||||
|
|
||||||
// 1. 清除所有装备
|
// 1. 播放特效
|
||||||
ClearAllEquipment(map);
|
|
||||||
|
|
||||||
// 2. 播放特效
|
|
||||||
PlayFleckEffect(position, map);
|
PlayFleckEffect(position, map);
|
||||||
|
|
||||||
// 3. 播放音效
|
// 2. 播放音效
|
||||||
PlaySoundEffect(position, map);
|
PlaySoundEffect(position, map);
|
||||||
|
|
||||||
// 4. 发送消失消息(如果配置了)
|
// 3. 发送消失消息(如果配置了)
|
||||||
SendDisappearMessage();
|
SendDisappearMessage();
|
||||||
|
|
||||||
// 5. 删除 pawn
|
// 4. 清除装备
|
||||||
|
ClearAllEquipment();
|
||||||
|
|
||||||
|
// 5. 暴力删除 pawn
|
||||||
DestroyPawn();
|
DestroyPawn();
|
||||||
|
|
||||||
Log.Message($"[DisappearWithEffect] Pawn {Pawn.LabelCap} disappeared at {position}");
|
Log.Message($"[DisappearWithEffect] Pawn {Pawn.LabelCap} destroyed at {position}");
|
||||||
}
|
}
|
||||||
catch (System.Exception ex)
|
catch (System.Exception ex)
|
||||||
{
|
{
|
||||||
@@ -108,69 +93,56 @@ namespace WulaFallenEmpire
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清除所有装备 - 修复参数问题
|
// 清除所有装备
|
||||||
private void ClearAllEquipment(Map map)
|
private void ClearAllEquipment()
|
||||||
{
|
{
|
||||||
if (Pawn.equipment == null && Pawn.apparel == null && Pawn.inventory == null)
|
// 销毁装备(武器)
|
||||||
return;
|
|
||||||
|
|
||||||
// 清除装备(武器)
|
|
||||||
if (Pawn.equipment != null)
|
if (Pawn.equipment != null)
|
||||||
{
|
{
|
||||||
var allEquipment = Pawn.equipment.AllEquipmentListForReading.ListFullCopy();
|
if (Props.dropEquipment)
|
||||||
foreach (var thing in allEquipment)
|
|
||||||
{
|
{
|
||||||
if (Props.dropEquipment)
|
// 掉落所有装备
|
||||||
|
var allEquipment = Pawn.equipment.AllEquipmentListForReading.ListFullCopy();
|
||||||
|
foreach (var thing in allEquipment)
|
||||||
{
|
{
|
||||||
// 掉落装备 - 修复类型转换问题
|
|
||||||
ThingWithComps droppedWeapon;
|
ThingWithComps droppedWeapon;
|
||||||
Pawn.equipment.TryDropEquipment(thing, out droppedWeapon, Pawn.Position, true);
|
Pawn.equipment.TryDropEquipment(thing, out droppedWeapon, Pawn.Position, true);
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
// 直接销毁装备
|
{
|
||||||
thing.Destroy(DestroyMode.Vanish);
|
// 直接销毁所有装备
|
||||||
}
|
Pawn.equipment.DestroyAllEquipment();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清除 apparel(服装)
|
// 销毁 apparel(服装)
|
||||||
if (Pawn.apparel != null)
|
if (Pawn.apparel != null)
|
||||||
{
|
{
|
||||||
var wornApparel = Pawn.apparel.WornApparel.ListFullCopy();
|
if (Props.dropEquipment)
|
||||||
foreach (var apparel in wornApparel)
|
|
||||||
{
|
{
|
||||||
if (Props.dropEquipment)
|
// 掉落所有服装
|
||||||
|
var wornApparel = Pawn.apparel.WornApparel.ListFullCopy();
|
||||||
|
foreach (var apparel in wornApparel)
|
||||||
{
|
{
|
||||||
// 掉落服装
|
|
||||||
Apparel droppedApparel;
|
Apparel droppedApparel;
|
||||||
Pawn.apparel.TryDrop(apparel, out droppedApparel, Pawn.Position, true);
|
Pawn.apparel.TryDrop(apparel, out droppedApparel, Pawn.Position, true);
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
// 直接销毁服装
|
{
|
||||||
apparel.Destroy(DestroyMode.Vanish);
|
// 直接销毁所有服装
|
||||||
}
|
Pawn.apparel.DestroyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清除 inventory(物品栏)
|
// 销毁 inventory(物品栏)
|
||||||
if (Pawn.inventory != null)
|
if (Pawn.inventory != null && !Props.dropEquipment)
|
||||||
{
|
{
|
||||||
var innerContainer = Pawn.inventory.innerContainer.InnerListForReading.ListFullCopy();
|
var innerContainer = Pawn.inventory.innerContainer.InnerListForReading.ListFullCopy();
|
||||||
foreach (var thing in innerContainer)
|
foreach (var thing in innerContainer)
|
||||||
{
|
{
|
||||||
if (Props.dropEquipment)
|
thing.Destroy(DestroyMode.Vanish);
|
||||||
{
|
|
||||||
// 掉落物品
|
|
||||||
Thing droppedThing;
|
|
||||||
Pawn.inventory.innerContainer.TryDrop(thing, Pawn.Position, map, ThingPlaceMode.Near, out droppedThing);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 直接销毁物品
|
|
||||||
thing.Destroy(DestroyMode.Vanish);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -194,7 +166,7 @@ namespace WulaFallenEmpire
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 播放音效 - 修复音效播放问题
|
// 播放音效
|
||||||
private void PlaySoundEffect(IntVec3 position, Map map)
|
private void PlaySoundEffect(IntVec3 position, Map map)
|
||||||
{
|
{
|
||||||
if (!Props.playSound) return;
|
if (!Props.playSound) return;
|
||||||
@@ -232,19 +204,18 @@ namespace WulaFallenEmpire
|
|||||||
// 删除 pawn
|
// 删除 pawn
|
||||||
private void DestroyPawn()
|
private void DestroyPawn()
|
||||||
{
|
{
|
||||||
if (Pawn.Dead && Props.destroyCorpse)
|
if (Pawn.Destroyed) return;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// 如果是尸体,直接销毁
|
// 直接调用 Destroy,绕过所有死亡逻辑
|
||||||
Pawn.Destroy();
|
Pawn.Destroy(DestroyMode.Vanish);
|
||||||
|
|
||||||
|
Log.Message($"[DisappearWithEffect] Pawn {Pawn.LabelCap} destroyed");
|
||||||
}
|
}
|
||||||
else if (!Pawn.Dead)
|
catch (System.Exception ex)
|
||||||
{
|
{
|
||||||
// 如果是活着的 pawn,先杀死再销毁
|
Log.Error($"[DisappearWithEffect] Error destroying pawn: {ex}");
|
||||||
Pawn.Kill(null, this.parent);
|
|
||||||
if (Props.destroyCorpse)
|
|
||||||
{
|
|
||||||
Pawn.Destroy();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,6 +153,7 @@
|
|||||||
<Compile Include="GlobalWorkTable\ITab_GlobalBills.cs" />
|
<Compile Include="GlobalWorkTable\ITab_GlobalBills.cs" />
|
||||||
<Compile Include="GlobalWorkTable\CompLaunchable_ToGlobalStorage.cs" />
|
<Compile Include="GlobalWorkTable\CompLaunchable_ToGlobalStorage.cs" />
|
||||||
<Compile Include="GlobalWorkTable\CompProperties_Launchable_ToGlobalStorage.cs" />
|
<Compile Include="GlobalWorkTable\CompProperties_Launchable_ToGlobalStorage.cs" />
|
||||||
|
<Compile Include="HarmonyPatches\Hediff_Mechlink_PostAdd_Patch.cs" />
|
||||||
<Compile Include="HarmonyPatches\WULA_AutonomousMech\Patch_FloatMenuOptionProvider_SelectedPawnValid.cs" />
|
<Compile Include="HarmonyPatches\WULA_AutonomousMech\Patch_FloatMenuOptionProvider_SelectedPawnValid.cs" />
|
||||||
<Compile Include="HarmonyPatches\WULA_AutonomousMech\Patch_IsColonyMechPlayerControlled.cs" />
|
<Compile Include="HarmonyPatches\WULA_AutonomousMech\Patch_IsColonyMechPlayerControlled.cs" />
|
||||||
<Compile Include="HarmonyPatches\WULA_AutonomousMech\Patch_MechanitorUtility_CanDraftMech.cs" />
|
<Compile Include="HarmonyPatches\WULA_AutonomousMech\Patch_MechanitorUtility_CanDraftMech.cs" />
|
||||||
@@ -160,7 +161,7 @@
|
|||||||
<Compile Include="HarmonyPatches\WULA_AutonomousMech\Patch_CaravanFormingUtility_AllSendablePawns.cs" />
|
<Compile Include="HarmonyPatches\WULA_AutonomousMech\Patch_CaravanFormingUtility_AllSendablePawns.cs" />
|
||||||
<Compile Include="HarmonyPatches\WULA_AutonomousMech\Patch_Pawn_ThreatDisabled.cs" />
|
<Compile Include="HarmonyPatches\WULA_AutonomousMech\Patch_Pawn_ThreatDisabled.cs" />
|
||||||
<Compile Include="HarmonyPatches\WULA_AutonomousMech\Patch_UncontrolledMechDrawPulse.cs" />
|
<Compile Include="HarmonyPatches\WULA_AutonomousMech\Patch_UncontrolledMechDrawPulse.cs" />
|
||||||
<Compile Include="HediffComp\HediffCompProperties_DisappearWithEffect .cs" />
|
<Compile Include="HediffComp\HediffCompProperties_DisappearWithEffect.cs" />
|
||||||
<Compile Include="HediffComp\HediffCompProperties_NanoRepair.cs" />
|
<Compile Include="HediffComp\HediffCompProperties_NanoRepair.cs" />
|
||||||
<Compile Include="HediffComp\HediffCompProperties_SwitchableHediff.cs" />
|
<Compile Include="HediffComp\HediffCompProperties_SwitchableHediff.cs" />
|
||||||
<Compile Include="HediffComp\WULA_HediffDamgeShield\DRMDamageShield.cs" />
|
<Compile Include="HediffComp\WULA_HediffDamgeShield\DRMDamageShield.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user