Normalize machine source and destination inventory list names
This commit is contained in:
@@ -27,11 +27,11 @@ fluidGenerator.getFormspec=function(pos,config)
|
||||
local tile=(fuel and fuel.texture or "industrialtest_gui_fluid_bg.png")
|
||||
if industrialtest.mtgAvailable then
|
||||
formspec={
|
||||
"list[context;fluid;2,1.8;1,1]",
|
||||
"listring[context;fluid]",
|
||||
"list[context;src;2,1.8;1,1]",
|
||||
"listring[context;src]",
|
||||
(fluidPercent>0 and "image[2,3;1,1;industrialtest_gui_fluid_bg.png^[lowpart:"..fluidPercent..":"..tile.."]" or "image[2,3;1,1;industrialtest_gui_fluid_bg.png]"),
|
||||
"list[context;leftover;2,4.2;1,1]",
|
||||
"listring[context;leftover]",
|
||||
"list[context;dst;2,4.2;1,1]",
|
||||
"listring[context;dst]",
|
||||
"list[context;charged;6,3;1,1]",
|
||||
"listring[context;charged]",
|
||||
"box[9,1;0.3,4.8;#202020]",
|
||||
@@ -39,13 +39,13 @@ fluidGenerator.getFormspec=function(pos,config)
|
||||
}
|
||||
elseif industrialtest.mclAvailable then
|
||||
formspec={
|
||||
"list[context;fluid;2,1.8;1,1]",
|
||||
"list[context;src;2,1.8;1,1]",
|
||||
mcl_formspec.get_itemslot_bg(2,1.8,1,1),
|
||||
"listring[context;fluid]",
|
||||
"listring[context;src]",
|
||||
(fluidPercent>0 and "image[2,3;1,1;industrialtest_gui_fluid_bg.png^[lowpart:"..fluidPercent..":"..tile.."]" or "image[2,3;1,1;industrialtest_gui_fluid_bg.png]"),
|
||||
"list[context;leftover;2,4.2;1,1]",
|
||||
"list[context;dst;2,4.2;1,1]",
|
||||
mcl_formspec.get_itemslot_bg(2,4.2,1,1),
|
||||
"listring[context;leftover]",
|
||||
"listring[context;dst]",
|
||||
"list[context;charged;6,3;1,1]",
|
||||
mcl_formspec.get_itemslot_bg(6,3,1,1),
|
||||
"listring[context;charged]",
|
||||
@@ -58,14 +58,14 @@ end
|
||||
|
||||
fluidGenerator.onConstruct=function(pos,meta,inv)
|
||||
inv:set_size("charged",1)
|
||||
inv:set_size("fluid",1)
|
||||
inv:set_size("leftover",1)
|
||||
inv:set_size("src",1)
|
||||
inv:set_size("dst",1)
|
||||
meta:set_float("fluidAmount",0)
|
||||
meta:set_string("fluid","")
|
||||
end
|
||||
|
||||
fluidGenerator.onTimer=function(pos,elapsed,meta,inv,config)
|
||||
local fluidSlot=inv:get_stack("fluid",1)
|
||||
local fluidSlot=inv:get_stack("src",1)
|
||||
local chargedSlot=inv:get_stack("charged",1)
|
||||
local afterFlow,flowTransferred=industrialtest.api.powerFlow(pos)
|
||||
local shouldUpdateFormspec=false
|
||||
@@ -77,8 +77,8 @@ fluidGenerator.onTimer=function(pos,elapsed,meta,inv,config)
|
||||
local leftoverAddingSucceeded=false
|
||||
for _,item in ipairs(fuel.storageItems) do
|
||||
if item.name==fluidSlot:get_name() and item.leftover then
|
||||
if inv:room_for_item("leftover",ItemStack(item.leftover)) then
|
||||
inv:add_item("leftover",ItemStack(item.leftover))
|
||||
if inv:room_for_item("dst",ItemStack(item.leftover)) then
|
||||
inv:add_item("dst",ItemStack(item.leftover))
|
||||
leftoverAddingSucceeded=true
|
||||
end
|
||||
leftover=true
|
||||
@@ -86,7 +86,7 @@ fluidGenerator.onTimer=function(pos,elapsed,meta,inv,config)
|
||||
end
|
||||
if not leftover or leftoverAddingSucceeded then
|
||||
fluidSlot:take_item()
|
||||
inv:set_stack("fluid",1,fluidSlot)
|
||||
inv:set_stack("src",1,fluidSlot)
|
||||
meta:set_string("fluid",fuel.name)
|
||||
meta:set_float("fluidAmount",meta:get_float("fluidAmount")+1000)
|
||||
shouldUpdateFormspec=true
|
||||
@@ -127,7 +127,7 @@ fluidGenerator.metadataChange=function(pos)
|
||||
end
|
||||
|
||||
fluidGenerator.activeOnTimer=function(pos,elapsed,meta,inv,config)
|
||||
local fluidSlot=inv:get_stack("fluid",1)
|
||||
local fluidSlot=inv:get_stack("src",1)
|
||||
local chargedSlot=inv:get_stack("charged",1)
|
||||
local afterFlow,flowTransferred=industrialtest.api.powerFlow(pos)
|
||||
local shouldUpdateFormspec=false
|
||||
@@ -140,8 +140,8 @@ fluidGenerator.activeOnTimer=function(pos,elapsed,meta,inv,config)
|
||||
local leftoverAddingSucceeded=false
|
||||
for _,item in ipairs(fuel.storageItems) do
|
||||
if item.name==fluidSlot:get_name() and item.leftover then
|
||||
if inv:room_for_item("leftover",ItemStack(item.leftover)) then
|
||||
inv:add_item("leftover",ItemStack(item.leftover))
|
||||
if inv:room_for_item("dst",ItemStack(item.leftover)) then
|
||||
inv:add_item("dst",ItemStack(item.leftover))
|
||||
leftoverAddingSucceeded=true
|
||||
end
|
||||
leftover=true
|
||||
@@ -149,7 +149,7 @@ fluidGenerator.activeOnTimer=function(pos,elapsed,meta,inv,config)
|
||||
end
|
||||
if not leftover or leftoverAddingSucceeded then
|
||||
fluidSlot:take_item()
|
||||
inv:set_stack("fluid",1,fluidSlot)
|
||||
inv:set_stack("src",1,fluidSlot)
|
||||
meta:set_string("fluid",fuel.name)
|
||||
meta:set_float("fluidAmount",meta:get_float("fluidAmount")+1000)
|
||||
shouldUpdateFormspec=true
|
||||
@@ -196,7 +196,7 @@ local function registerFluidGenerator(config)
|
||||
requiresWrench=true,
|
||||
registerActiveVariant=config.registerActiveVariant,
|
||||
powerSlots={"charged"},
|
||||
storageSlots={"fluid","fluidLeftover"},
|
||||
storageSlots={"src","dst"},
|
||||
sounds="metal",
|
||||
groups={
|
||||
_industrialtest_hasPowerOutput=1
|
||||
|
||||
Reference in New Issue
Block a user