mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2024-12-25 02:00: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 = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20200905",
|
version = "20200916",
|
||||||
intllib = S,
|
intllib = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {}
|
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
|
-- mob health check
|
||||||
if self.health <= 0 then
|
if self.health <= 0 then
|
||||||
return
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- custom punch function
|
-- custom punch function
|
||||||
if self.do_punch
|
if self.do_punch
|
||||||
and self:do_punch(hitter, tflp, tool_capabilities, dir) == false then
|
and self:do_punch(hitter, tflp, tool_capabilities, dir) == false then
|
||||||
return
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- error checking when mod profiling is enabled
|
-- error checking when mod profiling is enabled
|
||||||
if not tool_capabilities then
|
if not tool_capabilities then
|
||||||
minetest.log("warning",
|
minetest.log("warning",
|
||||||
"[mobs] Mod profiling enabled, damage not enabled")
|
"[mobs] Mod profiling enabled, damage not enabled")
|
||||||
return
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- is mob protected?
|
-- 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(),
|
minetest.chat_send_player(hitter:get_player_name(),
|
||||||
S("Mob has been protected!"))
|
S("Mob has been protected!"))
|
||||||
|
|
||||||
return
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local weapon = hitter:get_wielded_item()
|
local weapon = hitter:get_wielded_item()
|
||||||
@ -2770,7 +2770,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
|
|||||||
if use_cmi
|
if use_cmi
|
||||||
and cmi.notify_punch(
|
and cmi.notify_punch(
|
||||||
self.object, hitter, tflp, tool_capabilities, dir, damage) then
|
self.object, hitter, tflp, tool_capabilities, dir, damage) then
|
||||||
return
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- add weapon wear
|
-- add weapon wear
|
||||||
@ -2875,7 +2875,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
|
|||||||
local v = self.object:get_velocity()
|
local v = self.object:get_velocity()
|
||||||
|
|
||||||
-- sanity check
|
-- sanity check
|
||||||
if not v then return end
|
if not v then return true end
|
||||||
|
|
||||||
local kb = damage or 1
|
local kb = damage or 1
|
||||||
local up = 2
|
local up = 2
|
||||||
|
Loading…
Reference in New Issue
Block a user