From f527f88d3ac286858a20b95bd52ba3e77cd544eb Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Tue, 29 Mar 2022 11:25:53 -0300 Subject: [PATCH] removed applyAffliction and added character.applyDamage and character.applyAffliction --- .../Characters/Health/CharacterHealth.cs | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Health/CharacterHealth.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Health/CharacterHealth.cs index ac0c9c969..5894df16c 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Health/CharacterHealth.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Health/CharacterHealth.cs @@ -387,12 +387,6 @@ namespace Barotrauma { if (targetLimb == null) { - var should = new LuaResult(GameMain.Lua.hook.Call("afflictionApplied", new object[] { this, affliction })); - - if (should.Bool()) - return; - - //if a limb-specific affliction is applied to no specific limb, apply to all limbs foreach (LimbHealth limbHealth in limbHealths) { @@ -402,21 +396,11 @@ namespace Barotrauma } else { - var should = new LuaResult(GameMain.Lua.hook.Call("afflictionApplied", new object[] { this, affliction, targetLimb })); - - if (should.Bool()) - return; - AddLimbAffliction(targetLimb, affliction, allowStacking: allowStacking); } } else { - var should = new LuaResult(GameMain.Lua.hook.Call("afflictionApplied", new object[] { this, affliction })); - - if (should.Bool()) - return; - AddAffliction(affliction, allowStacking: allowStacking); } } @@ -532,7 +516,7 @@ namespace Barotrauma return; } - var should = new LuaResult(GameMain.Lua.hook.Call("afflictionApplied", new object[] { this, attackResult, hitLimb })); + var should = new LuaResult(GameMain.Lua.hook.Call("character.applyDamage", new object[] { this, attackResult, hitLimb, allowStacking })); if (should.Bool()) return; @@ -664,6 +648,11 @@ namespace Barotrauma } } + var should = new LuaResult(GameMain.Lua.hook.Call("character.applyAffliction", new object[] { this, limbHealth, newAffliction, allowStacking })); + + if (should.Bool()) + return; + Affliction existingAffliction = null; foreach (KeyValuePair kvp in afflictions) {