Skip to content

Commit

Permalink
Fix on_punch damage returns (thanks OgelGames)
Browse files Browse the repository at this point in the history
  • Loading branch information
tenplus1 committed Sep 16, 2020
1 parent 3009da0 commit 67e4ede
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
}
Expand Down Expand Up @@ -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?
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 67e4ede

Please sign in to comment.