From e48c9b0c0f80a2b37d571a020744ee15374ecc70 Mon Sep 17 00:00:00 2001 From: Burzah <116982774+Burzah@users.noreply.github.com> Date: Sun, 26 Mar 2023 03:44:51 -0700 Subject: [PATCH] Refactors PDA overlays (#20708) --- code/modules/pda/PDA.dm | 13 ++++++++++--- code/modules/pda/app.dm | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/code/modules/pda/PDA.dm b/code/modules/pda/PDA.dm index 9d0c2805a90..979b1c50786 100644 --- a/code/modules/pda/PDA.dm +++ b/code/modules/pda/PDA.dm @@ -137,6 +137,13 @@ GLOBAL_LIST_EMPTY(PDAs) var/datum/data/pda/P = A P.pda = src +/obj/item/pda/update_overlays() + . = ..() + if(id) + . += image('icons/goonstation/objects/pda_overlay.dmi', id.icon_state) + if(length(notifying_programs)) + . += image('icons/obj/pda.dmi', "pda-r") + /obj/item/pda/proc/close(mob/user) SStgui.close_uis(src) @@ -151,7 +158,7 @@ GLOBAL_LIST_EMPTY(PDAs) if(can_use(usr)) start_program(find_program(/datum/data/pda/app/main_menu)) notifying_programs.Cut() - overlays -= image('icons/obj/pda.dmi', "pda-r") + update_icon(UPDATE_OVERLAYS) to_chat(usr, "You press the reset button on \the [src].") SStgui.update_uis(src) else @@ -185,8 +192,8 @@ GLOBAL_LIST_EMPTY(PDAs) SStgui.update_uis(src) else id.forceMove(get_turf(src)) - overlays -= image('icons/goonstation/objects/pda_overlay.dmi', id.icon_state) id = null + update_icon(UPDATE_OVERLAYS) playsound(src, 'sound/machines/terminal_eject.ogg', 50, TRUE) if(ishuman(loc)) @@ -295,7 +302,7 @@ GLOBAL_LIST_EMPTY(PDAs) if( can_use(user) )//If they can still act. id_check(user, 2) to_chat(user, "You put the ID into \the [src]'s slot.
You can remove it with ALT click.
") - overlays += image('icons/goonstation/objects/pda_overlay.dmi', C.icon_state) + update_icon(UPDATE_OVERLAYS) SStgui.update_uis(src) else if(istype(C, /obj/item/paicard) && !src.pai) diff --git a/code/modules/pda/app.dm b/code/modules/pda/app.dm index 1b9c1f6476d..d593b590ba9 100644 --- a/code/modules/pda/app.dm +++ b/code/modules/pda/app.dm @@ -40,14 +40,14 @@ pda.play_ringtone() if(blink && !(src in pda.notifying_programs)) - pda.overlays += image('icons/obj/pda.dmi', "pda-r") + pda.update_icon(UPDATE_OVERLAYS) pda.notifying_programs |= src /datum/data/pda/proc/unnotify() if(src in pda.notifying_programs) pda.notifying_programs -= src if(!pda.notifying_programs.len) - pda.overlays -= image('icons/obj/pda.dmi', "pda-r") + pda.update_icon(UPDATE_OVERLAYS) // An app has a button on the home screen and its own UI /datum/data/pda/app