PDA Ringtone Preference (#70485)

* Creates some new defines for constant values in the Messenger app
* Created a new type of preference, text preferences, with a FeatureShortTextInput TGUI component
* Uses said new preference to re-add a PDA ringtone preference.
This commit is contained in:
GoldenAlpharex
2022-10-16 17:33:40 -04:00
committed by GitHub
parent 6ce946a056
commit e613c875b7
9 changed files with 139 additions and 25 deletions
@@ -146,6 +146,32 @@
explosion(src, devastation_range = -1, heavy_impact_range = -1, light_impact_range = 2, flash_range = 3)
qdel(src)
/**
* A simple helper proc that applies the client's ringtone prefs to the tablet's messenger app,
* if it has one.
*
* Arguments:
* * ringtone_client - The client whose prefs we'll use to set the ringtone of this PDA.
*/
/obj/item/modular_computer/tablet/proc/update_ringtone(client/ringtone_client)
if(!ringtone_client)
return
var/new_ringtone = ringtone_client?.prefs?.read_preference(/datum/preference/text/pda_ringtone)
if(!new_ringtone || new_ringtone == MESSENGER_RINGTONE_DEFAULT)
return
var/obj/item/computer_hardware/hard_drive/drive = all_components[MC_HDD]
if(!drive)
return
for(var/datum/computer_file/program/messenger/messenger_app in drive.stored_files)
messenger_app.ringtone = new_ringtone
// SUBTYPES
/obj/item/modular_computer/tablet/syndicate_contract_uplink
@@ -15,7 +15,7 @@
alert_able = TRUE
/// The current ringtone (displayed in the chat when a message is received).
var/ringtone = "beep"
var/ringtone = MESSENGER_RINGTONE_DEFAULT
/// Whether or not the ringtone is currently on.
var/ringer_status = TRUE
/// Whether or not we're sending and receiving messages.
@@ -114,7 +114,7 @@
switch(action)
if("PDA_ringSet")
var/new_ringtone = tgui_input_text(usr, "Enter a new ringtone", "Ringtone", ringtone, 20)
var/new_ringtone = tgui_input_text(usr, "Enter a new ringtone", "Ringtone", ringtone, MESSENGER_RINGTONE_MAX_LENGTH)
var/mob/living/usr_mob = usr
if(!new_ringtone || !in_range(computer, usr_mob) || computer.loc != usr_mob)
return