Compare commits
13 Commits
master
...
hopper-com
Author | SHA1 | Date | |
---|---|---|---|
804b40e2bd | |||
217805dce7 | |||
49bbc34899 | |||
dca66372ea | |||
3bba2a9cfe | |||
9b8538bec9 | |||
13c8748f0d | |||
8fe44e76ae | |||
b3f890e339 | |||
39855a61b2 | |||
dff0af2c2e | |||
10b415b735 | |||
36b792bd2a |
@ -197,13 +197,13 @@ if industrialtest.mclAvailable then
|
||||
count=2
|
||||
})
|
||||
end
|
||||
industrialtest.api.registerResourceDust("coal","Coal",resources,"#101010ff",true)
|
||||
industrialtest.api.registerResourceDust("coal","Coal",resources,"#262523ff",true)
|
||||
industrialtest.api.registerResourceDust("clay","Clay",{
|
||||
{
|
||||
resource=industrialtest.elementKeys.clayBlock,
|
||||
count=2
|
||||
}
|
||||
},"#9090a0ff",true)
|
||||
},"#707070ff",true)
|
||||
resources={
|
||||
{
|
||||
resource=industrialtest.elementKeys.diamondBlock,
|
||||
@ -221,7 +221,7 @@ if industrialtest.mclAvailable then
|
||||
count=2
|
||||
})
|
||||
end
|
||||
industrialtest.api.registerResourceDust("diamond","Diamond",resources,"#90e2c9ff",true)
|
||||
industrialtest.api.registerResourceDust("diamond","Diamond",resources,"#77cefbff",true)
|
||||
minetest.register_craft({
|
||||
type="cooking",
|
||||
output=industrialtest.elementKeys.diamond,
|
||||
@ -248,7 +248,7 @@ if industrialtest.mclAvailable then
|
||||
count=2
|
||||
})
|
||||
end
|
||||
industrialtest.api.registerResourceDust("iron","Iron",resources,"#b5b5b5ff",true)
|
||||
industrialtest.api.registerResourceDust("iron","Iron",resources,"#afaca5ff",true)
|
||||
minetest.register_craft({
|
||||
type="cooking",
|
||||
output=industrialtest.elementKeys.ironIngot,
|
||||
@ -269,7 +269,7 @@ if industrialtest.mclAvailable then
|
||||
count=9
|
||||
},
|
||||
{resource="mcl_core:lapis_lazuli"}
|
||||
},"#292d76ff",true)
|
||||
},"#3a4cceff",true)
|
||||
end
|
||||
industrialtest.api.registerResourceDust("obsidian","Obsidian",{{resource=industrialtest.elementKeys.obsidian}},"#292843ff",true)
|
||||
resources={
|
||||
@ -293,7 +293,7 @@ if industrialtest.mclAvailable then
|
||||
count=2
|
||||
})
|
||||
end
|
||||
industrialtest.api.registerResourceDust("gold","Gold",resources,"#e4e526ff",true)
|
||||
industrialtest.api.registerResourceDust("gold","Gold",resources,"#eac162ff",true)
|
||||
minetest.register_craft({
|
||||
type="cooking",
|
||||
output=industrialtest.elementKeys.goldIngot,
|
||||
@ -320,7 +320,7 @@ if industrialtest.mclAvailable then
|
||||
count=2
|
||||
})
|
||||
end
|
||||
industrialtest.api.registerResourceDust("copper","Copper",resources,"#a45e25ff",true)
|
||||
industrialtest.api.registerResourceDust("copper","Copper",resources,"#bf644aff",true)
|
||||
minetest.register_craft({
|
||||
type="cooking",
|
||||
output=industrialtest.elementKeys.copperIngot,
|
||||
@ -347,7 +347,7 @@ if industrialtest.mclAvailable then
|
||||
count=2
|
||||
})
|
||||
end
|
||||
industrialtest.api.registerResourceDust("tin","Tin",resources,"#f1f1f1ff",true)
|
||||
industrialtest.api.registerResourceDust("tin","Tin",resources,"#ebd182ff",true)
|
||||
minetest.register_craft({
|
||||
type="cooking",
|
||||
output=industrialtest.elementKeys.tinIngot,
|
||||
@ -404,7 +404,7 @@ industrialtest.api.registerResourceDust("bronze","Bronze",{
|
||||
count=9
|
||||
},
|
||||
{resource=industrialtest.elementKeys.bronzeIngot}
|
||||
},"#e48e88ff",true)
|
||||
},"#be4325ff",true)
|
||||
minetest.register_craft({
|
||||
type="shaped",
|
||||
output="industrialtest:bronze_dust 9",
|
||||
@ -431,7 +431,7 @@ industrialtest.api.registerRotaryMaceratorModifier({
|
||||
output="industrialtest:bronze_dust",
|
||||
uses=4
|
||||
})
|
||||
industrialtest.api.registerResourceDust("sulfur","Sulfur",{},"#e3ff33ff",false)
|
||||
industrialtest.api.registerResourceDust("sulfur","Sulfur",{},"#b88805ff",false)
|
||||
industrialtest.api.registerExtractorRecipe({
|
||||
output="industrialtest:sulfur_dust",
|
||||
recipe=industrialtest.elementKeys.gunpowder
|
||||
@ -450,7 +450,7 @@ industrialtest.api.registerResourceDust("lead","Lead",{
|
||||
count=2
|
||||
},
|
||||
{resource="industrialtest:lead_ingot"}
|
||||
},"#eafef8ff",true)
|
||||
},"#6d6393ff",true)
|
||||
minetest.register_craft({
|
||||
type="cooking",
|
||||
output="industrialtest:lead_ingot",
|
||||
@ -461,7 +461,7 @@ industrialtest.api.registerResourceDust("refined_iron","Refined Iron",{
|
||||
resource="industrialtest:refined_iron_ingot",
|
||||
count=1
|
||||
}
|
||||
},"#7c8588ff",true)
|
||||
},"#94bab9ff",true)
|
||||
industrialtest.api.registerRotaryMaceratorModifier({
|
||||
name=industrialtest.elementKeys.ironLump,
|
||||
modifier=industrialtest.elementKeys.coal,
|
||||
|
@ -27,24 +27,24 @@ canningMachine.getFormspec=function(pos)
|
||||
local formspec
|
||||
if industrialtest.mtgAvailable then
|
||||
formspec={
|
||||
"list[context;fuel;3.4,1.8;1,1]",
|
||||
"list[context;src;3.4,1.8;1,1]",
|
||||
(powerPercent>0 and "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
|
||||
or "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
|
||||
"list[context;powerStorage;3.4,3.9;1,1]",
|
||||
(srcPercent>0 and "image[4.9,1.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
|
||||
or "image[4.9,1.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
|
||||
"list[context;target;6.4,1.8;1,1]",
|
||||
"list[context;dst;6.4,1.8;1,1]",
|
||||
"list[context;leftover;6.4,2.8;1,1]",
|
||||
"list[context;upgrades;9,0.9;1,4]",
|
||||
"listring[context;fuel]",
|
||||
"listring[context;src]",
|
||||
"listring[context;powerStorage]",
|
||||
"listring[context;target]",
|
||||
"listring[context;dst]",
|
||||
"listring[context;leftover]",
|
||||
"listring[context;upgrades]"
|
||||
}
|
||||
elseif industrialtest.mclAvailable then
|
||||
formspec={
|
||||
"list[context;fuel;3.4,1.8;1,1]",
|
||||
"list[context;src;3.4,1.8;1,1]",
|
||||
mcl_formspec.get_itemslot_bg(3.4,1.8,1,1),
|
||||
(powerPercent>0 and "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
|
||||
or "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
|
||||
@ -52,15 +52,15 @@ canningMachine.getFormspec=function(pos)
|
||||
mcl_formspec.get_itemslot_bg(3.4,3.9,1,1),
|
||||
(srcPercent>0 and "image[4.9,1.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
|
||||
or "image[4.9,1.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
|
||||
"list[context;target;6.4,1.8;1,1]",
|
||||
"list[context;dst;6.4,1.8;1,1]",
|
||||
mcl_formspec.get_itemslot_bg(6.4,1.8,1,1),
|
||||
"list[context;leftover;6.4,2.8;1,1]",
|
||||
mcl_formspec.get_itemslot_bg(6.4,2.8,1,1),
|
||||
"list[context;upgrades;9,0.9;1,4]",
|
||||
mcl_formspec.get_itemslot_bg(9,0.9,1,4),
|
||||
"listring[context;fuel]",
|
||||
"listring[context;src]",
|
||||
"listring[context;powerStorage]",
|
||||
"listring[context;target]",
|
||||
"listring[context;dst]",
|
||||
"listring[context;upgrades]"
|
||||
}
|
||||
end
|
||||
@ -68,8 +68,8 @@ canningMachine.getFormspec=function(pos)
|
||||
end
|
||||
|
||||
canningMachine.onConstruct=function(pos,meta,inv)
|
||||
inv:set_size("fuel",1)
|
||||
inv:set_size("target",1)
|
||||
inv:set_size("src",1)
|
||||
inv:set_size("dst",1)
|
||||
inv:set_size("leftover",1)
|
||||
inv:set_size("powerStorage",1)
|
||||
inv:set_size("upgrades",4)
|
||||
@ -79,8 +79,8 @@ end
|
||||
canningMachine.onTimer=function(pos,elapsed,meta,inv)
|
||||
local shouldRerunTimer=false
|
||||
local shouldUpdateFormspec=false
|
||||
local fuelSlot=inv:get_stack("fuel",1)
|
||||
local targetSlot=inv:get_stack("target",1)
|
||||
local fuelSlot=inv:get_stack("src",1)
|
||||
local targetSlot=inv:get_stack("dst",1)
|
||||
local leftoverSlot=inv:get_stack("leftover",1)
|
||||
local powerStorageSlot=inv:get_stack("powerStorage",1)
|
||||
local targetMeta=targetSlot:get_meta()
|
||||
@ -102,13 +102,13 @@ canningMachine.onTimer=function(pos,elapsed,meta,inv)
|
||||
end
|
||||
|
||||
canningMachine.allowMetadataInventoryMove=function(pos,fromList,fromIndex,toList,count)
|
||||
if toList=="fuel" then
|
||||
if toList=="src" then
|
||||
local inv=minetest.get_meta(pos):get_inventory()
|
||||
local itemstack=inv:get_stack(fromList,fromIndex)
|
||||
local def=itemstack:get_definition()
|
||||
return (def.groups and def.groups._industrialtest_fuel) and count or 0
|
||||
end
|
||||
if toList=="target" then
|
||||
if toList=="dst" then
|
||||
local inv=minetest.get_meta(pos):get_inventory()
|
||||
local itemstack=inv:get_stack(fromList,fromIndex)
|
||||
local def=itemstack:get_definition()
|
||||
@ -118,11 +118,11 @@ canningMachine.allowMetadataInventoryMove=function(pos,fromList,fromIndex,toList
|
||||
end
|
||||
|
||||
canningMachine.allowMetadataInventoryPut=function(pos,listname,index,stack)
|
||||
if listname=="fuel" then
|
||||
if listname=="src" then
|
||||
local def=stack:get_definition()
|
||||
return (def.groups and def.groups._industrialtest_fuel) and stack:get_count() or 0
|
||||
end
|
||||
if listname=="target" then
|
||||
if listname=="dst" then
|
||||
local def=stack:get_definition()
|
||||
return (def.groups and def.groups._industrialtest_fueled) and stack:get_count() or 0
|
||||
end
|
||||
@ -132,9 +132,9 @@ end
|
||||
canningMachine.allowMetadataInventoryTake=function(pos,listname,index,stack)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
local fuelSlot=inv:get_stack("fuel",1)
|
||||
local targetSlot=inv:get_stack("target",1)
|
||||
if ((listname=="fuel" and stack:get_count()==fuelSlot:get_count()) or (listname=="target" and stack:get_count()==targetSlot:get_count())) and meta:get_float("srcTime")>0 then
|
||||
local fuelSlot=inv:get_stack("src",1)
|
||||
local targetSlot=inv:get_stack("dst",1)
|
||||
if ((listname=="src" and stack:get_count()==fuelSlot:get_count()) or (listname=="dst" and stack:get_count()==targetSlot:get_count())) and meta:get_float("srcTime")>0 then
|
||||
meta:set_float("srcTime",0)
|
||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||
end
|
||||
@ -148,9 +148,9 @@ end
|
||||
canningMachine.onMetadataInventoryMove=function(pos,fromList,fromIndex,toList,toIndex,count)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
local fuelSlot=inv:get_stack("fuel",1)
|
||||
local targetSlot=inv:get_stack("target",1)
|
||||
if ((fromList=="fuel" and count==fuelSlot:get_count()) or (fromList=="target" and count==targetSlot:get_count())) and meta:get_float("srcTime")>0 then
|
||||
local fuelSlot=inv:get_stack("src",1)
|
||||
local targetSlot=inv:get_stack("dst",1)
|
||||
if ((fromList=="src" and count==fuelSlot:get_count()) or (fromList=="dst" and count==targetSlot:get_count())) and meta:get_float("srcTime")>0 then
|
||||
meta:set_float("srcTime",0)
|
||||
meta:set_string("formspec",canningMachine.getFormspec(pos))
|
||||
end
|
||||
@ -158,8 +158,8 @@ end
|
||||
|
||||
canningMachine.activeOnTimer=function(pos,elapsed,meta,inv)
|
||||
local shouldUpdateFormspec=false
|
||||
local fuelSlot=inv:get_stack("fuel",1)
|
||||
local targetSlot=inv:get_stack("target",1)
|
||||
local fuelSlot=inv:get_stack("src",1)
|
||||
local targetSlot=inv:get_stack("dst",1)
|
||||
local powerStorageSlot=inv:get_stack("powerStorage",1)
|
||||
|
||||
shouldRerunTimer,shouldUpdateFormspec=industrialtest.internal.chargeFromPowerStorageItem(meta,inv)
|
||||
@ -193,8 +193,8 @@ canningMachine.activeOnTimer=function(pos,elapsed,meta,inv)
|
||||
if srcTime>=canningMachine.canningTime then
|
||||
if industrialtest.api.itemHasFluidStorage(fuelSlot) then
|
||||
industrialtest.api.transferFluidToItem(fuelSlot,targetSlot,fuelMeta:get_int("industrialtest.fluidAmount"))
|
||||
inv:set_stack("fuel",1,fuelSlot)
|
||||
inv:set_stack("target",1,targetSlot)
|
||||
inv:set_stack("src",1,fuelSlot)
|
||||
inv:set_stack("dst",1,targetSlot)
|
||||
else
|
||||
local def=fuelSlot:get_definition()
|
||||
local leftoverSlot=inv:get_stack("leftover",1)
|
||||
@ -207,9 +207,9 @@ canningMachine.activeOnTimer=function(pos,elapsed,meta,inv)
|
||||
return false,shouldUpdateFormspec
|
||||
end
|
||||
industrialtest.api.addFluidToItem(targetSlot,def._industrialtest_fuelAmount)
|
||||
inv:set_stack("target",1,targetSlot)
|
||||
inv:set_stack("dst",1,targetSlot)
|
||||
fuelSlot:take_item(1)
|
||||
inv:set_stack("fuel",1,fuelSlot)
|
||||
inv:set_stack("src",1,fuelSlot)
|
||||
leftoverSlot:add_item(ItemStack(def._industrialtest_emptyVariant))
|
||||
inv:set_stack("leftover",1,leftoverSlot)
|
||||
end
|
||||
@ -233,7 +233,7 @@ industrialtest.internal.registerMachine({
|
||||
registerActiveVariant=true,
|
||||
sounds="metal",
|
||||
powerSlots={"powerStorage"},
|
||||
storageSlots={"fuel","target","powerStorage","upgrades"},
|
||||
storageSlots={"src","dst","powerStorage","upgrades"},
|
||||
groups={
|
||||
_industrialtest_hasPowerInput=1
|
||||
},
|
||||
|
@ -357,9 +357,29 @@ function industrialtest.internal.registerMachine(config)
|
||||
if config.sounds=="metal" then
|
||||
definition.sounds=mcl_sounds.node_sound_metal_defaults()
|
||||
end
|
||||
definition.groups={pickaxey=1}
|
||||
definition.groups={
|
||||
pickaxey=1,
|
||||
container=2
|
||||
}
|
||||
definition._mcl_blast_resistance=3.5
|
||||
definition._mcl_hardness=3.9
|
||||
definition._mcl_hoppers_on_try_pull=function(pos, hop_pos, hop_inv, hop_list)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack("dst", 1)
|
||||
if not stack:is_empty() and hop_inv:room_for_item(hop_list, stack) then
|
||||
return inv, "dst", 1
|
||||
end
|
||||
return nil, nil, nil
|
||||
end
|
||||
definition._mcl_hoppers_on_try_push=function(pos, hop_pos, hop_inv, hop_list)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return inv, "src", mcl_util.select_stack(hop_inv, hop_list, inv, "src")
|
||||
end
|
||||
definition._mcl_hoppers_on_after_push=function(pos)
|
||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||
end
|
||||
end
|
||||
definition.groups._industrialtest_wrenchUnmountable=1
|
||||
if config.requiresWrench then
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -38,7 +38,7 @@ local function calculateMaxSrcTime(pos)
|
||||
end
|
||||
|
||||
inductionFurnace.getFormspec=function(pos)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local powerPercent=meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")*100
|
||||
local maxSrcTime=meta:get_float("maxSrcTime")
|
||||
local srcPercent=maxSrcTime>0 and meta:get_float("srcTime")/maxSrcTime*100 or 0
|
||||
@ -46,84 +46,84 @@ inductionFurnace.getFormspec=function(pos)
|
||||
local formspec
|
||||
if industrialtest.mtgAvailable then
|
||||
formspec={
|
||||
"list[context;src;3.7,1.8;2,1]",
|
||||
(powerPercent>0 and "image[3.7,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
|
||||
or "image[3.7,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
|
||||
"list[context;powerStorage;3.7,3.9;1,1]",
|
||||
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
|
||||
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
|
||||
"list[context;dst;6,2.8;2,1;]",
|
||||
"list[context;upgrades;9,0.9;1,4]",
|
||||
"label[0.5,2.8;"..minetest.formspec_escape(S("Heat: @1 %",heat)).."]",
|
||||
"listring[context;src]",
|
||||
"listring[context;powerStorage]",
|
||||
"listring[context;dst]",
|
||||
"listring[context;upgrades]"
|
||||
"list[context;src;3.7,1.8;2,1]",
|
||||
(powerPercent>0 and "image[3.7,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
|
||||
or "image[3.7,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
|
||||
"list[context;powerStorage;3.7,3.9;1,1]",
|
||||
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
|
||||
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
|
||||
"list[context;dst;6,2.8;2,1;]",
|
||||
"list[context;upgrades;9,0.9;1,4]",
|
||||
"label[0.5,2.8;"..minetest.formspec_escape(S("Heat: @1 %",heat)).."]",
|
||||
"listring[context;src]",
|
||||
"listring[context;powerStorage]",
|
||||
"listring[context;dst]",
|
||||
"listring[context;upgrades]"
|
||||
}
|
||||
elseif industrialtest.mclAvailable then
|
||||
formspec={
|
||||
"list[context;src;3.7,1.8;2,1]",
|
||||
mcl_formspec.get_itemslot_bg(3.7,1.8,2,1),
|
||||
(powerPercent>0 and "image[3.7,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
|
||||
or "image[3.7,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
|
||||
"list[context;powerStorage;3.7,3.9;1,1]",
|
||||
mcl_formspec.get_itemslot_bg(3.7,3.9,1,1),
|
||||
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
|
||||
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
|
||||
"list[context;dst;6,2.8;2,1;]",
|
||||
mcl_formspec.get_itemslot_bg(6,2.8,2,1),
|
||||
"list[context;upgrades;9,0.9;1,4]",
|
||||
mcl_formspec.get_itemslot_bg(9,0.9,1,4),
|
||||
"label[0.5,2.8;"..minetest.formspec_escape(S("Heat: @1 %",heat)).."]",
|
||||
"listring[context;src]",
|
||||
"listring[context;powerStorage]",
|
||||
"listring[context;dst]",
|
||||
"listring[context;upgrades]"
|
||||
"list[context;src;3.7,1.8;2,1]",
|
||||
mcl_formspec.get_itemslot_bg(3.7,1.8,2,1),
|
||||
(powerPercent>0 and "image[3.7,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
|
||||
or "image[3.7,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
|
||||
"list[context;powerStorage;3.7,3.9;1,1]",
|
||||
mcl_formspec.get_itemslot_bg(3.7,3.9,1,1),
|
||||
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
|
||||
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
|
||||
"list[context;dst;6,2.8;2,1;]",
|
||||
mcl_formspec.get_itemslot_bg(6,2.8,2,1),
|
||||
"list[context;upgrades;9,0.9;1,4]",
|
||||
mcl_formspec.get_itemslot_bg(9,0.9,1,4),
|
||||
"label[0.5,2.8;"..minetest.formspec_escape(S("Heat: @1 %",heat)).."]",
|
||||
"listring[context;src]",
|
||||
"listring[context;powerStorage]",
|
||||
"listring[context;dst]",
|
||||
"listring[context;upgrades]"
|
||||
}
|
||||
end
|
||||
return table.concat(formspec,"")
|
||||
end
|
||||
|
||||
inductionFurnace.onConstruct=function(pos,meta,inv)
|
||||
inv:set_size("src",2)
|
||||
inv:set_size("dst",2)
|
||||
inv:set_size("powerStorage",1)
|
||||
inv:set_size("upgrades",4)
|
||||
meta:set_int("heat",0)
|
||||
meta:set_float("srcTime",0)
|
||||
inv:set_size("src",2)
|
||||
inv:set_size("dst",2)
|
||||
inv:set_size("powerStorage",1)
|
||||
inv:set_size("upgrades",4)
|
||||
meta:set_int("heat",0)
|
||||
meta:set_float("srcTime",0)
|
||||
end
|
||||
|
||||
inductionFurnace.onTimer=function(pos,elapsed,meta,inv)
|
||||
local shouldRerunTimer=false
|
||||
local shouldUpdateFormspec=false
|
||||
local srcList=inv:get_list("src")
|
||||
local heat=meta:get_int("heat")
|
||||
local shouldRerunTimer=false
|
||||
local shouldUpdateFormspec=false
|
||||
local srcList=inv:get_list("src")
|
||||
local heat=meta:get_int("heat")
|
||||
|
||||
shouldRerunTimer,shouldUpdateFormspec=industrialtest.internal.chargeFromPowerStorageItem(meta,inv)
|
||||
shouldRerunTimer,shouldUpdateFormspec=industrialtest.internal.chargeFromPowerStorageItem(meta,inv)
|
||||
|
||||
if heat>0 then
|
||||
if heat>0 then
|
||||
meta:set_int("heat",math.max(heat-math.max(2*elapsed,1),0))
|
||||
shouldRerunTimer=shouldRerunTimer or heat>0
|
||||
shouldUpdateFormspec=true
|
||||
end
|
||||
|
||||
for _,slot in ipairs(srcList) do
|
||||
if not slot:is_empty() then
|
||||
local result,after=minetest.get_craft_result({
|
||||
method="cooking",
|
||||
width=1,
|
||||
items={slot}
|
||||
})
|
||||
if result.time>0 and inv:room_for_item("dst",result.item) then
|
||||
minetest.swap_node(pos,{
|
||||
name="industrialtest:induction_furnace_active",
|
||||
param2=minetest.get_node(pos).param2
|
||||
})
|
||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||
return false,shouldUpdateFormspec
|
||||
end
|
||||
end
|
||||
end
|
||||
for _,slot in ipairs(srcList) do
|
||||
if not slot:is_empty() then
|
||||
local result,after=minetest.get_craft_result({
|
||||
method="cooking",
|
||||
width=1,
|
||||
items={slot}
|
||||
})
|
||||
if result.time>0 and inv:room_for_item("dst",result.item) then
|
||||
minetest.swap_node(pos,{
|
||||
name="industrialtest:induction_furnace_active",
|
||||
param2=minetest.get_node(pos).param2
|
||||
})
|
||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||
return false,shouldUpdateFormspec
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return shouldRerunTimer,shouldUpdateFormspec
|
||||
end
|
||||
@ -174,28 +174,28 @@ inductionFurnace.activeOnTimer=function(pos,elapsed,meta,inv)
|
||||
local speed=industrialtest.api.getMachineSpeed(meta)
|
||||
local requiredPower=elapsed*inductionFurnace.opPower*speed
|
||||
|
||||
industrialtest.internal.chargeFromPowerStorageItem(meta,inv)
|
||||
industrialtest.internal.chargeFromPowerStorageItem(meta,inv)
|
||||
|
||||
local shouldContinue=false
|
||||
local results={}
|
||||
for _,slot in ipairs(srcList) do
|
||||
if slot:is_empty() then
|
||||
for _,slot in ipairs(srcList) do
|
||||
if slot:is_empty() then
|
||||
table.insert(results,false)
|
||||
else
|
||||
local result,after=minetest.get_craft_result({
|
||||
method="cooking",
|
||||
width=1,
|
||||
items={slot}
|
||||
})
|
||||
if result.time>0 and inv:room_for_item("dst",result.item) then
|
||||
local result,after=minetest.get_craft_result({
|
||||
method="cooking",
|
||||
width=1,
|
||||
items={slot}
|
||||
})
|
||||
if result.time>0 and inv:room_for_item("dst",result.item) then
|
||||
table.insert(results,result.item)
|
||||
shouldContinue=true
|
||||
else
|
||||
table.insert(results,false)
|
||||
end
|
||||
end
|
||||
end
|
||||
if not shouldContinue or powerAmount<requiredPower then
|
||||
end
|
||||
end
|
||||
end
|
||||
if not shouldContinue or powerAmount<requiredPower then
|
||||
meta:set_float("srcTime",0)
|
||||
minetest.swap_node(pos,{
|
||||
name="industrialtest:induction_furnace",
|
||||
@ -203,10 +203,10 @@ inductionFurnace.activeOnTimer=function(pos,elapsed,meta,inv)
|
||||
})
|
||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||
return false,true
|
||||
end
|
||||
end
|
||||
|
||||
srcTime=srcTime+elapsed*(1+heat/100)
|
||||
if srcTime>=maxSrcTime then
|
||||
if srcTime>=maxSrcTime then
|
||||
for i,result in ipairs(results) do
|
||||
if result then
|
||||
local multiplier=math.min(srcList[i]:get_count(),speed)
|
||||
@ -218,8 +218,8 @@ inductionFurnace.activeOnTimer=function(pos,elapsed,meta,inv)
|
||||
end
|
||||
end
|
||||
srcTime=0
|
||||
end
|
||||
meta:set_float("srcTime",srcTime)
|
||||
end
|
||||
meta:set_float("srcTime",srcTime)
|
||||
|
||||
if heat<100 then
|
||||
meta:set_int("heat",math.min(100,heat+speed))
|
||||
@ -227,16 +227,16 @@ inductionFurnace.activeOnTimer=function(pos,elapsed,meta,inv)
|
||||
|
||||
industrialtest.api.addPower(meta,-requiredPower)
|
||||
|
||||
return true,true
|
||||
return true,true
|
||||
end
|
||||
|
||||
industrialtest.internal.registerMachine({
|
||||
name="induction_furnace",
|
||||
displayName=S("Induction Furnace"),
|
||||
capacity=industrialtest.api.mvPowerFlow*2,
|
||||
getFormspec=inductionFurnace.getFormspec,
|
||||
flow=industrialtest.api.mvPowerFlow,
|
||||
ioConfig="iiiiii",
|
||||
name="induction_furnace",
|
||||
displayName=S("Induction Furnace"),
|
||||
capacity=industrialtest.api.mvPowerFlow*2,
|
||||
getFormspec=inductionFurnace.getFormspec,
|
||||
flow=industrialtest.api.mvPowerFlow,
|
||||
ioConfig="iiiiii",
|
||||
requiresWrench=true,
|
||||
registerActiveVariant=true,
|
||||
sounds="metal",
|
||||
@ -267,9 +267,9 @@ industrialtest.internal.registerMachine({
|
||||
"industrialtest_advanced_machine_block.png^industrialtest_electric_furnace_front_active.png"
|
||||
}
|
||||
},
|
||||
onConstruct=inductionFurnace.onConstruct,
|
||||
onTimer=inductionFurnace.onTimer,
|
||||
allowMetadataInventoryMove=inductionFurnace.allowMetadataInventoryMove,
|
||||
onConstruct=inductionFurnace.onConstruct,
|
||||
onTimer=inductionFurnace.onTimer,
|
||||
allowMetadataInventoryMove=inductionFurnace.allowMetadataInventoryMove,
|
||||
allowMetadataInventoryPut=inductionFurnace.allowMetadataInventoryPut,
|
||||
onMetadataInventoryPut=inductionFurnace.onMetadataInventoryPut,
|
||||
onMetadataInventoryMove=inductionFurnace.onMetadataInventoryMove,
|
||||
|
@ -155,11 +155,6 @@ ironFurnace.activeOnTimer=function(pos,elapsed)
|
||||
meta:set_float("maxSrcTime",output.time*0.7)
|
||||
end
|
||||
end
|
||||
if meta:get_float("fuelTime")>0 then
|
||||
meta:set_float("fuelTime",meta:get_float("fuelTime")-elapsed)
|
||||
shouldUpdateFormspec=true
|
||||
shouldRerunTimer=true
|
||||
end
|
||||
if meta:get_float("maxSrcTime")>0 then
|
||||
if meta:get_float("fuelTime")>0 then
|
||||
meta:set_float("srcTime",meta:get_float("srcTime")+elapsed)
|
||||
@ -180,6 +175,11 @@ ironFurnace.activeOnTimer=function(pos,elapsed)
|
||||
})
|
||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||
end
|
||||
if meta:get_float("fuelTime")>0 then
|
||||
meta:set_float("fuelTime",meta:get_float("fuelTime")-elapsed)
|
||||
shouldUpdateFormspec=true
|
||||
shouldRerunTimer=true
|
||||
end
|
||||
if meta:get_float("srcTime")>=meta:get_float("maxSrcTime") then
|
||||
local output,after=minetest.get_craft_result({
|
||||
method="cooking",
|
||||
@ -223,6 +223,23 @@ ironFurnace.allowMetadataInventoryPut=function(pos,listname,index,stack)
|
||||
return stack:get_count()
|
||||
end
|
||||
|
||||
ironFurnace.allowMetadataInventoryTake=function(pos,listname,index,stack)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
local srcSlot=inv:get_stack("src",1)
|
||||
local dstSlot=inv:get_stack("dst",1)
|
||||
if listname=="src" and stack:get_count()==srcSlot:get_count() then
|
||||
meta:set_float("srcTime",-1)
|
||||
meta:set_float("maxSrcTime",0)
|
||||
if meta:get_float("maxFuelTime")>0 then
|
||||
meta:set_string("formspec",ironFurnace.getFormspec(meta:get_float("fuelTime")/meta:get_float("maxFuelTime")*100,0))
|
||||
end
|
||||
elseif listname=="dst" and dstSlot:get_free_space()==0 then
|
||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||
end
|
||||
return stack:get_count()
|
||||
end
|
||||
|
||||
ironFurnace.onMetadataInventoryMove=function(pos,fromList,fromIndex,toList,toIndex,count)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
@ -243,22 +260,6 @@ ironFurnace.onMetadataInventoryPut=function(pos,listname,index,stack)
|
||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||
end
|
||||
|
||||
ironFurnace.onMetadataInventoryTake=function(pos,listname,index,stack)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
local srcSlot=inv:get_stack("src",1)
|
||||
local dstSlot=inv:get_stack("dst",1)
|
||||
if listname=="src" and stack:get_count()==srcSlot:get_count() then
|
||||
meta:set_float("srcTime",-1)
|
||||
meta:set_float("maxSrcTime",0)
|
||||
if meta:get_float("maxFuelTime")>0 then
|
||||
meta:set_string("formspec",ironFurnace.getFormspec(meta:get_float("fuelTime")/meta:get_float("maxFuelTime")*100,0))
|
||||
end
|
||||
elseif listname=="dst" and dstSlot:get_free_space()==0 then
|
||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||
end
|
||||
end
|
||||
|
||||
local definition={
|
||||
description=S("Iron Furnace"),
|
||||
tiles={
|
||||
@ -276,9 +277,9 @@ local definition={
|
||||
on_timer=ironFurnace.onTimer,
|
||||
allow_metadata_inventory_move=ironFurnace.allowMetadataInventoryMove,
|
||||
allow_metadata_inventory_put=ironFurnace.allowMetadataInventoryPut,
|
||||
allow_metadata_inventory_take=ironFurnace.allowMetadataInventoryTake,
|
||||
on_metadata_inventory_move=ironFurnace.onMetadataInventoryMove,
|
||||
on_metadata_inventory_put=ironFurnace.onMetadataInventoryPut,
|
||||
on_metadata_inventory_take=ironFurnace.onMetadataInventoryTake
|
||||
on_metadata_inventory_put=ironFurnace.onMetadataInventoryPut
|
||||
}
|
||||
if industrialtest.mtgAvailable then
|
||||
definition.groups={
|
||||
@ -292,12 +293,21 @@ if industrialtest.mtgAvailable then
|
||||
return not (inv:get_list("src")[1]:get_count()>0 or inv:get_list("fuel")[1]:get_count()>0 or inv:get_list("dst")[1]:get_count()>0)
|
||||
end
|
||||
elseif industrialtest.mclAvailable then
|
||||
definition.groups={
|
||||
pickaxey=1,
|
||||
container=2
|
||||
}
|
||||
definition.after_dig_node=function(pos,oldnode,oldmeta)
|
||||
industrialtest.internal.mclAfterDigNode(pos,oldmeta,{"src","fuel","dst"})
|
||||
end
|
||||
definition.sounds=mcl_sounds.node_sound_metal_defaults()
|
||||
definition._mcl_blast_resistance=3
|
||||
definition._mcl_hardness=3.5
|
||||
definition._mcl_hoppers_on_try_pull = mcl_furnaces.hoppers_on_try_pull
|
||||
definition._mcl_hoppers_on_try_push = mcl_furnaces.hoppers_on_try_push
|
||||
definition._mcl_hoppers_on_after_push = function(pos)
|
||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||
end
|
||||
end
|
||||
minetest.register_node("industrialtest:iron_furnace",definition)
|
||||
definition=table.copy(definition)
|
||||
@ -316,7 +326,9 @@ definition.drop="industrialtest:iron_furnace"
|
||||
definition.on_timer=ironFurnace.activeOnTimer
|
||||
if industrialtest.mclAvailable then
|
||||
definition.groups={
|
||||
not_in_creative_inventory=1
|
||||
not_in_creative_inventory=1,
|
||||
pickaxey=1,
|
||||
container=2
|
||||
}
|
||||
definition._doc_items_create_entry=false
|
||||
end
|
||||
|
@ -27,8 +27,8 @@ toolWorkshop.getFormspec=function(pos)
|
||||
"listring[context;powerStorage]",
|
||||
(powerPercent>0 and "image[3.7,2.5;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
|
||||
or "image[3.7,2.5;1,1;industrialtest_gui_electricity_bg.png]"),
|
||||
"list[context;tool;5.9,3.2;1,1;0]",
|
||||
"listring[context;tool]",
|
||||
"list[context;src;5.9,3.2;1,1;0]",
|
||||
"listring[context;src]",
|
||||
"list[context;upgrades;9,0.9;1,4]",
|
||||
"listring[context;upgrades]"
|
||||
}
|
||||
@ -39,9 +39,9 @@ toolWorkshop.getFormspec=function(pos)
|
||||
"listring[context;powerStorage]",
|
||||
(powerPercent>0 and "image[3.7,2.5;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
|
||||
or "image[3.7,2.5;1,1;industrialtest_gui_electricity_bg.png]"),
|
||||
"list[context;tool;5.9,3.2;1,1;0]",
|
||||
"list[context;src;5.9,3.2;1,1;0]",
|
||||
mcl_formspec.get_itemslot_bg(5.9,3.2,1,1),
|
||||
"listring[context;tool]",
|
||||
"listring[context;src]",
|
||||
"list[context;upgrades;9,0.9;1,4]",
|
||||
mcl_formspec.get_itemslot_bg(9,0.9,1,4),
|
||||
"listring[context;upgrades]"
|
||||
@ -52,13 +52,13 @@ end
|
||||
|
||||
toolWorkshop.onConstruct=function(pos,meta,inv)
|
||||
inv:set_size("powerStorage",1)
|
||||
inv:set_size("tool",1)
|
||||
inv:set_size("src",1)
|
||||
inv:set_size("upgrades",4)
|
||||
end
|
||||
|
||||
toolWorkshop.onTimer=function(pos,elapsed,meta,inv)
|
||||
local powerStorageSlot=inv:get_stack("powerStorage",1)
|
||||
local toolSlot=inv:get_stack("tool",1)
|
||||
local toolSlot=inv:get_stack("src",1)
|
||||
local requiredPower=industrialtest.api.getMachineSpeed(meta)*10000
|
||||
local shouldRerunTimer=false
|
||||
local shouldUpdateFormspec=false
|
||||
@ -86,7 +86,7 @@ end
|
||||
|
||||
toolWorkshop.activeOnTimer=function(pos,elapsed,meta,inv)
|
||||
local powerStorageSlot=inv:get_stack("powerStorage",1)
|
||||
local toolSlot=inv:get_stack("tool",1)
|
||||
local toolSlot=inv:get_stack("src",1)
|
||||
local speed=industrialtest.api.getMachineSpeed(meta)
|
||||
local requiredPower=speed*10000
|
||||
local shouldRerunTimer=false
|
||||
@ -105,7 +105,7 @@ toolWorkshop.activeOnTimer=function(pos,elapsed,meta,inv)
|
||||
if toolSlot:get_count()>0 and toolSlot:get_wear()>0 and meta:get_int("industrialtest.powerAmount")>=requiredPower then
|
||||
local removed=math.min(toolSlot:get_wear(),speed*200)
|
||||
toolSlot:set_wear(toolSlot:get_wear()-removed)
|
||||
inv:set_stack("tool",1,toolSlot)
|
||||
inv:set_stack("src",1,toolSlot)
|
||||
industrialtest.api.addPower(meta,-requiredPower)
|
||||
shouldRerunTimer=true
|
||||
shouldUpdateFormspec=true
|
||||
@ -128,7 +128,7 @@ local function isTool(stack)
|
||||
end
|
||||
|
||||
toolWorkshop.allowMetadataInventoryMove=function(pos,fromList,fromIndex,toList,toIndex,count)
|
||||
if toList=="tool" then
|
||||
if toList=="src" then
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
local movedItemStack=inv:get_stack(fromList,fromIndex)
|
||||
@ -160,7 +160,7 @@ industrialtest.internal.registerMachine({
|
||||
requiresWrench=true,
|
||||
registerActiveVariant=true,
|
||||
powerSlots={"powerStorage"},
|
||||
storageSlots={"tool"},
|
||||
storageSlots={"src"},
|
||||
sounds="metal",
|
||||
groups={
|
||||
_industrialtest_hasPowerInput=1
|
||||
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 332 B |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 405 B |
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 302 B |
Before Width: | Height: | Size: 880 B After Width: | Height: | Size: 321 B |
Before Width: | Height: | Size: 499 B After Width: | Height: | Size: 447 B |
Before Width: | Height: | Size: 427 B After Width: | Height: | Size: 402 B |
Before Width: | Height: | Size: 571 B After Width: | Height: | Size: 589 B |
Before Width: | Height: | Size: 571 B After Width: | Height: | Size: 790 B |
Before Width: | Height: | Size: 776 B After Width: | Height: | Size: 490 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 732 B |
Before Width: | Height: | Size: 977 B After Width: | Height: | Size: 471 B |
Before Width: | Height: | Size: 953 B After Width: | Height: | Size: 748 B |
Before Width: | Height: | Size: 725 B After Width: | Height: | Size: 414 B |
Before Width: | Height: | Size: 582 B After Width: | Height: | Size: 420 B |
Before Width: | Height: | Size: 658 B After Width: | Height: | Size: 392 B |
Before Width: | Height: | Size: 834 B After Width: | Height: | Size: 527 B |