1
0
mirror of https://github.com/minetest/minetest_game.git synced 2025-06-30 22:00:22 +02:00

add default.set_inventory_action_loggers function

This commit is contained in:
nixnoxus
2022-04-02 04:46:38 +02:00
parent 9d171b268c
commit 8b8c693edd
4 changed files with 22 additions and 38 deletions

View File

@ -765,3 +765,16 @@ function default.log_action(player, pos, message)
" " .. message .. " at " .. minetest.pos_to_string(pos))
end
end
function default.set_inventory_action_loggers(def, name)
def.on_metadata_inventory_move = function(pos, from_list, from_index,
to_list, to_index, count, player)
default.log_action(player, pos, "moves stuff in " .. name)
end
def.on_metadata_inventory_put = function(pos, listname, index, stack, player)
default.log_action(player, pos, "moves " .. stack:get_name() .. " to " .. name)
end
def.on_metadata_inventory_take = function(pos, listname, index, stack, player)
default.log_action(player, pos, "takes " .. stack:get_name() .. " from " .. name)
end
end