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