.
This commit is contained in:
		
							parent
							
								
									731e6d4b40
								
							
						
					
					
						commit
						17a9b9b452
					
				| @ -4,6 +4,7 @@ local selectedItem = 1 | |||||||
| local inMainMenu = true | local inMainMenu = true | ||||||
| local inLightsMenu = false | local inLightsMenu = false | ||||||
| local color = "off" | local color = "off" | ||||||
|  | local cableSite = "top" | ||||||
| os.pullEvent = os.pullEventRaw | os.pullEvent = os.pullEventRaw | ||||||
| 
 | 
 | ||||||
| --[[Menu Methods]]-- | --[[Menu Methods]]-- | ||||||
| @ -25,22 +26,24 @@ function LightSystem() | |||||||
|     onKeyPressed(key,lightsMenu) |     onKeyPressed(key,lightsMenu) | ||||||
|   end |   end | ||||||
| end | end | ||||||
| function LightsOn() | 
 | ||||||
|  | function LightsBack() | ||||||
|  |   inLightsMenu = false | ||||||
|  |   selectedItem = 1 | ||||||
|  | end | ||||||
|  | 
 | ||||||
|  | function LightOn() | ||||||
|   lightSystem("on", "white") |   lightSystem("on", "white") | ||||||
| end | end | ||||||
|  | function LightOff() | ||||||
|  |   lightSystem("off", "white") | ||||||
|  | end | ||||||
| function AlarmOn() | function AlarmOn() | ||||||
|   lightSystem("on", "red") |   lightSystem("on", "red") | ||||||
| end | end | ||||||
| function LOff() | function AlarmOff() | ||||||
|   lightSystem("off", "white") |  | ||||||
| end |  | ||||||
| function AOff() |  | ||||||
|   lightSystem("off", "red") |   lightSystem("off", "red") | ||||||
| end | end | ||||||
| function LightsBack() |  | ||||||
|   inLightsMenu = false |  | ||||||
|   selectedItem = 1 |  | ||||||
| end |  | ||||||
| function AllOff() | function AllOff() | ||||||
|   lightSystem("off", "both") |   lightSystem("off", "both") | ||||||
| end | end | ||||||
| @ -82,12 +85,12 @@ mainMenu = { | |||||||
|   [7] = { text = "Exit",handler=Exit } |   [7] = { text = "Exit",handler=Exit } | ||||||
| } | } | ||||||
| lightsMenu={ | lightsMenu={ | ||||||
|   [1]= { text="Lights On", handler=On}, |   [1]= { text="Lights On", handler=LightOn }, | ||||||
|   [2]= { text="Alarm On", handler=On}, |   [2]= { text="Lights Off", handler=LightOff }, | ||||||
|   [3]= { text="Lights Off", handler=Off}, |   [3]= { text="Alarm On", handler=AlarmOn }, | ||||||
|   [4]= { text="Alarm Off", handler=Off}, |   [4]= { text="Alarm Off", handler=AlarmOff }, | ||||||
|   [5]= { text="All Off", handler=Off}, |   [5]= { text="All Off", handler=AllOff }, | ||||||
|   [6]= { text="Back", handler=LightsBack} |   [6]= { text="Back", handler=LightsBack } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| --[[Printing Methods]]-- | --[[Printing Methods]]-- | ||||||
| @ -121,70 +124,70 @@ function onKeyPressed( key, menu ) | |||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function onItemSelected( menu ) | function onItemSelected( menu ) | ||||||
|   menu[selectedItem].handler() |   menu[selectedItem].handler(args) | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| --[[Light System]]-- | --[[Light System]]-- | ||||||
| function lightSystem( op, type ) | function lightSystem( op, SetColors ) | ||||||
| --[[On functions]]-- | --[[On functions]]-- | ||||||
|   if op == "on" then |   if op == "on" then | ||||||
|     if type == "white" then |     if SetColors == "white" then | ||||||
|       if color == "off" then |       if color == "off" then | ||||||
|         rs.setBundledOutput("top", colors.white) |         rs.setBundledOutput(cableSite, colors.white) | ||||||
|         color = "white" |         color = "white" | ||||||
|       elseif color == "white" then |       elseif color == "white" then | ||||||
|         rs.setBundledOutput("top", colors.white) |         rs.setBundledOutput(cableSite, colors.white) | ||||||
|         color = "white" |         color = "white" | ||||||
|       elseif color == "red" then |       elseif color == "red" then | ||||||
|         redstone.setBundledOutput("top", colors.white + colors.red) |         redstone.setBundledOutput(cableSite, colors.white + colors.red) | ||||||
|         color = "both" |         color = "both" | ||||||
|       elseif color == "both" then |       elseif color == "both" then | ||||||
|         redstone.setBundledOutput("top", colors.white + colors.red) |         redstone.setBundledOutput(cableSite, colors.white + colors.red) | ||||||
|         color = "both" |         color = "both" | ||||||
|       end |       end | ||||||
|     elseif type == "red" then |     elseif SetColors == "red" then | ||||||
|       if color == "off" then |       if color == "off" then | ||||||
|         rs.setBundledOutput("top", colors.red) |         rs.setBundledOutput(cableSite, colors.red) | ||||||
|         color = "red" |         color = "red" | ||||||
|       elseif color == "red" then |       elseif color == "red" then | ||||||
|         rs.setBundledOutput("top", colors.red) |         rs.setBundledOutput(cableSite, colors.red) | ||||||
|         color = "red" |         color = "red" | ||||||
|       elseif color == "white" then |       elseif color == "white" then | ||||||
|         redstone.setBundledOutput("top", colors.white + colors.red) |         redstone.setBundledOutput(cableSite, colors.white + colors.red) | ||||||
|         color = "both" |         color = "both" | ||||||
|       elseif color == "both" then |       elseif color == "both" then | ||||||
|         redstone.setBundledOutput("top", colors.white + colors.red) |         redstone.setBundledOutput(cableSite, colors.white + colors.red) | ||||||
|         color = "both" |         color = "both" | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|   elseif op == "off" then |   elseif op == "off" then | ||||||
|     if type == "white" then |     if SetColors == "white" then | ||||||
|       if color == "white" then |       if color == "white" then | ||||||
|         rs.setBundledOutput("top", 0) |         rs.setBundledOutput(cableSite, 0) | ||||||
|         color = "off" |         color = "off" | ||||||
|       elseif color == "red" then |       elseif color == "red" then | ||||||
|         redstone.setBundledOutput("top", colors.red) |         redstone.setBundledOutput(cableSite, colors.red) | ||||||
|         color = "red" |         color = "red" | ||||||
|       elseif color == "both" then |       elseif color == "both" then | ||||||
|         redstone.setBundledOutput("top", colors.red) |         redstone.setBundledOutput(cableSite, colors.red) | ||||||
|         color = "red" |         color = "red" | ||||||
|       end |       end | ||||||
|     elseif type == "red" then |     elseif SetColors == "red" then | ||||||
|       if color == "red" then |       if color == "red" then | ||||||
|         rs.setBundledOutput("top", 0) |         rs.setBundledOutput(cableSite, 0) | ||||||
|         color = "off" |         color = "off" | ||||||
|       elseif color == "white" then |       elseif color == "white" then | ||||||
|         redstone.setBundledOutput("top", colors.white) |         redstone.setBundledOutput(cableSite, colors.white) | ||||||
|         color = "white" |         color = "white" | ||||||
|       elseif color == "both" then |       elseif color == "both" then | ||||||
|         redstone.setBundledOutput("top", colors.white) |         redstone.setBundledOutput(cableSite, colors.white) | ||||||
|         color = "white" |         color = "white" | ||||||
|       end |       end | ||||||
|     elseif type == "both" then |     elseif SetColors == "both" then | ||||||
|       rs.setBundledOutput("top", 0) |       rs.setBundledOutput(cableSite, 0) | ||||||
|       color = "off" |       color = "off" | ||||||
|     end |     end | ||||||
|   else error("Light system error you tried to: Turn " .. op .. " color " .. type .. " when the state of color in memory is: " .. color) |   else error("Light system error you tried to: Turn " .. op .. " color " .. SetColors .. " when the state of color in memory is: " .. color) | ||||||
|   end |   end | ||||||
|   inLightsMenu = false |   inLightsMenu = false | ||||||
|   selectedItem = 1 |   selectedItem = 1 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user