mirror of
https://github.com/ZNixian/equivalent_exchange.git
synced 2024-12-25 22:52:23 +01:00
added stack overflow handling
This commit is contained in:
parent
307f571c7f
commit
6fd6a59abd
@ -31,7 +31,12 @@ condenser = {
|
||||
local timesOver = math.floor(emc / target_emc)
|
||||
emc = emc - timesOver * target_emc
|
||||
meta:set_int("emc", emc)
|
||||
inventory:add_item("from", {name=target.name, count = timesOver})
|
||||
for i = 1, timesOver do
|
||||
inventory:add_item("from", {name = target.name, count = 99})
|
||||
end
|
||||
if timesOver % 99 > 0 then
|
||||
inventory:add_item("from", {name = target.name, count = timesOver % 99})
|
||||
end
|
||||
meta:set_string("formspec", condenser.get_formspec(emc, target_emc))
|
||||
end,
|
||||
|
||||
|
@ -25,6 +25,7 @@ collector = {
|
||||
end
|
||||
if emc_transferable_nodes_length == 0 then
|
||||
local generate_amount = math.floor(emc / 10)
|
||||
local timesOver = math.floor(generate_amount / 99)
|
||||
local inventory = meta:get_inventory()
|
||||
local size = inventory:get_size("container")
|
||||
if emc >= 10 then
|
||||
@ -42,7 +43,12 @@ collector = {
|
||||
"label[4,0;EMC Stored: "..emc - 10*generate_amount.."]"..
|
||||
"list[current_name;container;0,0.5;8,7;]")
|
||||
end
|
||||
inventory:add_item("container",modname.."klein_star "..generate_amount)
|
||||
for i = 1, timesOver do
|
||||
inventory:add_item("container", {name = modname.."klein_star", count = 99})
|
||||
end
|
||||
if timesOver % 99 > 0 then
|
||||
inventory:add_item("container", {name = modname.."klein_star", count = timesOver % 99})
|
||||
end
|
||||
end
|
||||
end
|
||||
local newemc = (collector.emc_gather(emc, mark, multiplier))
|
||||
|
Loading…
Reference in New Issue
Block a user