From 8930ca5b58813f260a5b2145b93003eeb7cea181 Mon Sep 17 00:00:00 2001 From: ESwordTheCat Date: Fri, 7 Feb 2014 04:19:55 +0800 Subject: [PATCH] "Else" clause removal (/obj/machinery/apc/update_icon()). --- code/modules/power/apc.dm | 60 +++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index bf0868f050d..f448b9b6842 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -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()