new status effect tag added: "LuaHook", can be used to call lua hooks inside status effects

This commit is contained in:
Evil Factory
2022-03-05 22:30:30 -03:00
parent 9c0bcaa44f
commit 422edc7fa4

View File

@@ -377,6 +377,7 @@ namespace Barotrauma
private readonly List<string> talentTriggers;
private readonly List<int> giveExperiences;
private readonly List<GiveSkill> giveSkills;
private readonly List<string> luaHook;
public float Duration => duration;
@@ -431,6 +432,7 @@ namespace Barotrauma
talentTriggers = new List<string>();
giveExperiences = new List<int>();
giveSkills = new List<GiveSkill>();
luaHook = new List<string>();
multiplyAfflictionsByMaxVitality = element.GetAttributeBool("multiplyafflictionsbymaxvitality", false);
tags = new HashSet<string>(element.GetAttributeString("tags", "").Split(','));
@@ -735,6 +737,9 @@ namespace Barotrauma
case "giveskill":
giveSkills.Add(new GiveSkill(subElement, parentDebugName));
break;
case "luahook":
luaHook.Add(subElement.GetAttributeString("name", ""));
break;
}
}
InitProjSpecific(element, parentDebugName);
@@ -1234,6 +1239,14 @@ namespace Barotrauma
}
}
foreach (string luaHooks in luaHook)
{
var result = new LuaResult(GameMain.Lua.hook.Call(luaHooks, this, deltaTime, entity, targets, worldPosition));
if (result.Bool())
return;
}
Hull hull = GetHull(entity);
Vector2 position = GetPosition(entity, targets, worldPosition);
if (useItemCount > 0)