added missing condition for stack max

master
Juraj Vajda 2018-11-10 20:34:36 -05:00
parent 74ce0c6078
commit 56d8bf0ca3
1 changed files with 12 additions and 0 deletions

View File

@ -685,6 +685,8 @@ minetest.register_node("basic_machines:mover", {
-- prevent item stacks with more than 'stack_max' items
if stack:get_count() > stack:get_stack_max() then
stack:set_count(stack:get_stack_max())
else
stack:set_count(stack:get_count())
end
if not stack:is_empty() then found = true break end
@ -709,6 +711,8 @@ minetest.register_node("basic_machines:mover", {
-- prevent item stacks with more than 'stack_max' items
if preferstack:get_count() > preferstack:get_stack_max() then
stack:set_count(preferstack:get_stack_max())
else
stack:set_count(preferstack:get_count())
end
found = true
@ -756,6 +760,8 @@ minetest.register_node("basic_machines:mover", {
-- prevent item stacks with more than 'stack_max' items
if stack:get_count() > stack:get_stack_max() then
stack:set_count(stack:get_stack_max())
else
stack:set_count(stack:get_count())
end
if inv:contains_item("main", stack) then
@ -1112,6 +1118,8 @@ local function use_keypad(pos,ttl, again) -- position, time to live ( how many t
local textstack = ItemStack(text)
if textstack:get_count() > textstack:get_stack_max() then
textstack:set_count(textstack:get_stack_max())
else
textstack:set_count(textstack:get_count())
end
tmeta:set_string("node", textstack:to_string());
@ -1127,6 +1135,8 @@ local function use_keypad(pos,ttl, again) -- position, time to live ( how many t
local textstack = ItemStack(text)
if textstack:get_count() > textstack:get_stack_max() then
textstack:set_count(textstack:get_stack_max())
else
textstack:set_count(textstack:get_count())
end
tmeta:set_string("prefer", textstack:to_string());
@ -2319,6 +2329,8 @@ minetest.register_on_player_receive_fields(function(player,formname,fields)
local preferstack = ItemStack(meta_prefer)
if preferstack:get_count() > preferstack:get_stack_max() then
preferstack:set_count(preferstack:get_stack_max())
else
preferstack:set_count(preferstack:get_count())
end
meta:set_string("prefer", preferstack:to_string());