mirror of
https://github.com/minetest-mods/3d_armor.git
synced 2024-12-27 03:00:40 +01:00
Rename on_punch callback to avoid potential conflict with nodes
This commit is contained in:
parent
a11b3302e1
commit
1af0bb60f8
@ -90,7 +90,7 @@ Additional fields supported by 3d_armor:
|
||||
on_unequip = <function>
|
||||
on_destroy = <function>
|
||||
on_damage = <function>
|
||||
on_punch = <function>
|
||||
on_punched = <function>
|
||||
|
||||
armor:register_armor_group(group, base)
|
||||
|
||||
@ -163,11 +163,11 @@ on_equip = func(player, index, stack)
|
||||
on_unequip = func(player, index, stack)
|
||||
on_destroy = func(player, index, stack)
|
||||
on_damage = func(player, index, stack)
|
||||
on_punch = func(player, hitter, time_from_last_punch, tool_capabilities)
|
||||
on_punched = func(player, hitter, time_from_last_punch, tool_capabilities)
|
||||
|
||||
Notes:
|
||||
|
||||
`on_punch` is called every time a player is punched or takes damage, `hitter`,
|
||||
`on_punched` is called every time a player is punched or takes damage, `hitter`,
|
||||
`time_from_last_punch` and `tool_capabilities` can be `nil` and will be in the
|
||||
case of fall damage, etc. When fire protection is enabled, hitter == "fire"
|
||||
in the event of fire damage. Return `false` to override armor damage effects.
|
||||
|
@ -305,8 +305,8 @@ armor.punch = function(self, player, hitter, time_from_last_punch, tool_capabili
|
||||
local use = minetest.get_item_group(name, "armor_use") or 0
|
||||
local damage = use > 0
|
||||
local def = stack:get_definition() or {}
|
||||
if type(def.on_punch) == "function" then
|
||||
damage = def.on_punch(player, hitter, time_from_last_punch,
|
||||
if type(def.on_punched) == "function" then
|
||||
damage = def.on_punched(player, hitter, time_from_last_punch,
|
||||
tool_capabilities) ~= false and damage == true
|
||||
end
|
||||
if damage == true and tool_capabilities then
|
||||
|
@ -29,7 +29,7 @@ armor:register_armor("shields:shield_admin", {
|
||||
description = S("Admin Shield"),
|
||||
inventory_image = "shields_inv_shield_admin.png",
|
||||
groups = {armor_shield=1000, armor_heal=100, armor_use=0, not_in_creative_inventory=1},
|
||||
on_punch = function(player, hitter, time_from_last_punch, tool_capabilities)
|
||||
on_punched = function(player, hitter, time_from_last_punch, tool_capabilities)
|
||||
if type(hitter) == "userdata" then
|
||||
if hitter:is_player() then
|
||||
hitter:set_wielded_item("")
|
||||
|
Loading…
Reference in New Issue
Block a user