1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-11-15 22:40:19 +01:00

add setting enable_non_player_action_log

This commit is contained in:
nixnoxus 2022-04-02 07:02:52 +02:00
parent 8b8c693edd
commit e5a1343048
3 changed files with 19 additions and 3 deletions

View File

@ -75,3 +75,6 @@ default:torch 99,default:cobble 99
# Enable cloud variation by the 'weather' mod.
# Non-functional in V6 or Singlenode mapgens.
#enable_weather = true
# If enabled, non-player actions are logged
#enable_non_player_action_log = false

View File

@ -758,11 +758,21 @@ function default.can_interact_with_node(player, pos)
return false
end
local non_player_action_log = minetest.settings:get_bool("enable_non_player_action_log") or false
function default.log_action(player, pos, message)
-- only log actions of real players
local who = player and player:get_player_name() or "(something)"
if player and not player.is_fake_player and player:is_player() then
minetest.log("action", player:get_player_name() ..
" " .. message .. " at " .. minetest.pos_to_string(pos))
-- log action of real player
minetest.log("action", who .. " " .. message .. " at " .. minetest.pos_to_string(pos))
elseif non_player_action_log ~= false then
-- log action of non real player
if player and player.is_fake_player and type(player.is_fake_player) == "string" then
who = who .. "(" .. player.is_fake_player .. ")"
else
who = who .. "(*)"
end
minetest.log("action", who .. " " .. message .. " at " .. minetest.pos_to_string(pos))
end
end

View File

@ -75,3 +75,6 @@ river_source_sounds (River source node sounds) bool false
# Enable cloud variation by the 'weather' mod.
# Non-functional in V6 or Singlenode mapgens.
enable_weather (Enable weather) bool true
# If enabled, non-player actions are logged
enable_non_player_action_log (Log non-player action) bool false