From 0adcb7c3e200af4cfcd376f1ade8c647bacbfe78 Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Mon, 7 Feb 2022 17:12:26 -0300 Subject: [PATCH] add new hooks: human.CPRSuccess and human.CPRFailed --- Barotrauma/BarotraumaShared/Lua/DefaultRegister.lua | 2 ++ .../Characters/Animation/HumanoidAnimController.cs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Barotrauma/BarotraumaShared/Lua/DefaultRegister.lua b/Barotrauma/BarotraumaShared/Lua/DefaultRegister.lua index 66f544399..8a227ed12 100644 --- a/Barotrauma/BarotraumaShared/Lua/DefaultRegister.lua +++ b/Barotrauma/BarotraumaShared/Lua/DefaultRegister.lua @@ -34,6 +34,8 @@ RegisterBarotrauma("AfflictionPrefab") RegisterBarotrauma("Affliction") RegisterBarotrauma("CharacterHealth") RegisterBarotrauma("AnimController") +RegisterBarotrauma("HumanoidAnimController") +RegisterBarotrauma("FishAnimController") RegisterBarotrauma("Limb") RegisterBarotrauma("Ragdoll") RegisterBarotrauma("Networking.ChatMessage") diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/HumanoidAnimController.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/HumanoidAnimController.cs index 109cec337..1fa746db9 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/HumanoidAnimController.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/HumanoidAnimController.cs @@ -1447,6 +1447,12 @@ namespace Barotrauma //increase oxygen and clamp it above zero // -> the character should be revived if there are no major afflictions in addition to lack of oxygen target.Oxygen = Math.Max(target.Oxygen + 10.0f, 10.0f); + + GameMain.Lua.hook.Call("human.CPRSuccess", this); + } + else + { + GameMain.Lua.hook.Call("human.CPRFailed", this); } } }