Normalize machine source and destination inventory list names

This commit is contained in:
2024-05-10 19:10:16 +02:00
parent 9781ce9ff1
commit 2669b7bc27
4 changed files with 68 additions and 68 deletions

View File

@@ -28,8 +28,8 @@ generator.getFormspec=function(pos)
"listring[context;charged]",
(fuelPercent>0 and "image[4.9,2.8;1,1;default_furnace_fire_bg.png^[lowpart:"..fuelPercent..":default_furnace_fire_fg.png]"
or "image[4.9,2.8;1,1;default_furnace_fire_bg.png]"),
"list[context;fuel;4.9,3.9;1,1]",
"listring[context;fuel]",
"list[context;src;4.9,3.9;1,1]",
"listring[context;src]",
"box[9,1;0.3,4.8;#202020]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or "")
}
@@ -40,9 +40,9 @@ generator.getFormspec=function(pos)
"listring[context;charged]",
(fuelPercent>0 and "image[4.7,2.8;1,1;default_furnace_fire_bg.png^[lowpart:"..fuelPercent..":default_furnace_fire_fg.png]"
or "image[4.7,2.8;1,1;default_furnace_fire_bg.png]"),
"list[context;fuel;4.7,3.9;1,1]",
"list[context;src;4.7,3.9;1,1]",
mcl_formspec.get_itemslot_bg(4.7,3.9,1,1),
"listring[context;fuel]",
"listring[context;src]",
"box[9,1;0.3,4.8;#202020]",
(charged>0 and "box[9,"..(1+4.8-(charged*4.8))..";0.3,"..(charged*4.8)..";#FF1010]" or "")
}
@@ -52,7 +52,7 @@ end
generator.onConstruct=function(pos,meta,inv)
inv:set_size("charged",1)
inv:set_size("fuel",1)
inv:set_size("src",1)
meta:set_int("fuelTime",0)
meta:set_int("maxFuelTime",1)
end
@@ -60,7 +60,7 @@ end
generator.onTimer=function(pos,elapsed,meta,inv)
local powerFlow=meta:get_int("industrialtest.powerFlow")
local chargedSlot=inv:get_stack("charged",1)
local fuelSlot=inv:get_stack("fuel",1)
local fuelSlot=inv:get_stack("src",1)
local afterFlow,flowTransferred=industrialtest.api.powerFlow(pos)
local shouldUpdateFormspec=flowTransferred
local shouldRerunTimer=(afterFlow and meta:get_int("industrialtest.powerAmount")>0)
@@ -79,7 +79,7 @@ generator.onTimer=function(pos,elapsed,meta,inv)
if output.time>0 then
meta:set_int("fuelTime",output.time)
meta:set_int("maxFuelTime",output.time)
inv:set_stack("fuel",1,after.items[1])
inv:set_stack("src",1,after.items[1])
minetest.swap_node(pos,{
name="industrialtest:generator_active",
param2=minetest.get_node(pos).param2
@@ -92,7 +92,7 @@ end
generator.activeOnTimer=function(pos,elapsed,meta,inv)
local chargedSlot=inv:get_stack("charged",1)
local fuelSlot=inv:get_stack("fuel",1)
local fuelSlot=inv:get_stack("src",1)
local afterFlow,flowTransferred=industrialtest.api.powerFlow(pos)
local shouldUpdateFormspec=flowTransferred
local shouldRerunTimer=(afterFlow and meta:get_int("industrialtest.powerAmount")>0)
@@ -111,7 +111,7 @@ generator.activeOnTimer=function(pos,elapsed,meta,inv)
if output.time>0 then
meta:set_int("fuelTime",output.time)
meta:set_int("maxFuelTime",output.time)
inv:set_stack("fuel",1,after.items[1])
inv:set_stack("src",1,after.items[1])
end
end
if meta:get_int("fuelTime")>0 then
@@ -141,7 +141,7 @@ industrialtest.internal.registerMachine({
ioConfig="oooooo",
registerActiveVariant=true,
powerSlots={"charged"},
storageSlots={"charged","fuel"},
storageSlots={"charged","src"},
sounds="metal",
groups={
_industrialtest_hasPowerOutput=1