mirror of
https://github.com/minetest/minetest_game.git
synced 2024-11-15 22:40:19 +01:00
add default.log_action
function
This commit is contained in:
parent
659895c3ed
commit
876a2f7cef
|
@ -224,18 +224,13 @@ function default.chest.register_chest(prefixed_name, d)
|
|||
|
||||
def.on_metadata_inventory_move = function(pos, from_list, from_index,
|
||||
to_list, to_index, count, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" moves stuff in chest at " .. minetest.pos_to_string(pos))
|
||||
default.log_action(player, pos, "moves stuff in chest")
|
||||
end
|
||||
def.on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" moves " .. stack:get_name() ..
|
||||
" to chest at " .. minetest.pos_to_string(pos))
|
||||
default.log_action(player, pos, "moves " .. stack:get_name() .. " to chest")
|
||||
end
|
||||
def.on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" takes " .. stack:get_name() ..
|
||||
" from chest at " .. minetest.pos_to_string(pos))
|
||||
default.log_action(player, pos, "takes " .. stack:get_name() .. " from chest")
|
||||
end
|
||||
|
||||
local def_opened = table.copy(def)
|
||||
|
|
|
@ -717,8 +717,8 @@ end
|
|||
|
||||
|
||||
--
|
||||
-- NOTICE: This method is not an official part of the API yet.
|
||||
-- This method may change in future.
|
||||
-- NOTICE: This methods are not an official part of the API yet.
|
||||
-- This methods may change in future.
|
||||
--
|
||||
|
||||
function default.can_interact_with_node(player, pos)
|
||||
|
@ -757,3 +757,11 @@ function default.can_interact_with_node(player, pos)
|
|||
|
||||
return false
|
||||
end
|
||||
|
||||
function default.log_action(player, pos, message)
|
||||
-- only log actions of real players
|
||||
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))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2551,18 +2551,15 @@ minetest.register_node("default:bookshelf", {
|
|||
return 0
|
||||
end,
|
||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" moves stuff in bookshelf at " .. minetest.pos_to_string(pos))
|
||||
default.log_action(player, pos, "moves stuff in bookshelf")
|
||||
update_bookshelf(pos)
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" puts stuff to bookshelf at " .. minetest.pos_to_string(pos))
|
||||
default.log_action(player, pos, "puts stuff to bookshelf")
|
||||
update_bookshelf(pos)
|
||||
end,
|
||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" takes stuff from bookshelf at " .. minetest.pos_to_string(pos))
|
||||
default.log_action(player, pos, "takes stuff from bookshelf")
|
||||
update_bookshelf(pos)
|
||||
end,
|
||||
on_blast = function(pos)
|
||||
|
|
|
@ -75,18 +75,15 @@ minetest.register_node("vessels:shelf", {
|
|||
return 0
|
||||
end,
|
||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" moves stuff in vessels shelf at ".. minetest.pos_to_string(pos))
|
||||
default.log_action(player, pos, "moves stuff in vessels shelf")
|
||||
update_vessels_shelf(pos)
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" moves stuff to vessels shelf at ".. minetest.pos_to_string(pos))
|
||||
default.log_action(player, pos, "moves stuff to vessels shelf")
|
||||
update_vessels_shelf(pos)
|
||||
end,
|
||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" takes stuff from vessels shelf at ".. minetest.pos_to_string(pos))
|
||||
default.log_action(player, pos, "takes stuff from vessels shelf")
|
||||
update_vessels_shelf(pos)
|
||||
end,
|
||||
on_blast = function(pos)
|
||||
|
|
Loading…
Reference in New Issue
Block a user