From d76d2d307ac2dcf68437e618c56c690039b50b6d Mon Sep 17 00:00:00 2001 From: general Date: Sat, 30 Mar 2024 04:02:57 -0400 Subject: [PATCH] harden spawn log message, better fix for nil checks * reported, closes https://codeberg.org/tenplus1/mobs_redo/issues/1 referece at https://github.com/Archtec-io/bugtracker/issues/130 this are not so good so implement in better way. * related to commit bf79985730cee684a1e11e4b4df0ac140d7e8980 and commit a62bfe3828bf2d6889a71ab7d906c31641593663 at https://codeberg.org/tenplus1/mobs_redo/commit/bf79985730cee684a1e11e4b4df0ac140d7e8980 and https://codeberg.org/tenplus1/mobs_redo/commit/a62bfe3828bf2d6889a71ab7d906c31641593663 --- api.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/api.lua b/api.lua index 6e296ae..21b6ac3 100644 --- a/api.lua +++ b/api.lua @@ -33,7 +33,7 @@ local use_mc2 = minetest.get_modpath("mcl_core") -- Global mobs = { mod = "redo", - version = "20231012", + version = "20231022", translate = S, intllib = S, invis = minetest.global_exists("invisibility") and invisibility or {}, node_ice = "default:ice", @@ -4196,14 +4196,16 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter local mob = minetest.add_entity(pos, name) --- print("[mobs] Spawned " .. name .. " at " --- .. minetest.pos_to_string(pos) .. " on " --- .. node.name .. " near " .. neighbors[1]) - if mob_log_spawn then - minetest.log("[MOBS] Spawned " .. name .. " at " - .. minetest.pos_to_string(pos)) + local pos_string = pos and minetest.pos_to_string(pos) or "" + + minetest.log( + "[MOBS] Spawned " + .. (name or "") + .. " at " + .. pos_string + ) end if on_spawn and mob then