SHOW:
|
|
- or go back to the newest paste.
| 1 | -- Control Panel and Display for Factories -- | |
| 2 | ||
| 3 | ||
| 4 | -- Components -- | |
| 5 | ControlPanel = component.proxy("F06414914975C77E77F01C88581CD001")
| |
| 6 | - | StatusPanel = component.proxy("C659D07C4E5C2B8F6BACC895A3BBA74D")
|
| 6 | + | StatusPanel = component.proxy("0EF0590D41325AFD81771FB45487D272")
|
| 7 | MoSink = component.proxy("FBDA27EF47E9B688082CA8B0B24D6432") -- Motors sink --
| |
| 8 | OsSink = component.proxy("AD06B4F9497D88B5BFFD3083970103B9") -- Oscillators Sink --
| |
| 9 | - | gpu1:setsize(20,50) |
| 9 | + | |
| 10 | ||
| 11 | gpu1 = computer.getGPUs(1)[1] | |
| 12 | gpu1:bindScreen(StatusPanel) | |
| 13 | gpu1:setsize(50,20) | |
| 14 | gpu1:setForeground(1,1,1,1) | |
| 15 | gpu1:setBackground(0,0,0,0) | |
| 16 | ||
| 17 | -- Supercomputer City Components -- | |
| 18 | - | SCDI.size = 60 |
| 18 | + | |
| 19 | SCDI = ControlPanel:getModule(1,9,0) | |
| 20 | - | -- print (SCSW, SCDI, SCBUT1, SCBUT2) |
| 20 | + | |
| 21 | SCBUT2 = ControlPanel:getModule(5,10,0) | |
| 22 | SCDI.size = 52 | |
| 23 | SCDI.text = "Supercomputer" | |
| 24 | ||
| 25 | - | function turnon() |
| 25 | + | -- Motors Components -- |
| 26 | MOSW = ControlPanel:getModule(4,6,0) -- Motors lever switch | |
| 27 | MODI = ControlPanel:getModule(1,6,0) | |
| 28 | MOBUT1 = ControlPanel:getModule(5,6,0) | |
| 29 | MOBUT2 = ControlPanel:getModule(5,7,0) | |
| 30 | MODI.size = 52 | |
| 31 | MODI.text = "Motors" | |
| 32 | ||
| 33 | -- Oscillator Components -- | |
| 34 | - | function turnoff() |
| 34 | + | OSSW = ControlPanel:getModule(4,3,0) -- Oscillator lever switch |
| 35 | OSDI = ControlPanel:getModule(1,3,0) | |
| 36 | OSBUT1 = ControlPanel:getModule(5,3,0) | |
| 37 | OSBUT2 = ControlPanel:getModule(5,4,0) | |
| 38 | OSDI.size = 52 | |
| 39 | OSDI.text = "Oscillators" | |
| 40 | ||
| 41 | shred = component.proxy(component.findComponent("SCshred")) -- all sinks at SC City
| |
| 42 | - | -- scstate = "true" |
| 42 | + | |
| 43 | -- Supercomputers functions -- | |
| 44 | - | event.listen(SCSW) |
| 44 | + | function scfunction() |
| 45 | - | e, s, scstate = event.pull(2) |
| 45 | + | if scstate == true then |
| 46 | - | print (scstate) |
| 46 | + | print("SCan")
|
| 47 | - | if scstate == true then turnon() |
| 47 | + | |
| 48 | SCBUT2:setcolor(0,255,0,0) | |
| 49 | - | if scstate == false then turnoff() |
| 49 | + | |
| 50 | m.Standby = false | |
| 51 | end | |
| 52 | gpu1:setText(1,4,"SUPERCOMPUTERS: ") | |
| 53 | gpu1:setForeground(0,255,0,1) | |
| 54 | gpu1:setText(20,4," > ONLINE < ") | |
| 55 | gpu1:flush() | |
| 56 | gpu1:setForeground(1,1,1,1) | |
| 57 | end | |
| 58 | ||
| 59 | if scstate == false then | |
| 60 | print ("SCaus")
| |
| 61 | SCBUT1:setcolor(255,0,0,0) | |
| 62 | SCBUT2:setcolor(255,0,0,0) | |
| 63 | for _, m in ipairs(shred) do | |
| 64 | m.Standby = true | |
| 65 | end | |
| 66 | gpu1:setText(1,4,"SUPERCOMPUTERS: ") | |
| 67 | gpu1:setForeground(255,0,0,1) | |
| 68 | gpu1:setText(20,4,"> OFFLINE <") | |
| 69 | gpu1:flush() | |
| 70 | gpu1:setForeground(1,1,1,1) | |
| 71 | end | |
| 72 | end | |
| 73 | ||
| 74 | -- Motors functions -- | |
| 75 | function mofunction() | |
| 76 | if scstate == true then | |
| 77 | print ("MOan")
| |
| 78 | MoSink.Standby = false | |
| 79 | MOBUT1:setcolor(0,255,0,0) | |
| 80 | MOBUT2:setcolor(0,255,0,0) | |
| 81 | gpu1:setText(1,6,"MOTORS: ") | |
| 82 | gpu1:setForeground(0,255,0,1) | |
| 83 | gpu1:setText(20,6," > ONLINE < ") | |
| 84 | gpu1:flush() | |
| 85 | gpu1:setForeground(1,1,1,1) | |
| 86 | end | |
| 87 | ||
| 88 | if scstate == false then | |
| 89 | print ("MOaus")
| |
| 90 | MoSink.Standby = true | |
| 91 | MOBUT1:setcolor(255,0,0,0) | |
| 92 | MOBUT2:setcolor(255,0,0,0) | |
| 93 | gpu1:setText(1,6,"MOTORS: ") | |
| 94 | gpu1:setForeground(255,0,0,1) | |
| 95 | gpu1:setText(20,6,"> OFFLINE <") | |
| 96 | gpu1:flush() | |
| 97 | gpu1:setForeground(1,1,1,1) | |
| 98 | end | |
| 99 | end | |
| 100 | ||
| 101 | -- Oscillator functions -- | |
| 102 | function osfunction() | |
| 103 | if scstate == true then | |
| 104 | print ("OSan")
| |
| 105 | OsSink.Standby = false | |
| 106 | OSBUT1:setcolor(0,255,0,0) | |
| 107 | OSBUT2:setcolor(0,255,0,0) | |
| 108 | gpu1:setText(1,8,"OSCILLATORS: ") | |
| 109 | gpu1:setForeground(0,255,0,1) | |
| 110 | gpu1:setText(20,8," > ONLINE < ") | |
| 111 | gpu1:flush() | |
| 112 | gpu1:setForeground(1,1,1,1) | |
| 113 | end | |
| 114 | ||
| 115 | if scstate == false then | |
| 116 | print ("OSaus")
| |
| 117 | OsSink.Standby = true | |
| 118 | OSBUT1:setcolor(255,0,0,0) | |
| 119 | OSBUT2:setcolor(255,0,0,0) | |
| 120 | gpu1:setText(1,8,"OSCILLATORS: ") | |
| 121 | gpu1:setForeground(255,0,0,1) | |
| 122 | gpu1:setText(20,8,"> OFFLINE <") | |
| 123 | gpu1:flush() | |
| 124 | gpu1:setForeground(1,1,1,1) | |
| 125 | end | |
| 126 | end | |
| 127 | ||
| 128 | -- Header -- | |
| 129 | gpu1:fill(0,0,100,50," ") | |
| 130 | gpu1:setText(1,1,"F A C T O R I E S S T A T U S") | |
| 131 | gpu1:SetBackground(60,60,60,0.3) | |
| 132 | gpu1:fill(1,2,30,1," ") | |
| 133 | gpu1:setBackground(0,0,0,0) | |
| 134 | ||
| 135 | event.listen(SCSW, MOSW, OSSW) | |
| 136 | ||
| 137 | while true do | |
| 138 | e, s, scstate = event.pull(5) | |
| 139 | if s == SCSW then | |
| 140 | scfunction() | |
| 141 | elseif s == MOSW then | |
| 142 | mofunction() | |
| 143 | elseif s == OSSW then | |
| 144 | osfunction() | |
| 145 | end | |
| 146 | end | |
| 147 |