Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. /c local map={}
  2.  
  3. function createSigTable()
  4. local idx = 1
  5. local result = {}
  6.  
  7. for _,v in pairs(game.virtual_signal_prototypes) do
  8. if (not v.special) and v.name~="signal-black" then
  9. result[idx] = {name=v.name,type="virtual"}
  10. idx = idx + 1
  11. end
  12. end
  13. for _,f in pairs(game.fluid_prototypes) do
  14. if not f.hidden then
  15. result[idx] = {name=f.name,type="fluid"}
  16. idx = idx + 1
  17. end
  18. end
  19. for _,i in pairs(game.item_prototypes) do
  20. if not i.has_flag("hidden") and i.name~="magic-lamp" and i.name~="pushbutton" then
  21. result[idx] = {name=i.name,type="item"}
  22. idx = idx + 1
  23. end
  24. end
  25.  
  26. return result
  27. end
  28.  
  29. local sigs = createSigTable()
  30. local posX = game.player.selected.position.x
  31. local posY = game.player.selected.position.y
  32. local comb = game.player.selected
  33.  
  34. for index,_ in pairs(sigs) do
  35. if index % 18 == 1 then
  36. comb = game.player.surface.create_entity({name = "constant-combinator", position = {x=comb.position.x+1,y=comb.position.y}, force = game.forces.player})
  37. end
  38. comb.get_control_behavior().set_signal((index - 1) % 18 + 1, {signal=sigs[index], count=index})
  39. index = index + 1
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement