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 bf79985730
  and a62bfe3828
main
general 2024-03-30 04:02:57 -04:00
parent 4bf2555144
commit d76d2d307a
1 changed files with 9 additions and 7 deletions

16
api.lua
View File

@ -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