Fix character.death hook getting called a billion times per second

This commit is contained in:
Evil Factory
2026-04-04 13:04:34 -03:00
parent f05d4ef129
commit 121f670c8b
2 changed files with 2 additions and 1 deletions

View File

@@ -205,7 +205,7 @@ internal class HarmonyEventPatchesService : ISystem
_eventService.PublishEvent<IEventCharacterCreated>(x => x.OnCharacterCreated(__result));
}
[HarmonyPatch(typeof(Character), nameof(Character.Kill)), HarmonyPostfix]
[HarmonyPatch(typeof(Character), "KillProjSpecific"), HarmonyPostfix]
public static void Character_Kill_Post(Character __instance, Affliction causeOfDeathAffliction, CauseOfDeathType causeOfDeath)
{
_eventService.PublishEvent<IEventCharacterDeath>(x => x.OnCharacterDeath(__instance, causeOfDeathAffliction, causeOfDeath));

View File

@@ -412,6 +412,7 @@ class LuaScriptManagementService : ILuaScriptManagementService, ILuaDataService,
_script.Globals["ExecutionNumber"] = 0;
_script.Globals["CSActive"] = !enableSandbox;
((Table)_script.Globals["debug"])["breakpoint"] = () => { Debugger.Break(); };
_script.Globals["SERVER"] = LuaCsSetup.IsServer;
_script.Globals["CLIENT"] = LuaCsSetup.IsClient;