diff --git a/api.lua b/api.lua index dc97354..3de37a4 100644 --- a/api.lua +++ b/api.lua @@ -2823,16 +2823,6 @@ local tr = minetest.get_modpath("toolranks") -- deal damage and effects when mob punched function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage) - -- is punch from sound detection - if hitter and hitter.type == "sound" then - - if self.on_sound then - self.on_sound(self, hitter) -- pass sound table to custom function - end - - return true - end - -- mob health check if self.health <= 0 then return true @@ -5109,14 +5099,14 @@ minetest.sound_play = function(spec, param, eph) local ent = obj:get_luaentity() - if ent and ent._cmi_is_mob then + if ent and ent._cmi_is_mob and ent.on_sound then -- calculate loudness of sound to mob op_params.distance = get_distance(op_params.pos, obj:get_pos()) op_params.loudness = op_params.gain / op_params.distance - -- run custom mob on_punch with sound information table - ent:on_punch(op_params) + -- run custom on_sound function + ent.on_sound(ent, op_params) end end end diff --git a/crafts.lua b/crafts.lua index 7174d1b..44c49cb 100644 --- a/crafts.lua +++ b/crafts.lua @@ -4,8 +4,6 @@ local FS = function(...) return minetest.formspec_escape(S(...)) end local mc2 = minetest.get_modpath("mcl_core") -- helper function to add {eatable} group to food items -local mod_tt_base = minetest.get_modpath("tt_base") -- mod does similar to infotext - function mobs.add_eatable(item, hp) local def = minetest.registered_items[item] @@ -13,16 +11,10 @@ function mobs.add_eatable(item, hp) if def then local groups = table.copy(def.groups) or {} - local txt = " (" ; if hp > 0 then txt = txt .. "+" end - txt = txt .. hp .. " HP)" groups.eatable = hp ; groups.flammable = 2 - if mod_tt_base == nil then - def.description = def.description .. txt - end - - minetest.override_item(item, {description = def.description, groups = groups}) + minetest.override_item(item, {groups = groups}) end end