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

View File

@@ -24,17 +24,20 @@ Hook.Call("myCustomEvent", {"some", "arguments", 123})
## XML Status Effect Hooks
With Lua, a new XML tags is added, it can be used to call Lua hooks inside status effects:
With Lua, a new XML tags is added, it can be used to call hooks inside status effects:
```
<StatusEffect type="OnUse">
<LuaHook name="doSomething" />
<Hook name="doSomething" custom="thing" />
</StatusEffect>
```
```
Hook.Add("doSomething", "something", function(effect, deltaTime, item, targets, worldPosition)
Hook.Add("doSomething", function(effect, deltaTime, item, targets, worldPosition, element)
print(effect, ' ', item)
-- You can also access the XML custom parameters
print(element.GetAttributeString("custom", "default value"))
end)
```