mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-02-03 12:30:22 +01:00
added check for on_death() function before api's own on_die()
This commit is contained in:
parent
e9180febc6
commit
d20dfa0b41
13
api.lua
13
api.lua
@ -14,7 +14,7 @@ local use_vh1 = minetest.get_modpath("visual_harm_1ndicators")
|
|||||||
-- Global
|
-- Global
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20240425",
|
version = "20240426",
|
||||||
translate = S,
|
translate = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {},
|
invis = minetest.global_exists("invisibility") and invisibility or {},
|
||||||
node_snow = minetest.registered_aliases["mapgen_snow"]
|
node_snow = minetest.registered_aliases["mapgen_snow"]
|
||||||
@ -879,6 +879,16 @@ function mob_class:check_for_death(cmi_cause)
|
|||||||
|
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
|
||||||
|
-- execute official engine on_death function if found
|
||||||
|
if self.on_death then
|
||||||
|
|
||||||
|
self:on_death(self, cmi_cause)
|
||||||
|
|
||||||
|
remove_mob(self, true)
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
-- execute custom death function
|
-- execute custom death function
|
||||||
if pos and self.on_die then
|
if pos and self.on_die then
|
||||||
|
|
||||||
@ -3713,6 +3723,7 @@ minetest.register_entity(":" .. name, setmetatable({
|
|||||||
|
|
||||||
on_rightclick = def.on_rightclick,
|
on_rightclick = def.on_rightclick,
|
||||||
on_die = def.on_die,
|
on_die = def.on_die,
|
||||||
|
on_death = def.on_death, -- engine function for entity death
|
||||||
on_flop = def.on_flop,
|
on_flop = def.on_flop,
|
||||||
do_custom = def.do_custom,
|
do_custom = def.do_custom,
|
||||||
on_replace = def.on_replace,
|
on_replace = def.on_replace,
|
||||||
|
1
api.txt
1
api.txt
@ -336,6 +336,7 @@ enhance mob functionality and have them do many interesting things:
|
|||||||
is returned normal attack function continued.
|
is returned normal attack function continued.
|
||||||
'on_die' a function that is called when mob is killed (self, pos), also
|
'on_die' a function that is called when mob is killed (self, pos), also
|
||||||
has access to self.cause_of_death table.
|
has access to self.cause_of_death table.
|
||||||
|
'on_death' Official engine version of above when mob killed (self, cause).
|
||||||
'on_flop' function called when flying or swimmimng mob is no longer in
|
'on_flop' function called when flying or swimmimng mob is no longer in
|
||||||
air/water, (self) paramater and return true to skip the built
|
air/water, (self) paramater and return true to skip the built
|
||||||
in api flop feature.
|
in api flop feature.
|
||||||
|
@ -32,6 +32,7 @@ https://forum.minetest.net/viewtopic.php?f=11&t=9917
|
|||||||
* Added self.homing so that arrows follow player when visible
|
* Added self.homing so that arrows follow player when visible
|
||||||
* Added support for Visual Harm 1ndicators mod to show health bars
|
* Added support for Visual Harm 1ndicators mod to show health bars
|
||||||
* Added self.node_damage flag which is true by default to enable damage_per_second node damage
|
* Added self.node_damage flag which is true by default to enable damage_per_second node damage
|
||||||
|
* Added check for on_death() function before using mob api's own on_die() one
|
||||||
|
|
||||||
### Version 1.60
|
### Version 1.60
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user