Added conversion for OnAttacked and OnDeath handlers and added new hook character.damageLimb
This commit is contained in:
@@ -1,87 +1,77 @@
|
||||
|
||||
Hook.Patch(
|
||||
"Barotrauma.Item", "TryInteract",
|
||||
{
|
||||
Hook.Patch("Barotrauma.Item", "TryInteract",
|
||||
{
|
||||
"Barotrauma.Character",
|
||||
"System.Boolean",
|
||||
"System.Boolean",
|
||||
"System.Boolean"
|
||||
},
|
||||
function(instance, p)
|
||||
},
|
||||
function(instance, p)
|
||||
if Hook.Call("item.interact", instance, p["user"], p["ignoreRequiredItems"], p["forceSelectKey"], p["forceUseKey"]) == true then
|
||||
p.PreventExecution = true
|
||||
return false
|
||||
p.PreventExecution = true
|
||||
return false
|
||||
end
|
||||
end,
|
||||
Hook.HookMethodType.Before
|
||||
)
|
||||
end, Hook.HookMethodType.Before)
|
||||
|
||||
Hook.Patch(
|
||||
"Barotrauma.Item", "ApplyTreatment",
|
||||
{
|
||||
Hook.Patch("Barotrauma.Item", "ApplyTreatment",
|
||||
{
|
||||
"Barotrauma.Character",
|
||||
"Barotrauma.Character",
|
||||
"Barotrauma.Limb"
|
||||
},
|
||||
function(instance, p)
|
||||
},
|
||||
function(instance, p)
|
||||
if Hook.Call("item.applyTreatment", instance, p["user"], p["character"], p["targetLimb"]) then
|
||||
p.PreventExecution = true
|
||||
return false
|
||||
p.PreventExecution = true
|
||||
return false
|
||||
end
|
||||
end,
|
||||
Hook.HookMethodType.Before
|
||||
)
|
||||
end, Hook.HookMethodType.Before)
|
||||
|
||||
Hook.Patch(
|
||||
"Barotrauma.Item", "Combine",
|
||||
{
|
||||
Hook.Patch("Barotrauma.Item", "Combine",
|
||||
{
|
||||
"Barotrauma.Item",
|
||||
"Barotrauma.Character"
|
||||
},
|
||||
function(instance, p)
|
||||
},
|
||||
function(instance, p)
|
||||
if Hook.Call("item.combine", instance, p["item"], p["user"]) == true then
|
||||
p.PreventExecution = true
|
||||
return false
|
||||
p.PreventExecution = true
|
||||
return false
|
||||
end
|
||||
end,
|
||||
Hook.HookMethodType.Before
|
||||
)
|
||||
end, Hook.HookMethodType.Before)
|
||||
|
||||
Hook.Patch(
|
||||
"Barotrauma.Item", "Drop",
|
||||
function(instance, p)
|
||||
Hook.Patch("Barotrauma.Item", "Drop",
|
||||
function(instance, p)
|
||||
if Hook.Call("item.drop", instance, p["dropper"]) == true then
|
||||
p.PreventExecution = true
|
||||
return false
|
||||
p.PreventExecution = true
|
||||
return false
|
||||
end
|
||||
end,
|
||||
Hook.HookMethodType.Before
|
||||
)
|
||||
end, Hook.HookMethodType.Before)
|
||||
|
||||
Hook.Patch(
|
||||
"Barotrauma.Item", "Equip",
|
||||
{
|
||||
Hook.Patch("Barotrauma.Item", "Equip",
|
||||
{
|
||||
"Barotrauma.Character"
|
||||
},
|
||||
function(instance, p)
|
||||
},
|
||||
function(instance, p)
|
||||
if Hook.Call("item.equip", instance, p["character"]) == true then
|
||||
p.PreventExecution = true
|
||||
return false
|
||||
p.PreventExecution = true
|
||||
return false
|
||||
end
|
||||
end,
|
||||
Hook.HookMethodType.Before
|
||||
)
|
||||
end, Hook.HookMethodType.Before)
|
||||
|
||||
Hook.Patch(
|
||||
"Barotrauma.Item", "Unequip",
|
||||
{
|
||||
Hook.Patch("Barotrauma.Item", "Unequip",
|
||||
{
|
||||
"Barotrauma.Character"
|
||||
},
|
||||
function(instance, p)
|
||||
},
|
||||
function(instance, p)
|
||||
if Hook.Call("item.unequip", instance, p["character"]) == true then
|
||||
p.PreventExecution = true
|
||||
return false
|
||||
p.PreventExecution = true
|
||||
return false
|
||||
end
|
||||
end,
|
||||
Hook.HookMethodType.Before
|
||||
)
|
||||
end, Hook.HookMethodType.Before)
|
||||
|
||||
Hook.Patch("Barotrauma.Character", "DamageLimb", function(instance, p)
|
||||
local result = Hook.Call("character.damageLimb", instance, p["afflictions"], p["attacker"], p["hitLimb"], p["worldPosition"], p["stun"], p["attackImpulse"], p["damageMultiplier"], p["allowStacking"], p["penetration"], p["shouldImplode"], p["playSound"])
|
||||
|
||||
if result == true then
|
||||
p.PreventExecution = true
|
||||
return false
|
||||
end
|
||||
end, Hook.HookMethodType.Before)
|
||||
|
||||
Reference in New Issue
Block a user