You can now grab the parameters passed into XML status effects and added a variation of the Hook Add method that only takes the event name

This commit is contained in:
EvilFactory
2024-04-20 18:47:07 -03:00
parent 123a212251
commit 71376cfe5f
4 changed files with 25 additions and 20 deletions
@@ -704,7 +704,7 @@ namespace Barotrauma
private readonly List<Identifier> talentTriggers;
private readonly List<int> giveExperiences;
private readonly List<GiveSkill> giveSkills;
private readonly List<string> luaHook;
private readonly List<(string, ContentXElement)> luaHook;
/// <summary>
/// How long the effect runs (in seconds). Note that if <see cref="Stackable"/> is true,
@@ -1085,8 +1085,9 @@ namespace Barotrauma
giveSkills.Add(new GiveSkill(subElement, parentDebugName));
break;
case "luahook":
luaHook ??= new List<string>();
luaHook.Add(subElement.GetAttributeString("name", ""));
case "hook":
luaHook ??= new List<(string, ContentXElement)>();
luaHook.Add((subElement.GetAttributeString("name", ""), subElement));
break;
}
}
@@ -1571,12 +1572,11 @@ namespace Barotrauma
if (luaHook != null)
{
foreach (string luaHooks in luaHook)
foreach ((string hookName, ContentXElement element) in luaHook)
{
var result = GameMain.LuaCs.Hook.Call<bool?>(luaHooks, this, deltaTime, entity, targets, worldPosition);
var result = GameMain.LuaCs.Hook.Call<bool?>(hookName, this, deltaTime, entity, targets, worldPosition, element);
if (result != null && result.Value)
return;
if (result != null && result.Value) { return; }
}
}