Merge pull request 'Fix Mob Spawn Logging' (#2619) from fix_mob_logging into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2619
Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
cora 2022-09-02 10:07:14 +00:00
commit 1fbdcc7426
2 changed files with 4 additions and 1 deletions

@ -4339,7 +4339,8 @@ function mcl_mobs:register_egg(mob, desc, background, addegg, no_creative)
pos.y = pos.y - 0.5
local mob = minetest.add_entity(pos, mob)
minetest.log("action", "Mob spawned: "..name.." at "..minetest.pos_to_string(pos))
local entityname = itemstack:get_name()
minetest.log("action", "Player " ..name.." spawned "..entityname.." at "..minetest.pos_to_string(pos))
local ent = mob:get_luaentity()
-- don't set owner if monster or sneak pressed

@ -538,8 +538,10 @@ if mobs_spawn then
local object
if spawn_in_group and ( mob_type ~= "monster" or math.random(5) == 1 ) then
object = spawn_group(spawning_position,mob_def,{minetest.get_node(vector.offset(spawning_position,0,-1,0)).name},spawn_in_group,spawn_in_group_min)
minetest.log("action", "A group of mob " .. mob_def.name .. " spawns at " .. minetest.pos_to_string(spawning_position, 1))
else
object = minetest.add_entity(spawning_position, mob_def.name)
minetest.log("action", "Mob " .. mob_def.name .. " spawns at " .. minetest.pos_to_string(spawning_position, 1))
end