"Else" clause removal (/obj/machinery/apc/update_icon()).

This commit is contained in:
ESwordTheCat
2014-02-07 06:51:33 +01:00
committed by alex-gh
parent 4b0f3e8b78
commit 8930ca5b58
+42 -18
View File
@@ -149,34 +149,58 @@
else
usr << "The cover is closed."
// update the APC icon to show the three base states
// also add overlays for indicator lights
/*
* return 0 (reached the proc code end)
* 1 (wires is exposed)
* 2 (something is wrong)
* 3 (broken)
* 4 (opened)
*/
/obj/machinery/power/apc/update_icon()
var/L[0]
overlays = L
overlays.Cut()
if(opened)
var/basestate = "apc[ cell ? "2" : "1" ]" // if opened, show cell if it's inserted
if (opened==1)
if (stat & (MAINT|BROKEN))
icon_state = "apcmaint" //disassembled APC cannot hold cell
if (opened)
var/basestate = "apc[cell ? "2" : "1"]"
if (opened == 1)
if (stat & (BROKEN | MAINT))
//disassembled APC cannot hold cell
icon_state = "apcmaint"
else
icon_state = basestate
else if (opened == 2)
icon_state = "[basestate]-nocover"
basestate = null
return 4
else if (stat & BROKEN)
icon_state = "apc-b"
else if(emagged || malfai || spooky)
return 3
else if (emagged || malfai || spooky)
icon_state = "apcemag"
else if(wiresexposed)
return 2
else if (wiresexposed)
icon_state = "apcewires"
else
icon_state = "apc0"
// if closed, update overlays for channel status
if(!(stat & (BROKEN|MAINT)))
overlays.Add("apcox-[locked]","apco3-[charging]") // 0=blue 1=red // 0=red, 1=yellow/black 2=green
if(operating)
overlays.Add("apco0-[equipment]","apco1-[lighting]","apco2-[environ]") // 0=red, 1=green, 2=blue
return 1
icon_state = "apc0"
if(!(stat & (BROKEN|MAINT)))
// 0 = green, 1 = red
L += "apcox-[locked]"
// 0 = red, 1 = blue, 2 = green
L += "apco3-[charging]"
if (operating)
// 0 = red, 1 = yellow, 2 = green, 3 = blue
L += "apco0-[equipment]"
L += "apco1-[lighting]"
L += "apco2-[environ]"
overlays = L
L = null
return 0
// Used in process so it doesn't update the icon too much
/obj/machinery/power/apc/proc/queue_icon_update()