diff --git a/api.lua b/api.lua index ac5a956..100927e 100644 --- a/api.lua +++ b/api.lua @@ -92,6 +92,7 @@ local mob_chance_multiplier = tonumber(settings:get("mob_chance_multiplier") or local peaceful_player_enabled = settings:get_bool("enable_peaceful_player") local mob_smooth_rotate = settings:get_bool("mob_smooth_rotate") ~= false local mob_height_fix = settings:get_bool("mob_height_fix") ~= false +local mob_log_spawn = settings:get_bool("mob_log_spawn") == true local active_mobs = 0 -- get loop timers for node and main functions @@ -4161,6 +4162,12 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter -- .. 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)) + end + if on_spawn and mob then on_spawn(mob:get_luaentity(), pos) end diff --git a/api.txt b/api.txt index cf04172..8d7c645 100644 --- a/api.txt +++ b/api.txt @@ -744,6 +744,7 @@ the tools own meta to override the default. External Settings for "minetest.conf" ------------------------------------ + 'mob_log_spawn' When True will log spawning position of mobs. 'mob_node_timer_interval' How often mobs get nodes around them (0.25 is default) for every 1/4 second. 'mob_main_timer_interval' How often mobs run main functions (1.0 is default) for diff --git a/mount.lua b/mount.lua index 31b86dd..3341f65 100644 --- a/mount.lua +++ b/mount.lua @@ -19,9 +19,10 @@ local is_mc2 = minetest.get_modpath("mcl_mobs") -- MineClone2 compatibility -- are we a real player ? local function is_player(player) - if player and type(player) == "userdata" and minetest.is_player(player) then - return true + if player then + if type(player) == "userdata" then return true end end + return false end diff --git a/readme.MD b/readme.MD index f291242..803df73 100644 --- a/readme.MD +++ b/readme.MD @@ -39,6 +39,7 @@ Zeg9, ExeterDad and AspireMint. * Added 'mobs_attack_creatura' setting so that monsters can attack Creatura mobs * Nodes can be added to 'runaway_from' table * Better Mineclone2 compatibility with api, items and recipes +* Added 'mob_log_spawn' setting to log spawning of mobs and position ### Version 1.56 diff --git a/settingtypes.txt b/settingtypes.txt index 18db2bf..fcec162 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -58,6 +58,8 @@ mob_smooth_rotate (Smooth rotation for mobs) bool true # Fix Mob Height if too low so they cannot escape through specific nodes mob_height_fix (Fix Mob Height) bool true +mob_log_spawn (Log Mob Spawning) bool false + [Pathfinding] # Enable pathfinding (default Enabled) mob_pathfinding_enable (Enable pathfinding) bool true