Skip to content

Commit

Permalink
possible fixed minetest-mods#57 typo on entity on_punch
Browse files Browse the repository at this point in the history
  • Loading branch information
mckaygerhard committed Oct 28, 2021
1 parent 47ecef4 commit a2c776e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions 3d_armor/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Additional fields supported by 3d_armor:
on_unequip = <function>
on_destroy = <function>
on_damage = <function>
on_punched = <function>
on_punch = <function>

armor:register_armor_group(group, base)

Expand Down Expand Up @@ -166,11 +166,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_punched = func(player, hitter, time_from_last_punch, tool_capabilities)
on_punch = func(player, hitter, time_from_last_punch, tool_capabilities)

Notes:

`on_punched` is called every time a player is punched or takes damage, `hitter`,
`on_punch` 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.
Expand Down
4 changes: 2 additions & 2 deletions 3d_armor/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,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_punched) == "function" then
damage = def.on_punched(player, hitter, time_from_last_punch,
if type(def.on_punch) == "function" then
damage = def.on_punch(player, hitter, time_from_last_punch,
tool_capabilities) ~= false and damage == true
end
if damage == true and tool_capabilities then
Expand Down

0 comments on commit a2c776e

Please sign in to comment.