log modificiations to the inventory of npc

This commit is contained in:
Sokomine 2021-05-17 00:45:33 +02:00
parent 0efa7f4f63
commit 2b2a12a5b1

View File

@ -84,17 +84,28 @@ yl_speak_up.load_npc_inventory = function(n_id)
return 0
end
return stack:get_count()
end
end,
-- Called when a player wants to take something out of the inventory.
-- Return value: number of items allowed to take.
-- Return value -1: Allow and don't modify item count in inventory.
-- on_move = function(inv, from_list, from_index, to_list, to_index, count, player) end,
-- on_put = function(inv, listname, index, stack, player) end,
-- on_take = function(inv, listname, index, stack, player) end,
-- Called after the actual action has happened, according to what was
-- allowed.
-- No return value.
-- log inventory changes (same way as modifications to chest inventories)
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name() ..
" moves stuff in inventory of NPC " .. tostring(n_id))
end,
on_put = function(inv, listname, index, stack, player)
minetest.log("action", player:get_player_name() ..
" moves " .. stack:get_name() ..
" to inventory of NPC " .. tostring(n_id))
end,
on_take = function(inv, listname, index, stack, player)
minetest.log("action", player:get_player_name() ..
" takes " .. stack:get_name() ..
" from inventory of NPC " .. tostring(n_id))
end,
})
-- the NPC needs enough room for trade items, payment and questitems
npc_inv:set_size("npc_main", 6*12)