.
This commit is contained in:
		
							parent
							
								
									dd30936579
								
							
						
					
					
						commit
						0e61e11ff6
					
				| @ -2,9 +2,9 @@ | |||||||
| local termWidth, termHeight = term.getSize() | local termWidth, termHeight = term.getSize() | ||||||
| local selectedItem = 1 | local selectedItem = 1 | ||||||
| local inMainMenu = true | local inMainMenu = true | ||||||
|  | local ActiveColor = 0 | ||||||
| local inLightsMenu = false | local inLightsMenu = false | ||||||
| local color = "off" | local CableSite = "top" | ||||||
| local cableSite = "top" |  | ||||||
| os.pullEvent = os.pullEventRaw | os.pullEvent = os.pullEventRaw | ||||||
| 
 | 
 | ||||||
| --[[Menu Methods]]-- | --[[Menu Methods]]-- | ||||||
| @ -28,19 +28,25 @@ function LightSystem() | |||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function LightOn() | function LightOn() | ||||||
|   lightSystem("on", "white") |   lightSystem("on", colors.white) | ||||||
| end | end | ||||||
| function LightOff() | function LightOff() | ||||||
|   lightSystem("off", "white") |   lightSystem("off", colors.white) | ||||||
|  | end | ||||||
|  | function OrangeOn() | ||||||
|  |   lightSystem("on", colors.orange) | ||||||
|  | end | ||||||
|  | function OrangeOff() | ||||||
|  |   lightSystem("off", colors.orange) | ||||||
| end | end | ||||||
| function AlarmOn() | function AlarmOn() | ||||||
|   lightSystem("on", "red") |   lightSystem("on", colors.red) | ||||||
| end | end | ||||||
| function AlarmOff() | function AlarmOff() | ||||||
|   lightSystem("off", "red") |   lightSystem("off", colors.red) | ||||||
| end | end | ||||||
| function AllOff() | function AllOff() | ||||||
|   lightSystem("off", "both") |   lightSystem("off", 65535) | ||||||
| end | end | ||||||
| function LightsBack() | function LightsBack() | ||||||
|   inLightsMenu = false |   inLightsMenu = false | ||||||
| @ -86,10 +92,12 @@ mainMenu = { | |||||||
| lightsMenu={ | lightsMenu={ | ||||||
|   [1]= { text="Lights On", handler=LightOn }, |   [1]= { text="Lights On", handler=LightOn }, | ||||||
|   [2]= { text="Lights Off", handler=LightOff }, |   [2]= { text="Lights Off", handler=LightOff }, | ||||||
|   [3]= { text="Alarm On", handler=AlarmOn }, |   [3]= { text="Orange On", handler=OrangeOn }, | ||||||
|   [4]= { text="Alarm Off", handler=AlarmOff }, |   [4]= { text="Orange Off", handler=OrangeOff }, | ||||||
|   [5]= { text="All Off", handler=AllOff }, |   [5]= { text="Alarm On", handler=AlarmOn }, | ||||||
|   [6]= { text="Back", handler=LightsBack } |   [6]= { text="Alarm Off", handler=AlarmOff }, | ||||||
|  |   [7]= { text="All Off", handler=AllOff }, | ||||||
|  |   [8]= { text="Back", handler=LightsBack } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| --[[Printing Methods]]-- | --[[Printing Methods]]-- | ||||||
| @ -128,65 +136,16 @@ end | |||||||
| 
 | 
 | ||||||
| --[[Light System]]-- | --[[Light System]]-- | ||||||
| function lightSystem( op, SetColors ) | function lightSystem( op, SetColors ) | ||||||
| --[[On functions]]-- | --[[Color Conversion]]-- | ||||||
|  |   ConvertColors = SetColors | ||||||
|  | --[[Color Change]]-- | ||||||
|   if op == "on" then |   if op == "on" then | ||||||
|     if SetColors == "white" then |     ActiveColor = colors.combine(ActiveColor, ConvertColors) | ||||||
|       if color == "off" then |     rs.setBundledOutput(CableSite ,ActiveColor) | ||||||
|         rs.setBundledOutput(cableSite, colors.white) |  | ||||||
|         color = "white" |  | ||||||
|       elseif color == "white" then |  | ||||||
|         rs.setBundledOutput(cableSite, colors.white) |  | ||||||
|         color = "white" |  | ||||||
|       elseif color == "red" then |  | ||||||
|         redstone.setBundledOutput(cableSite, colors.white + colors.red) |  | ||||||
|         color = "both" |  | ||||||
|       elseif color == "both" then |  | ||||||
|         redstone.setBundledOutput(cableSite, colors.white + colors.red) |  | ||||||
|         color = "both" |  | ||||||
|       end |  | ||||||
|     elseif SetColors == "red" then |  | ||||||
|       if color == "off" then |  | ||||||
|         rs.setBundledOutput(cableSite, colors.red) |  | ||||||
|         color = "red" |  | ||||||
|       elseif color == "red" then |  | ||||||
|         rs.setBundledOutput(cableSite, colors.red) |  | ||||||
|         color = "red" |  | ||||||
|       elseif color == "white" then |  | ||||||
|         redstone.setBundledOutput(cableSite, colors.white + colors.red) |  | ||||||
|         color = "both" |  | ||||||
|       elseif color == "both" then |  | ||||||
|         redstone.setBundledOutput(cableSite, colors.white + colors.red) |  | ||||||
|         color = "both" |  | ||||||
|       end |  | ||||||
|     end |  | ||||||
|   elseif op == "off" then |   elseif op == "off" then | ||||||
|     if SetColors == "white" then |     ActiveColor = colors.subtract(ActiveColor, ConvertColors) | ||||||
|       if color == "white" then |     rs.setBundledOutput(CableSite, ActiveColor) | ||||||
|         rs.setBundledOutput(cableSite, 0) |   else error("Light system error you tried to: Turn " .. op .. " Color: " .. SetColors .. " when the state of color in memory is: " .. ActiveColor) | ||||||
|         color = "off" |  | ||||||
|       elseif color == "red" then |  | ||||||
|         redstone.setBundledOutput(cableSite, colors.red) |  | ||||||
|         color = "red" |  | ||||||
|       elseif color == "both" then |  | ||||||
|         redstone.setBundledOutput(cableSite, colors.red) |  | ||||||
|         color = "red" |  | ||||||
|       end |  | ||||||
|     elseif SetColors == "red" then |  | ||||||
|       if color == "red" then |  | ||||||
|         rs.setBundledOutput(cableSite, 0) |  | ||||||
|         color = "off" |  | ||||||
|       elseif color == "white" then |  | ||||||
|         redstone.setBundledOutput(cableSite, colors.white) |  | ||||||
|         color = "white" |  | ||||||
|       elseif color == "both" then |  | ||||||
|         redstone.setBundledOutput(cableSite, colors.white) |  | ||||||
|         color = "white" |  | ||||||
|       end |  | ||||||
|     elseif SetColors == "both" then |  | ||||||
|       rs.setBundledOutput(cableSite, 0) |  | ||||||
|       color = "off" |  | ||||||
|     end |  | ||||||
|   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