mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2024-12-24 09:40:21 +01:00
Fix on_punch damage returns (thanks OgelGames)
This commit is contained in:
parent
3009da0efe
commit
67e4ede31b
14
api.lua
14
api.lua
@ -9,7 +9,7 @@ local use_cmi = minetest.global_exists("cmi")
|
||||
|
||||
mobs = {
|
||||
mod = "redo",
|
||||
version = "20200905",
|
||||
version = "20200916",
|
||||
intllib = S,
|
||||
invis = minetest.global_exists("invisibility") and invisibility or {}
|
||||
}
|
||||
@ -2685,20 +2685,20 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
|
||||
|
||||
-- mob health check
|
||||
if self.health <= 0 then
|
||||
return
|
||||
return true
|
||||
end
|
||||
|
||||
-- custom punch function
|
||||
if self.do_punch
|
||||
and self:do_punch(hitter, tflp, tool_capabilities, dir) == false then
|
||||
return
|
||||
return true
|
||||
end
|
||||
|
||||
-- error checking when mod profiling is enabled
|
||||
if not tool_capabilities then
|
||||
minetest.log("warning",
|
||||
"[mobs] Mod profiling enabled, damage not enabled")
|
||||
return
|
||||
return true
|
||||
end
|
||||
|
||||
-- is mob protected?
|
||||
@ -2709,7 +2709,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
|
||||
minetest.chat_send_player(hitter:get_player_name(),
|
||||
S("Mob has been protected!"))
|
||||
|
||||
return
|
||||
return true
|
||||
end
|
||||
|
||||
local weapon = hitter:get_wielded_item()
|
||||
@ -2770,7 +2770,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
|
||||
if use_cmi
|
||||
and cmi.notify_punch(
|
||||
self.object, hitter, tflp, tool_capabilities, dir, damage) then
|
||||
return
|
||||
return true
|
||||
end
|
||||
|
||||
-- add weapon wear
|
||||
@ -2875,7 +2875,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
|
||||
local v = self.object:get_velocity()
|
||||
|
||||
-- sanity check
|
||||
if not v then return end
|
||||
if not v then return true end
|
||||
|
||||
local kb = damage or 1
|
||||
local up = 2
|
||||
|
Loading…
Reference in New Issue
Block a user