暂存继续修 不流血不自愈

This commit is contained in:
2025-08-14 22:06:33 +08:00
parent 67fd50e183
commit 09507178a6
6 changed files with 44 additions and 13 deletions

View File

@@ -13,6 +13,12 @@ namespace WulaFallenEmpire
private Dictionary<string, Pawn> pawnVars = new Dictionary<string, Pawn>();
private Dictionary<string, List<Pawn>> pawnListVars = new Dictionary<string, List<Pawn>>();
// 用于Scribe的辅助列表
private List<string> pawnVarKeys;
private List<Pawn> pawnVarValues;
private List<string> pawnListVarKeys;
private List<List<Pawn>> pawnListVarValues;
// Required for WorldComponent
public EventVariableManager(World world) : base(world)
{
@@ -24,8 +30,8 @@ namespace WulaFallenEmpire
Scribe_Collections.Look(ref intVars, "intVars", LookMode.Value, LookMode.Value);
Scribe_Collections.Look(ref floatVars, "floatVars", LookMode.Value, LookMode.Value);
Scribe_Collections.Look(ref stringVars, "stringVars", LookMode.Value, LookMode.Value);
Scribe_Collections.Look(ref pawnVars, "pawnVars", LookMode.Value, LookMode.Reference);
Scribe_Collections.Look(ref pawnListVars, "pawnListVars", LookMode.Value, LookMode.Reference);
Scribe_Collections.Look(ref pawnVars, "pawnVars", LookMode.Value, LookMode.Reference, ref pawnVarKeys, ref pawnVarValues);
Scribe_Collections.Look(ref pawnListVars, "pawnListVars", LookMode.Value, LookMode.Reference, ref pawnListVarKeys, ref pawnListVarValues);
// Ensure dictionaries are not null after loading
if (Scribe.mode == LoadSaveMode.PostLoadInit)

View File

@@ -0,0 +1,33 @@
using HarmonyLib;
using Verse;
using System.Reflection;
namespace WulaFallenEmpire
{
[HarmonyPatch(typeof(Pawn_HealthTracker), "get_CanBleed")]
public static class NoBloodForWula_CanBleed_Patch
{
public static void Postfix(Pawn_HealthTracker __instance, ref bool __result)
{
// 使用反射获取Pawn_HealthTracker的私有pawn字段
Pawn pawn = (Pawn)typeof(Pawn_HealthTracker).GetField("pawn", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance);
if (pawn.def.defName == "WulaSpecies")
{
__result = false;
}
}
}
[HarmonyPatch(typeof(Hediff_Injury), "get_BleedRate")]
public static class NoBloodForWula_BleedRate_Patch
{
public static void Postfix(Hediff_Injury __instance, ref float __result)
{
if (__instance.pawn.def.defName == "WulaSpecies")
{
__result = 0f;
}
}
}
}

View File

@@ -97,6 +97,7 @@
<Compile Include="HarmonyPatches\MechanitorUtility_InMechanitorCommandRange_Patch.cs" />
<Compile Include="HarmonyPatches\Projectile_Launch_Patch.cs" />
<Compile Include="HarmonyPatches\Patch_JobGiver_GatherOfferingsForPsychicRitual.cs" />
<Compile Include="HarmonyPatches\NoBloodForWulaPatch.cs" />
<Compile Include="HediffComp_RegenerateBackstory.cs" />
<Compile Include="HediffComp_WulaCharging.cs" />
<Compile Include="IngestPatch.cs" />