use `default.log_player_action`

This commit is contained in:
nixnoxus 2022-04-21 15:13:27 +02:00
parent 4e11628982
commit 86a4b7ccb7
4 changed files with 10 additions and 15 deletions

View File

@ -2057,10 +2057,10 @@ local function coral_on_place(itemstack, placer, pointed_thing)
if minetest.is_protected(pos_under, player_name) or
minetest.is_protected(pos_above, player_name) then
minetest.log("action", player_name
.. " tried to place " .. itemstack:get_name()
default.log_player_action(placer,
"tried to place " .. itemstack:get_name()
.. " at protected position "
.. minetest.pos_to_string(pos_under))
, pos_under)
minetest.record_protection_violation(pos_under, player_name)
return itemstack
end
@ -2602,8 +2602,8 @@ local function register_sign(material, desc, def)
minetest.chat_send_player(player_name, S("Text too long"))
return
end
minetest.log("action", player_name .. " wrote \"" .. text ..
"\" to the sign at " .. minetest.pos_to_string(pos))
default.log_player_action(sender, "wrote \"" .. text ..
"\" to the sign", pos)
local meta = minetest.get_meta(pos)
meta:set_string("text", text)

View File

@ -572,8 +572,7 @@ function default.sapling_on_place(itemstack, placer, pointed_thing,
return itemstack
end
minetest.log("action", player_name .. " places node "
.. sapling_name .. " at " .. minetest.pos_to_string(pos))
default.log_player_action(placer, "places node " .. sapling_name, pos)
local take_item = not minetest.is_creative_enabled(player_name)
local newnode = {name = sapling_name}

View File

@ -178,8 +178,7 @@ farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
end
-- add the node and remove 1 item from the itemstack
minetest.log("action", player_name .. " places node " .. plantname .. " at " ..
minetest.pos_to_string(pt.above))
default.log_player_action(placer, "places node " .. plantname, pt.above)
minetest.add_node(pt.above, {name = plantname, param2 = 1})
tick(pt.above)
if not minetest.is_creative_enabled(player_name) then

View File

@ -465,9 +465,7 @@ minetest.register_node("tnt:gunpowder", {
on_punch = function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "default:torch" then
minetest.set_node(pos, {name = "tnt:gunpowder_burning"})
minetest.log("action", puncher:get_player_name() ..
" ignites tnt:gunpowder at " ..
minetest.pos_to_string(pos))
default.log_player_action(puncher, "ignites tnt:gunpowder", pos)
end
end,
on_blast = function(pos, intensity)
@ -635,9 +633,8 @@ function tnt.register_tnt(def)
if puncher:get_wielded_item():get_name() == "default:torch" then
minetest.swap_node(pos, {name = name .. "_burning"})
minetest.registered_nodes[name .. "_burning"].on_construct(pos)
minetest.log("action", puncher:get_player_name() ..
" ignites " .. node.name .. " at " ..
minetest.pos_to_string(pos))
default.log_player_action(puncher,
"ignites " .. node.name, pos)
end
end,
on_blast = function(pos, intensity)