diff --git a/mobs.lua b/mobs.lua index 86112e6..cadf84d 100644 --- a/mobs.lua +++ b/mobs.lua @@ -158,7 +158,7 @@ end local function fun_caves_punch(self, puncher, time_from_last_punch, tool_capabilities, dir) if puncher and puncher.get_player_name then local player_name = puncher:get_player_name() - if player_name and fun_caves.db.status[player_name].damage_elixir and tool_capabilities and tool_capabilities.damage_groups and tool_capabilities.damage_groups.fleshy then + if player_name and player_name ~= '' and fun_caves.db.status[player_name] and fun_caves.db.status[player_name].damage_elixir and tool_capabilities and tool_capabilities.damage_groups and tool_capabilities.damage_groups.fleshy then tool_capabilities.damage_groups.fleshy = tool_capabilities.damage_groups.fleshy + fun_caves.db.status[player_name].damage_elixir.bonus end end @@ -168,7 +168,17 @@ end for _, mob in pairs(mob_stats) do if minetest.registered_entities[mob.name] then minetest.registered_entities[mob.name].on_punch_orig = minetest.registered_entities[mob.name].on_punch - minetest.registered_entities[mob.name].on_punch = fun_caves_punch + minetest.registered_entities[mob.name].on_punch = function(...) + local error = pcall(fun_caves_punch, ...) + if error ~= true then + print('***********************') + print('Fun Caves: fun_caves_punch failed with error message:') + print(error) + print(...) + print('Please report this error.') + print('***********************') + end + end minetest.registered_entities[mob.name].damage = mob.damage minetest.registered_entities[mob.name].hp_min = math.ceil(mob.hp * 0.5) minetest.registered_entities[mob.name].hp_max = math.ceil(mob.hp * 1.5)