From 19d6d43b396ed1c70d738e5aab98f4d9a319e0db Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 11 Nov 2022 00:30:25 +0100 Subject: [PATCH] move on_blast default to mob default def --- mods/ENTITIES/mcl_mobs/api.lua | 8 -------- mods/ENTITIES/mcl_mobs/init.lua | 9 +++++++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 6c654c2bc6..d4563f4f78 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -520,15 +520,7 @@ function mob_class:on_step(dtime) end --- default function when mobs are blown up with TNT -local function do_tnt(self,damage) - self.object:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = damage}, - }, nil) - return false, true, {} -end local timer = 0 minetest.register_globalstep(function(dtime) diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index 106790a267..81ba5521d3 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -280,9 +280,14 @@ minetest.register_entity(name, setmetatable({ noyaw = def.noyaw or false, particlespawners = def.particlespawners, -- End of MCL2 extensions - on_spawn = def.on_spawn, - on_blast = def.on_blast or do_tnt, + on_blast = def.on_blast or function(self,damage) + self.object:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = damage}, + }, nil) + return false, true, {} + end, do_punch = def.do_punch, on_breed = def.on_breed, on_grown = def.on_grown,