1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2025-07-02 00:10:21 +02:00

added on_spawn function to mobs registry

This commit is contained in:
TenPlus1
2017-09-01 12:27:31 +01:00
parent f19960e5db
commit d28c410095
2 changed files with 11 additions and 1 deletions

View File

@ -2449,6 +2449,13 @@ local mob_activate = function(self, staticdata, def, dtime)
update_tag(self)
set_animation(self, "stand")
-- run on_spawn function if found
if self.on_spawn and not self.on_spawn_run then
if self.on_spawn(self) then
self.on_spawn_run = true -- if true, set flag to run once only
end
end
if use_cmi then
self._cmi_components = cmi.activate_components(self.serialized_cmi_components)
cmi.notify_activate(self.object, dtime)
@ -2687,6 +2694,8 @@ minetest.register_entity(name, {
facing_fence = false,
_cmi_is_mob = true,
on_spawn = def.on_spawn,
on_blast = def.on_blast or do_tnt,
on_step = mob_step,