This commit is contained in:
+60
-63
@@ -275,78 +275,75 @@
|
||||
|
||||
// update the APC icon to show the three base states
|
||||
// also add overlays for indicator lights
|
||||
/obj/machinery/power/apc/update_icon()
|
||||
var/update = check_updates() //returns 0 if no need to update icons.
|
||||
// 1 if we need to update the icon_state
|
||||
// 2 if we need to update the overlays
|
||||
if(!update)
|
||||
icon_update_needed = FALSE
|
||||
/obj/machinery/power/apc/update_appearance(updates=check_updates())
|
||||
icon_update_needed = FALSE
|
||||
if(!updates)
|
||||
return
|
||||
|
||||
if(update & 1) // Updating the icon state
|
||||
if(update_state & UPSTATE_ALLGOOD)
|
||||
icon_state = "apc0"
|
||||
else if(update_state & (UPSTATE_OPENED1|UPSTATE_OPENED2))
|
||||
var/basestate = "apc[ cell ? "2" : "1" ]"
|
||||
if(update_state & UPSTATE_OPENED1)
|
||||
if(update_state & (UPSTATE_MAINT|UPSTATE_BROKE))
|
||||
icon_state = "apcmaint" //disabled APC cannot hold cell
|
||||
else
|
||||
icon_state = basestate
|
||||
else if(update_state & UPSTATE_OPENED2)
|
||||
if (update_state & UPSTATE_BROKE || malfhack)
|
||||
icon_state = "[basestate]-b-nocover"
|
||||
else
|
||||
icon_state = "[basestate]-nocover"
|
||||
else if(update_state & UPSTATE_BROKE)
|
||||
icon_state = "apc-b"
|
||||
else if(update_state & UPSTATE_BLUESCREEN)
|
||||
icon_state = "apcemag"
|
||||
else if(update_state & UPSTATE_WIREEXP)
|
||||
icon_state = "apcewires"
|
||||
else if(update_state & UPSTATE_MAINT)
|
||||
icon_state = "apc0"
|
||||
|
||||
if(!(update_state & UPSTATE_ALLGOOD))
|
||||
SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays)
|
||||
var/hijackerreturn
|
||||
if (hijacker)
|
||||
var/obj/item/implant/hijack/H = hijacker.getImplant(/obj/item/implant/hijack)
|
||||
hijackerreturn = H && !H.stealthmode
|
||||
if(update & 2)
|
||||
SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays)
|
||||
if(!(stat & (BROKEN|MAINT)) && update_state & UPSTATE_ALLGOOD)
|
||||
SSvis_overlays.add_vis_overlay(src, icon, "apcox-[locked]", layer, plane, dir)
|
||||
SSvis_overlays.add_vis_overlay(src, icon, "apcox-[locked]", EMISSIVE_LAYER, EMISSIVE_PLANE, dir)
|
||||
SSvis_overlays.add_vis_overlay(src, icon, "apco3-[hijackerreturn ? "3" : charging]", layer, plane, dir)
|
||||
SSvis_overlays.add_vis_overlay(src, icon, "apco3-[hijackerreturn ? "3" : charging]", EMISSIVE_LAYER, EMISSIVE_PLANE, dir)
|
||||
if(operating)
|
||||
SSvis_overlays.add_vis_overlay(src, icon, "apco0-[equipment]", layer, plane, dir)
|
||||
SSvis_overlays.add_vis_overlay(src, icon, "apco0-[equipment]", EMISSIVE_LAYER, EMISSIVE_PLANE, dir)
|
||||
SSvis_overlays.add_vis_overlay(src, icon, "apco1-[lighting]", layer, plane, dir)
|
||||
SSvis_overlays.add_vis_overlay(src, icon, "apco1-[lighting]", EMISSIVE_LAYER, EMISSIVE_PLANE, dir)
|
||||
SSvis_overlays.add_vis_overlay(src, icon, "apco2-[environ]", layer, plane, dir)
|
||||
SSvis_overlays.add_vis_overlay(src, icon, "apco2-[environ]", EMISSIVE_LAYER, EMISSIVE_PLANE, dir)
|
||||
|
||||
. = ..()
|
||||
// And now, separately for cleanness, the lighting changing
|
||||
if(update_state & UPSTATE_ALLGOOD)
|
||||
if(!update_state)
|
||||
switch(charging)
|
||||
if(APC_NOT_CHARGING)
|
||||
light_color = LIGHT_COLOR_RED
|
||||
set_light_color(COLOR_SOFT_RED)
|
||||
if(APC_CHARGING)
|
||||
light_color = LIGHT_COLOR_BLUE
|
||||
set_light_color(LIGHT_COLOR_BLUE)
|
||||
if(APC_FULLY_CHARGED)
|
||||
light_color = LIGHT_COLOR_GREEN
|
||||
if (hijackerreturn)
|
||||
light_color = LIGHT_COLOR_YELLOW
|
||||
set_light_color(LIGHT_COLOR_GREEN)
|
||||
set_light(lon_range)
|
||||
else if(update_state & UPSTATE_BLUESCREEN)
|
||||
light_color = LIGHT_COLOR_BLUE
|
||||
set_light(lon_range)
|
||||
else
|
||||
set_light(0)
|
||||
return
|
||||
|
||||
icon_update_needed = FALSE
|
||||
if(update_state & UPSTATE_BLUESCREEN)
|
||||
set_light_color(LIGHT_COLOR_BLUE)
|
||||
set_light(lon_range)
|
||||
return
|
||||
|
||||
set_light(0)
|
||||
|
||||
// update the APC icon to show the three base states
|
||||
// also add overlays for indicator lights
|
||||
/obj/machinery/power/apc/update_icon_state()
|
||||
if(!update_state)
|
||||
icon_state = "apc0"
|
||||
return ..()
|
||||
if(update_state & (UPSTATE_OPENED1|UPSTATE_OPENED2))
|
||||
var/basestate = "apc[cell ? 2 : 1]"
|
||||
if(update_state & UPSTATE_OPENED1)
|
||||
icon_state = (update_state & (UPSTATE_MAINT|UPSTATE_BROKE)) ? "apcmaint" : basestate
|
||||
else if(update_state & UPSTATE_OPENED2)
|
||||
icon_state = "[basestate][((update_state & UPSTATE_BROKE) || malfhack) ? "-b" : null]-nocover"
|
||||
return ..()
|
||||
if(update_state & UPSTATE_BROKE)
|
||||
icon_state = "apc-b"
|
||||
return ..()
|
||||
if(update_state & UPSTATE_BLUESCREEN)
|
||||
icon_state = "apcemag"
|
||||
return ..()
|
||||
if(update_state & UPSTATE_WIREEXP)
|
||||
icon_state = "apcewires"
|
||||
return ..()
|
||||
if(update_state & UPSTATE_MAINT)
|
||||
icon_state = "apc0"
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/apc/update_overlays()
|
||||
. = ..()
|
||||
if((machine_stat & (BROKEN|MAINT)) || update_state)
|
||||
return
|
||||
|
||||
. += mutable_appearance(icon, "apcox-[locked]")
|
||||
. += emissive_appearance(icon, "apcox-[locked]")
|
||||
. += mutable_appearance(icon, "apco3-[charging]")
|
||||
. += emissive_appearance(icon, "apco3-[charging]")
|
||||
if(!operating)
|
||||
return
|
||||
|
||||
. += mutable_appearance(icon, "apco0-[equipment]")
|
||||
. += emissive_appearance(icon, "apco0-[equipment]")
|
||||
. += mutable_appearance(icon, "apco1-[lighting]")
|
||||
. += emissive_appearance(icon, "apco1-[lighting]")
|
||||
. += mutable_appearance(icon, "apco2-[environ]")
|
||||
. += emissive_appearance(icon, "apco2-[environ]")
|
||||
|
||||
/obj/machinery/power/apc/proc/check_updates()
|
||||
var/last_update_state = update_state
|
||||
|
||||
Reference in New Issue
Block a user