On_The_Edge

Factory control panel switches and status V1

Feb 27th, 2021 (edited)
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1. -- Control Panel and Display for Factories --
  2.  
  3.  
  4. -- Components --
  5. ControlPanel = component.proxy("F06414914975C77E77F01C88581CD001")
  6. StatusPanel = component.proxy("C659D07C4E5C2B8F6BACC895A3BBA74D")
  7. gpu1 = computer.getGPUs(1)[1]
  8. gpu1:bindScreen(StatusPanel)
  9. gpu1:setsize(20,50)
  10. gpu1:setForeground(1,1,1,1)
  11. gpu1:setBackground(0,0,0,0)
  12.  
  13. -- Supercomputer City Components --
  14. SCSW = ControlPanel:getModule(4,9,0) -- SC lever switch
  15. SCDI = ControlPanel:getModule(1,9,0)
  16. SCBUT1 = ControlPanel:getModule(5,9,0)
  17. SCBUT2 = ControlPanel:getModule(5,10,0)
  18. SCDI.size = 60
  19. SCDI.text = "Supercomputer"
  20. -- print (SCSW, SCDI, SCBUT1, SCBUT2)
  21.  
  22.  
  23. shred = component.proxy(component.findComponent("SCshred")) -- all sinks at SC City
  24.  
  25. function turnon()
  26. SCBUT1:setcolor(0,255,0,0)
  27. SCBUT2:setcolor(0,255,0,0)
  28. for _, m in ipairs(shred) do
  29.    m.Standby = false
  30. end
  31. end
  32.  
  33.  
  34. function turnoff()
  35. SCBUT1:setcolor(255,0,0,0)
  36. SCBUT2:setcolor(255,0,0,0)
  37. for _, m in ipairs(shred) do
  38.    m.Standby = true
  39. end
  40. end
  41.  
  42. -- scstate = "true"
  43. while true do
  44. event.listen(SCSW)
  45. e, s, scstate = event.pull(2)
  46. print (scstate)
  47. if scstate == true then turnon()
  48. end
  49. if scstate == false then turnoff()
  50. end
  51. end
  52.  
  53.  
Advertisement
Add Comment
Please, Sign In to add comment