diff --git a/code/__DEFINES/equipment.dm b/code/__DEFINES/equipment.dm index b5e89df5a9..10894c4cdb 100644 --- a/code/__DEFINES/equipment.dm +++ b/code/__DEFINES/equipment.dm @@ -554,10 +554,10 @@ var/global/list/uniform_categories = list( #define PHONE_UPP_SOLDIER "Soldier" #define PHONE_IO "IO" -#define PHONE_DO_NOT_DISTURB_FORCED 2 -#define PHONE_DO_NOT_DISTURB_ON 1 -#define PHONE_DO_NOT_DISTURB_OFF 0 -#define PHONE_DO_NOT_DISTURB_FORBIDDEN -1 +#define PHONE_DND_FORCED 2 +#define PHONE_DND_ON 1 +#define PHONE_DND_OFF 0 +#define PHONE_DND_FORBIDDEN -1 #define PHONE_ON_BASE_UNIT_ICON_STATE "[initial(icon_state)]" #define PHONE_OFF_BASE_UNIT_ICON_STATE "[initial(icon_state)]_ear" diff --git a/code/datums/components/phone.dm b/code/datums/components/phone.dm index 3d0cfaf41f..67c926365b 100644 --- a/code/datums/components/phone.dm +++ b/code/datums/components/phone.dm @@ -26,7 +26,10 @@ GLOBAL_LIST_EMPTY_TYPED(phones, /datum/component/phone) var/datum/component/phone/calling_phone /// Whether or not the phone is receiving calls or not. Varies between on/off or forcibly on/off. - var/do_not_disturb = PHONE_DO_NOT_DISTURB_OFF + var/do_not_disturb = PHONE_DND_OFF + + /// The Phone_ID of the last person to call this telephone. + var/last_caller /// The ID of our timer to cancel an attempted call and "go to voicemail" var/timeout_timer_id @@ -247,10 +250,10 @@ GLOBAL_LIST_EMPTY_TYPED(phones, /datum/component/phone) if(phone_handset.loc) return FALSE - if(do_not_disturb == PHONE_DO_NOT_DISTURB_ON) + if(do_not_disturb == PHONE_DND_ON) return FALSE - if(do_not_disturb == PHONE_DO_NOT_DISTURB_FORCED) + if(do_not_disturb == PHONE_DND_FORCED) return FALSE return TRUE @@ -296,6 +299,7 @@ GLOBAL_LIST_EMPTY_TYPED(phones, /datum/component/phone) /// What we do when our phone is receiving a call, called from incoming_call's call_phone() /datum/component/phone/proc/getting_call(datum/component/phone/incoming_call) calling_phone = incoming_call + last_caller = incoming_call.phone_id SEND_SIGNAL(holder, COMSIG_ATOM_PHONE_RINGING) ringing_loop.start() @@ -405,13 +409,13 @@ GLOBAL_LIST_EMPTY_TYPED(phones, /datum/component/phone) hearing_mob.hear_radio(message, "says", message_language, part_a = "", part_b = " ", vname = name_override, speaker = speaker, command = loudness, no_paygrade = TRUE) /// Toggles do not disturb on or off, does not handle forced or unable do_not_disturb variables -/datum/component/phone/proc/toggle_do_not_disturb(mob/user) +/datum/component/phone/proc/toggle_dnd(mob/user) switch(do_not_disturb) - if(PHONE_DO_NOT_DISTURB_ON) - do_not_disturb = PHONE_DO_NOT_DISTURB_OFF + if(PHONE_DND_ON) + do_not_disturb = PHONE_DND_OFF to_chat(user, SPAN_NOTICE("Do Not Disturb has been disabled. You can now receive calls.")) - if(PHONE_DO_NOT_DISTURB_OFF) - do_not_disturb = PHONE_DO_NOT_DISTURB_ON + if(PHONE_DND_OFF) + do_not_disturb = PHONE_DND_ON to_chat(user, SPAN_WARNING("Do Not Disturb has been enabled. No calls will be received.")) else return FALSE @@ -440,21 +444,22 @@ GLOBAL_LIST_EMPTY_TYPED(phones, /datum/component/phone) call_phone(ui.user, params["phone_id"]) return TRUE - if("toggle_do_not_disturb") - toggle_do_not_disturb(ui.user) + if("toggle_dnd") + toggle_dnd(ui.user) return TRUE /datum/component/phone/ui_data(mob/user) var/list/data = list() - data["do_not_disturb"] = do_not_disturb + data["availability"] = do_not_disturb + data["last_caller"] = last_caller return data /datum/component/phone/ui_static_data(mob/user) . = list() - .["available_phones"] = get_phones() - list(phone_id) + .["available_transmitters"] = get_phones() - list(phone_id) var/list/phones = list() for(var/datum/component/phone/cycled_phone as anything in GLOB.phones) phones += list(list( @@ -464,7 +469,7 @@ GLOBAL_LIST_EMPTY_TYPED(phones, /datum/component/phone) "phone_icon" = cycled_phone.phone_icon )) - .["phones"] = phones + .["transmitters"] = phones /datum/component/phone/tgui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) @@ -526,10 +531,10 @@ GLOBAL_LIST_EMPTY_TYPED(phones, /datum/component/phone) if(calling_phone) return FALSE - if(do_not_disturb == PHONE_DO_NOT_DISTURB_ON) + if(do_not_disturb == PHONE_DND_ON) return FALSE - if(do_not_disturb == PHONE_DO_NOT_DISTURB_FORCED) + if(do_not_disturb == PHONE_DND_FORCED) return FALSE return TRUE diff --git a/code/modules/admin/game_master/game_master.dm b/code/modules/admin/game_master/game_master.dm index 2745287727..874bc14ecf 100644 --- a/code/modules/admin/game_master/game_master.dm +++ b/code/modules/admin/game_master/game_master.dm @@ -117,7 +117,7 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100) current_submenus = list() game_master_phone = new(null) - game_master_phone.AddComponent(/datum/component/phone/virtual, "Game Master", "white", "Company Command", null, PHONE_DO_NOT_DISTURB_ON, list(FACTION_MARINE, FACTION_COLONIST, FACTION_WY), list(FACTION_MARINE, FACTION_COLONIST, FACTION_WY), null, using_client) + game_master_phone.AddComponent(/datum/component/phone/virtual, "Game Master", "white", "Company Command", null, PHONE_DND_ON, list(FACTION_MARINE, FACTION_COLONIST, FACTION_WY), list(FACTION_MARINE, FACTION_COLONIST, FACTION_WY), null, using_client) game_master_client.click_intercept = src diff --git a/code/modules/cm_phone/phone_base.dm b/code/modules/cm_phone/phone_base.dm index d5f252846b..7c64fd7ee3 100644 --- a/code/modules/cm_phone/phone_base.dm +++ b/code/modules/cm_phone/phone_base.dm @@ -11,7 +11,7 @@ var/phone_icon /// Whether or not the phone is receiving calls or not. Varies between on/off or forcibly on/off. - var/do_not_disturb = PHONE_DO_NOT_DISTURB_OFF + var/do_not_disturb = PHONE_DND_OFF var/list/networks_receive = list(FACTION_MARINE) var/list/networks_transmit = list(FACTION_MARINE) @@ -45,10 +45,10 @@ icon_state = PHONE_ON_BASE_UNIT_ICON_STATE /obj/structure/phone_base/hidden - do_not_disturb = PHONE_DO_NOT_DISTURB_FORCED + do_not_disturb = PHONE_DND_FORCED /obj/structure/phone_base/no_dnd - do_not_disturb = PHONE_DO_NOT_DISTURB_FORBIDDEN + do_not_disturb = PHONE_DND_FORBIDDEN //rotary desk phones (need a touch tone handset at some point) /obj/structure/phone_base/rotary @@ -57,7 +57,7 @@ desc = "The finger plate is a little stiff." /obj/structure/phone_base/rotary/no_dnd - do_not_disturb = PHONE_DO_NOT_DISTURB_FORBIDDEN + do_not_disturb = PHONE_DND_FORBIDDEN /obj/structure/phone_base/touchtone name = "touch-tone telephone" diff --git a/tgui/packages/tgui/interfaces/PhoneMenu.jsx b/tgui/packages/tgui/interfaces/PhoneMenu.jsx index a26e071811..5363c37934 100644 --- a/tgui/packages/tgui/interfaces/PhoneMenu.jsx +++ b/tgui/packages/tgui/interfaces/PhoneMenu.jsx @@ -24,8 +24,8 @@ const GeneralPanel = (props) => { ); const categories = []; - for (let i = 0; i < phones.length; i++) { - let data = phones[i]; + for (let i = 0; i < transmitters.length; i++) { + let data = transmitters[i]; if (categories.includes(data.phone_category)) continue; categories.push(data.phone_category); @@ -38,14 +38,14 @@ const GeneralPanel = (props) => { let dnd_tooltip = 'Do Not Disturb is DISABLED'; let dnd_locked = 'No'; let dnd_icon = 'volume-high'; - if (do_not_disturb === 1) { + if (availability === 1) { dnd_tooltip = 'Do Not Disturb is ENABLED'; dnd_icon = 'volume-xmark'; - } else if (do_not_disturb >= 2) { + } else if (availability >= 2) { dnd_tooltip = 'Do Not Disturb is ENABLED (LOCKED)'; dnd_locked = 'Yes'; dnd_icon = 'volume-xmark'; - } else if (do_not_disturb < 0) { + } else if (availability < 0) { dnd_tooltip = 'Do Not Disturb is DISABLED (LOCKED)'; dnd_locked = 'Yes'; } @@ -77,7 +77,7 @@ const GeneralPanel = (props) => {
- {phones.map((val) => { + {transmitters.map((val) => { if ( val.phone_category !== currentCategory || !val.phone_id.toLowerCase().match(currentSearch) @@ -122,6 +122,7 @@ const GeneralPanel = (props) => { )} + {!!last_caller && Last Caller: {last_caller}}