i want to get the signals that are on a wire that is attached to a constant combinator.
And than get the strongest signal out of it.
I have written this code:
Code: Select all
local signel = 0
local signal = {}
for i, k in pairs( game[ "virtual-signals" ] ) do
if combi.get_signal( i ) ~= nil then
for p, q in pairs( game.recipes ) do
if i.name == p.name then
if ( entity.name == "assembling-machine-1" and p.category == "crafting" ) then
if combi.get_signal( i ) > signel then
signel = combi.get_signal( i )
signal = { p.name }
end
end
if ( entity.name == "assembling-machine-2" and ( p.category == "crafting" or p.catergoy == "advanced-crafting" or p.category == "crafting-with-fluid" ) ) then
if combi.get_signal( i ) > signel then
signel = combi.get_signal( i )
signal = { p.name }
end
end
if ( entity.name == "assembling-machine-3" and ( p.category == "crafting" or p.catergoy == "advanced-crafting" or p.category == "crafting-with-fluid" ) ) then
if combi.get_signal( i ) > signel then
signel = combi.get_signal( i )
signal = { p.name }
end
end
if ( entity.name == "chemical-plant" and p.category == "chemistry" ) then
if combi.get_signal( i ) > signel then
signel = combi.get_signal( i )
signal = { p.name }
end
end
end
end
end
end
Code: Select all
entity.recipe = recipe
Can you pls help me if this is a good method or not? And if not pls help me finding a better way?
I'm working on a CraftingCombinator with that you can set Assembler and Chemical-Plant Recipes with Circuit Network.
Greetz,
Luzifer