1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2025-04-17 19:20:22 +02:00

add nil check on_punch

This commit is contained in:
tenplus1 2025-03-18 08:06:40 +00:00
parent 14f391bf2c
commit ca7aeec95a

View File

@ -18,7 +18,7 @@ end
-- Global table
mobs = {
mod = "redo", version = "20250312",
mod = "redo", version = "20250318",
spawning_mobs = {}, translate = S,
node_snow = has(minetest.registered_aliases["mapgen_snow"])
or has("mcl_core:snow") or has("default:snow") or "air",
@ -2525,8 +2525,8 @@ local dis_damage_kb = settings:get_bool("mobs_disable_damage_kb")
function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
-- mob health check
if self.health <= 0 then return true end
-- mob health and nil check
if self.health <= 0 or not hitter then return true end
-- error checking when mod profiling is enabled
if not tool_capabilities then