mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-03-20 11:10:18 +01:00
fix friendly fire bug and add provide moveresult information to do_custom
This commit is contained in:
parent
cd4fb6f2a6
commit
d290062a33
6
api.lua
6
api.lua
@ -25,7 +25,7 @@ local use_cmi = minetest.global_exists("cmi")
|
|||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20230326",
|
version = "20230327",
|
||||||
intllib = S,
|
intllib = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {}
|
invis = minetest.global_exists("invisibility") and invisibility or {}
|
||||||
}
|
}
|
||||||
@ -2961,7 +2961,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
|
|||||||
local entity = hitter and hitter:get_luaentity()
|
local entity = hitter and hitter:get_luaentity()
|
||||||
|
|
||||||
-- check if arrow from same mob, if so then do no damage
|
-- check if arrow from same mob, if so then do no damage
|
||||||
if entity and entity.name ~= self.arrow then
|
if (entity and entity.name ~= self.arrow) or hitter:is_player() then
|
||||||
self.health = self.health - floor(damage)
|
self.health = self.health - floor(damage)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -3451,7 +3451,7 @@ function mob_class:on_step(dtime, moveresult)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- run custom function (defined in mob lua file) - when false skip going any further
|
-- run custom function (defined in mob lua file) - when false skip going any further
|
||||||
if self.do_custom and self:do_custom(dtime) == false then
|
if self.do_custom and self:do_custom(dtime, moveresult) == false then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user