mirror of
https://github.com/minetest-mods/unified_inventory.git
synced 2025-07-06 10:20:28 +02:00
Added the meta data field "creator" for items created in creative mode to make it possible to verify the origin of items.
This commit is contained in:
@ -152,6 +152,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
local stack = ItemStack(clicked_item)
|
local stack = ItemStack(clicked_item)
|
||||||
stack:set_count(stack:get_stack_max())
|
stack:set_count(stack:get_stack_max())
|
||||||
|
local meta = stack:get_meta()
|
||||||
|
meta:set_string("creator", player_name)
|
||||||
if inv:room_for_item("main", stack) then
|
if inv:room_for_item("main", stack) then
|
||||||
inv:add_item("main", stack)
|
inv:add_item("main", stack)
|
||||||
end
|
end
|
||||||
|
@ -438,7 +438,11 @@ local function craftguide_giveme(player, formname, fields)
|
|||||||
|
|
||||||
local player_inv = player:get_inventory()
|
local player_inv = player:get_inventory()
|
||||||
|
|
||||||
player_inv:add_item("main", {name = output, count = amount})
|
local itemstack = ItemStack({name = output, count = amount})
|
||||||
|
local meta = itemstack:get_meta()
|
||||||
|
meta:set_string("creator", player_name)
|
||||||
|
|
||||||
|
player_inv:add_item("main", itemstack)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function craftguide_craft(player, formname, fields)
|
local function craftguide_craft(player, formname, fields)
|
||||||
|
Reference in New Issue
Block a user