prevent reorganization of items with "stack_max = 1"
some of them have associated metadata that gets cleare in the reorganization fixes #8
This commit is contained in:
parent
2b09f0f0a0
commit
e286047f5e
@ -68,6 +68,15 @@ local function craft_organize(player, formname, fields)
|
|||||||
if not type_name then return end -- craft is empty
|
if not type_name then return end -- craft is empty
|
||||||
if not only_one_type then minetest.chat_send_player(player_name, "You can only organize one type of item.") return end
|
if not only_one_type then minetest.chat_send_player(player_name, "You can only organize one type of item.") return end
|
||||||
|
|
||||||
|
local itemdef = minetest.registered_items[type_name]
|
||||||
|
if itemdef and itemdef.stack_max == 1 then
|
||||||
|
-- disallow non-stackable items
|
||||||
|
-- most of them have assiciated metadata which gets cleared in the reordering
|
||||||
|
minetest.chat_send_player(player_name, "You can only organize stackable items.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Don't exceed 9*99 for non creative players. It shouldn't happen but avoids potential losses then
|
-- Don't exceed 9*99 for non creative players. It shouldn't happen but avoids potential losses then
|
||||||
local total_amount = get_total_amount(craft_list)
|
local total_amount = get_total_amount(craft_list)
|
||||||
if not is_creative and total_amount > 891 then minetest.chat_send_player(player_name, "There are too many items to organize ! Have less than 9 x 99 items.") return end
|
if not is_creative and total_amount > 891 then minetest.chat_send_player(player_name, "There are too many items to organize ! Have less than 9 x 99 items.") return end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user