mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-04-20 04:20:19 +02:00
add nil check on_punch
This commit is contained in:
parent
14f391bf2c
commit
ca7aeec95a
6
api.lua
6
api.lua
@ -18,7 +18,7 @@ end
|
|||||||
-- Global table
|
-- Global table
|
||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo", version = "20250312",
|
mod = "redo", version = "20250318",
|
||||||
spawning_mobs = {}, translate = S,
|
spawning_mobs = {}, translate = S,
|
||||||
node_snow = has(minetest.registered_aliases["mapgen_snow"])
|
node_snow = has(minetest.registered_aliases["mapgen_snow"])
|
||||||
or has("mcl_core:snow") or has("default:snow") or "air",
|
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)
|
function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
|
||||||
|
|
||||||
-- mob health check
|
-- mob health and nil check
|
||||||
if self.health <= 0 then return true end
|
if self.health <= 0 or not hitter then return true end
|
||||||
|
|
||||||
-- error checking when mod profiling is enabled
|
-- error checking when mod profiling is enabled
|
||||||
if not tool_capabilities then
|
if not tool_capabilities then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user