diff --git a/Barotrauma/BarotraumaShared/Lua/DefaultHook.lua b/Barotrauma/BarotraumaShared/Lua/DefaultHook.lua index c5c964a4a..569ec7d97 100644 --- a/Barotrauma/BarotraumaShared/Lua/DefaultHook.lua +++ b/Barotrauma/BarotraumaShared/Lua/DefaultHook.lua @@ -1,81 +1,87 @@ -Hook.HookMethod( - "Barotrauma.Item", "TryInteract", - { - "Barotrauma.Character", - "System.Boolean", - "System.Boolean", - "System.Boolean" - }, - function (instance, p) - if Hook.Call("item.interact", instance, p.picker, p.ignoreRequiredItems, p.forceSelectKey, p.forceActionKey) == true then - return false - end - end, - Hook.HookMethodType.Before +Hook.Patch( + "Barotrauma.Item", "TryInteract", + { + "Barotrauma.Character", + "System.Boolean", + "System.Boolean", + "System.Boolean" + }, + function(instance, p) + if Hook.Call("item.interact", instance, p["picker"], p["ignoreRequiredItems"], p["forceSelectKey"], p["forceActionKey"]) == true then + p.PreventExecution = true + return false + end + end, + Hook.HookMethodType.Before ) -Hook.HookMethod( - "Barotrauma.Item", "ApplyTreatment", - { - "Barotrauma.Character", - "Barotrauma.Character", - "Barotrauma.Limb" - }, - function (instance, p) - if Hook.Call("item.applyTreatment", instance, p.user, p.character, p.targetLimb) then - return false - end - end, - Hook.HookMethodType.Before +Hook.Patch( + "Barotrauma.Item", "ApplyTreatment", + { + "Barotrauma.Character", + "Barotrauma.Character", + "Barotrauma.Limb" + }, + function(instance, p) + if Hook.Call("item.applyTreatment", instance, p["user"], p["character"], p["targetLimb"]) then + p.PreventExecution = true + return false + end + end, + Hook.HookMethodType.Before ) -Hook.HookMethod( - "Barotrauma.Item", "Combine", - { - "Barotrauma.Item", - "Barotrauma.Character" - }, - function (instance, p) - if Hook.Call("item.combine", instance, p.item, p.user) == true then - return false - end - end, - Hook.HookMethodType.Before +Hook.Patch( + "Barotrauma.Item", "Combine", + { + "Barotrauma.Item", + "Barotrauma.Character" + }, + function(instance, p) + if Hook.Call("item.combine", instance, p["item"], p["user"]) == true then + p.PreventExecution = true + return false + end + end, + Hook.HookMethodType.Before ) -Hook.HookMethod( - "Barotrauma.Item", "Drop", - function (instance, p) - if Hook.Call("item.drop", instance, p.dropper) == true then - return false - end - end, - Hook.HookMethodType.Before +Hook.Patch( + "Barotrauma.Item", "Drop", + function(instance, p) + if Hook.Call("item.drop", instance, p["dropper"]) == true then + p.PreventExecution = true + return false + end + end, + Hook.HookMethodType.Before ) -Hook.HookMethod( - "Barotrauma.Item", "Equip", - { - "Barotrauma.Character" - }, - function (instance, p) - if Hook.Call("item.equip", instance, p.character) == true then - return false - end - end, - Hook.HookMethodType.Before +Hook.Patch( + "Barotrauma.Item", "Equip", + { + "Barotrauma.Character" + }, + function(instance, p) + if Hook.Call("item.equip", instance, p["character"]) == true then + p.PreventExecution = true + return false + end + end, + Hook.HookMethodType.Before ) -Hook.HookMethod( - "Barotrauma.Item", "Unequip", - { - "Barotrauma.Character" - }, - function (instance, p) - if Hook.Call("item.unequip", instance, p.character) == true then - return false - end - end, - Hook.HookMethodType.Before +Hook.Patch( + "Barotrauma.Item", "Unequip", + { + "Barotrauma.Character" + }, + function(instance, p) + if Hook.Call("item.unequip", instance, p["character"]) == true then + p.PreventExecution = true + return false + end + end, + Hook.HookMethodType.Before )