From 3a655cf1346f5f6e2a7777ac864b5e730d15820a Mon Sep 17 00:00:00 2001 From: Theos Date: Mon, 11 Dec 2023 18:53:23 -0500 Subject: [PATCH] Fixes APC icon weirdness (#2568) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## About The Pull Request Replaces APC update_icon() calls with update_appearance() ## Why It's Good For The Game fixes #2538 ## Changelog 🆑 fix: APCs now update their icon more correctly /🆑 --------- Signed-off-by: Theos --- code/modules/power/apc.dm | 58 ++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index ec83de125baa..03bb1651fd70 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -303,7 +303,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) if(auto_name) name = "\improper [get_area_name(area, TRUE)] APC" - update_icon() + update_appearance() make_terminal() @@ -342,12 +342,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) if(!cell) //it always peeved me that abandoned ships always had the apc lights on. this should fix it icon_update_needed = FALSE set_light(0) - return - if(cell.charge <= 0) + else if(cell.charge <= 0) icon_update_needed = FALSE set_light(0) - return //this may need to be moved up!! . = ..() // And now, separately for cleanness, the lighting changing @@ -360,12 +358,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) if(APC_FULLY_CHARGED) set_light_color(LIGHT_COLOR_GREEN) set_light(lon_range) - return - if(update_state & UPSTATE_BLUESCREEN) + else if(update_state & UPSTATE_BLUESCREEN) set_light_color(LIGHT_COLOR_BLUE) set_light(lon_range) - return /obj/machinery/power/apc/update_icon_state() if(!update_state) @@ -501,7 +497,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) else if (opened!=APC_COVER_REMOVED) opened = APC_COVER_CLOSED coverlocked = TRUE //closing cover relocks it - update_icon() + update_appearance() return else if (!(machine_stat & BROKEN)) if(coverlocked && !(machine_stat & MAINT)) // locked... @@ -512,7 +508,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) return else opened = APC_COVER_OPENED - update_icon() + update_appearance() return /obj/machinery/power/apc/screwdriver_act(mob/living/user, obj/item/W) @@ -524,10 +520,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) user.visible_message("[user] removes \the [cell] from [src]!", "You remove \the [cell].") var/turf/T = get_turf(user) cell.forceMove(T) - cell.update_icon() + cell.update_appearance() cell = null charging = APC_NOT_CHARGING - update_icon() + update_appearance() return else switch (has_electronics) @@ -544,14 +540,14 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) else to_chat(user, "There is nothing to secure!") return - update_icon() + update_appearance() else if(obj_flags & EMAGGED) to_chat(user, "The interface is broken!") return else panel_open = !panel_open to_chat(user, "The wires have been [panel_open ? "exposed" : "unexposed"].") - update_icon() + update_appearance() /obj/machinery/power/apc/wirecutter_act(mob/living/user, obj/item/W) . = ..() @@ -599,7 +595,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) user.visible_message("[user.name] inserts the power cell to [src.name]!",\ "You insert the power cell.") chargecount = 0 - update_icon() + update_appearance() else if (W.GetID()) togglelock(user) else if (istype(W, /obj/item/stack/cable_coil) && opened) @@ -677,7 +673,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) chargecount = 0 user.visible_message("[user] fabricates a weak power cell and places it into [src].", \ "Your [P.name] whirrs with strain as you create a weak power cell and place it into [src]!") - update_icon() + update_appearance() else to_chat(user, "[src] has both electronics and a cell.") return @@ -692,7 +688,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) to_chat(user, "You replace missing APC's cover.") qdel(W) opened = APC_COVER_OPENED - update_icon() + update_appearance() return if (has_electronics) to_chat(user, "You cannot repair this APC until you remove the electronics still inside!") @@ -706,7 +702,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) obj_integrity = max_integrity if (opened==APC_COVER_REMOVED) opened = APC_COVER_OPENED - update_icon() + update_appearance() else if(istype(W, /obj/item/apc_powercord)) return //because we put our fancy code in the right places, and this is all in the powercord's afterattack() @@ -754,7 +750,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) chargecount = 0 user.visible_message("[user] fabricates a weak power cell and places it into [src].", \ "Your [the_rcd.name] whirrs with strain as you create a weak power cell and place it into [src]!") - update_icon() + update_appearance() return TRUE else to_chat(user, "[src] has both electronics and a cell.") @@ -781,7 +777,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) if(allowed(usr) && !wires.is_cut(WIRE_IDSCAN) && !malfhack) locked = !locked to_chat(user, "You [ locked ? "lock" : "unlock"] the APC interface.") - update_icon() + update_appearance() updateUsrDialog() else to_chat(user, "Access denied.") @@ -811,7 +807,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) opened = APC_COVER_REMOVED coverlocked = FALSE visible_message("The APC cover is knocked down!") - update_icon() + update_appearance() /obj/machinery/power/apc/emag_act(mob/user) if(!(obj_flags & EMAGGED) && !malfhack) @@ -827,7 +823,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) obj_flags |= EMAGGED locked = FALSE to_chat(user, "You emag the APC interface.") - update_icon() + update_appearance() // attack with hand - remove cell (if cover open) or interact with the APC @@ -890,10 +886,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) if(cell) user.visible_message("[user] removes \the [cell] from [src]!", "You remove \the [cell].") user.put_in_hands(cell) - cell.update_icon() + cell.update_appearance() src.cell = null charging = APC_NOT_CHARGING - src.update_icon() + src.update_appearance() return if((machine_stat & MAINT) && !opened) //no board; no interface return @@ -1027,7 +1023,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) to_chat(usr, "The APC does not respond to the command!") else locked = !locked - update_icon() + update_appearance() . = TRUE if("cover") coverlocked = !coverlocked @@ -1042,20 +1038,20 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) chargemode = !chargemode if(!chargemode) charging = APC_NOT_CHARGING - update_icon() + update_appearance() . = TRUE if("channel") if(params["eqp"]) equipment = setsubsystem(text2num(params["eqp"])) - update_icon() + update_appearance() update() else if(params["lgt"]) lighting = setsubsystem(text2num(params["lgt"])) - update_icon() + update_appearance() update() else if(params["env"]) environ = setsubsystem(text2num(params["env"])) - update_icon() + update_appearance() update() . = TRUE if("overload") @@ -1076,7 +1072,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) malfhidehack(usr) //EndWS Edit - Malf AI Rework if("reboot") failure_timer = 0 - update_icon() + update_appearance() update() if("emergency_lighting") emergency_lights = !emergency_lights @@ -1094,7 +1090,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) add_hiddenprint(user) log_game("[key_name(user)] turned [operating ? "on" : "off"] the [src] in [AREACOORD(src)]") update() - update_icon() + update_appearance() /obj/machinery/power/apc/proc/malfhack(mob/living/silicon/ai/malf) if(!istype(malf)) @@ -1136,7 +1132,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) A.target = src malfhackhide = 1 - update_icon() + update_appearance() /obj/machinery/power/apc/proc/malfunhidehack(mob/living/silicon/ai/malf) if(src.machine_stat & BROKEN)