forked from VoxeLibre/VoxeLibre
Make logging of mob spawning configurable
This commit is contained in:
parent
786cea122d
commit
51e244fe35
|
@ -51,6 +51,7 @@ local show_health = false
|
||||||
|
|
||||||
-- Shows helpful debug info above each mob
|
-- Shows helpful debug info above each mob
|
||||||
local mobs_debug = minetest.settings:get_bool("mobs_debug", false)
|
local mobs_debug = minetest.settings:get_bool("mobs_debug", false)
|
||||||
|
local spawn_logging = minetest.settings:get_bool("mcl_logging_mobs_spawn",true)
|
||||||
|
|
||||||
-- Peaceful mode message so players will know there are no monsters
|
-- Peaceful mode message so players will know there are no monsters
|
||||||
if minetest.settings:get_bool("only_peaceful_mobs", false) then
|
if minetest.settings:get_bool("only_peaceful_mobs", false) then
|
||||||
|
@ -3404,7 +3405,9 @@ local mob_staticdata = function(self)
|
||||||
and self.remove_ok
|
and self.remove_ok
|
||||||
and ((not self.nametag) or (self.nametag == ""))
|
and ((not self.nametag) or (self.nametag == ""))
|
||||||
and self.lifetimer <= 20 then
|
and self.lifetimer <= 20 then
|
||||||
minetest.log("action", "Mob "..tostring(self.name).." despawns in mob_staticdata at "..minetest.pos_to_string(self.object:get_pos()))
|
if spawn_logging then
|
||||||
|
minetest.log("action", "[mcl_mobs] Mob "..tostring(self.name).." despawns in mob_staticdata at "..minetest.pos_to_string(self.object:get_pos()))
|
||||||
|
end
|
||||||
mcl_burning.extinguish(self.object)
|
mcl_burning.extinguish(self.object)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
|
||||||
|
@ -3833,7 +3836,9 @@ local mob_step = function(self, dtime)
|
||||||
and self.state ~= "attack"
|
and self.state ~= "attack"
|
||||||
and self.following == nil then
|
and self.following == nil then
|
||||||
if self.despawn_immediately or self.lifetimer <= 0 then
|
if self.despawn_immediately or self.lifetimer <= 0 then
|
||||||
minetest.log("action", "Mob "..self.name.." despawns in mob_step at "..minetest.pos_to_string(pos, 1))
|
if spawn_logging then
|
||||||
|
minetest.log("action", "[mcl_mobs] Mob "..self.name.." despawns in mob_step at "..minetest.pos_to_string(pos, 1))
|
||||||
|
end
|
||||||
mcl_burning.extinguish(self.object)
|
mcl_burning.extinguish(self.object)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return
|
return
|
||||||
|
|
|
@ -39,6 +39,7 @@ local mob_cap = {
|
||||||
--do mobs spawn?
|
--do mobs spawn?
|
||||||
local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false
|
local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false
|
||||||
local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false
|
local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false
|
||||||
|
local logging = minetest.settings:get_bool("mcl_logging_mobs_spawn",true)
|
||||||
|
|
||||||
local noise_params = {
|
local noise_params = {
|
||||||
offset = 0,
|
offset = 0,
|
||||||
|
@ -456,8 +457,8 @@ local function spawn_check(pos,spawn_def)
|
||||||
and (spawn_def.check_position and spawn_def.check_position(pos) or true)
|
and (spawn_def.check_position and spawn_def.check_position(pos) or true)
|
||||||
and (not is_farm_animal(spawn_def.name) or is_grass)
|
and (not is_farm_animal(spawn_def.name) or is_grass)
|
||||||
and (spawn_def.type_of_spawning ~= "water" or is_water)
|
and (spawn_def.type_of_spawning ~= "water" or is_water)
|
||||||
and not spawn_protected or not minetest.is_protected(s, "")
|
and ( not spawn_protected or not minetest.is_protected(s, "") )
|
||||||
and not is_bedrock
|
and not is_bedrock then
|
||||||
--only need to poll for node light if everything else worked
|
--only need to poll for node light if everything else worked
|
||||||
local gotten_light = get_node_light(pos)
|
local gotten_light = get_node_light(pos)
|
||||||
if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then
|
if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then
|
||||||
|
@ -562,11 +563,16 @@ if mobs_spawn then
|
||||||
--everything is correct, spawn mob
|
--everything is correct, spawn mob
|
||||||
local object
|
local object
|
||||||
if spawn_in_group and ( mob_type ~= "monster" or math.random(5) == 1 ) then
|
if spawn_in_group and ( mob_type ~= "monster" or math.random(5) == 1 ) then
|
||||||
|
if logging then
|
||||||
|
minetest.log("action", "[mcl_mobs] A group of mob " .. mob_def.name .. " spawns at " .. minetest.pos_to_string(spawning_position, 1))
|
||||||
|
end
|
||||||
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)
|
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
|
else
|
||||||
|
if logging then
|
||||||
|
minetest.log("action", "[mcl_mobs] Mob " .. mob_def.name .. " spawns at " .. minetest.pos_to_string(spawning_position, 1))
|
||||||
|
end
|
||||||
object = mcl_mobs.spawn(spawning_position, mob_def.name)
|
object = mcl_mobs.spawn(spawning_position, mob_def.name)
|
||||||
minetest.log("action", "Mob " .. mob_def.name .. " spawns at " .. minetest.pos_to_string(spawning_position, 1))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -182,3 +182,6 @@ mcl_enable_fapples (Enable swiftness on enchanted golden apples) bool true
|
||||||
[Debugging]
|
[Debugging]
|
||||||
# If enabled, this will show the itemstring of an item in the description.
|
# If enabled, this will show the itemstring of an item in the description.
|
||||||
mcl_item_id_debug (Item ID Debug) bool false
|
mcl_item_id_debug (Item ID Debug) bool false
|
||||||
|
|
||||||
|
#Log mob spawning and despawning events
|
||||||
|
mcl_logging_mobs_spawn (Log Mob Spawning) bool true
|
||||||
|
|
Loading…
Reference in New Issue