NTOS PDA Messenger update username based on ID (#15560)

* namechange on id

* Update ntpda_msg.dm

* make wider and set on spawn and apply to phones

* extend max name len
This commit is contained in:
ynot01
2022-10-08 08:30:14 -05:00
committed by GitHub
parent 648fbcdb65
commit 7f928a2019
5 changed files with 45 additions and 6 deletions

View File

@@ -537,13 +537,13 @@ SUBSYSTEM_DEF(job)
job.give_donor_stuff(living_mob, M) // yogs - Donor Features
job.give_cape(living_mob, M)
job.give_map_flare(living_mob, M)
var/obj/item/modular_computer/RPDA = locate(/obj/item/modular_computer/tablet/pda) in living_mob.GetAllContents()
var/obj/item/modular_computer/RPDA = locate(/obj/item/modular_computer/tablet) in living_mob.GetAllContents()
if(istype(RPDA))
RPDA.device_theme = GLOB.pda_themes[M.client.prefs.pda_theme]
var/obj/item/computer_hardware/hard_drive/hard_drive = RPDA.all_components[MC_HDD]
var/datum/computer_file/program/pdamessager/msgr = locate(/datum/computer_file/program/pdamessager) in hard_drive.stored_files
if(msgr)
msgr.username = living_mob.real_name
msgr.username = "[living_mob.real_name] ([alt_title ? alt_title : rank])"
msgr.receiving = TRUE
if(SSevents.holidays && SSevents.holidays["St. Patrick's Day"])
irish_override() // Assuming direct control.

View File

@@ -300,6 +300,10 @@
var/obj/item/card/id/stored_id = GetID()
if(id_rename && stored_id)
name = "[stored_id.registered_name]'s [initial(name)] ([stored_id.assignment])"
var/obj/item/computer_hardware/hard_drive/hard_drive = all_components[MC_HDD]
var/datum/computer_file/program/pdamessager/msgr = hard_drive.find_file_by_name("pda_client")
if(istype(msgr))
msgr.username = "[stored_id.registered_name] ([stored_id.assignment])"
else
name = initial(name)

View File

@@ -338,10 +338,28 @@ GLOBAL_LIST_EMPTY(NTPDAMessages)
return TRUE
if("PRG_namechange")
var/newname = reject_bad_text(params["name"], max_length = 35)
if(computer.GetID())
computer.visible_message(span_danger("Username is ID-locked!"), null, null, 1)
return
var/unsanitized = params["name"]
if(isnotpretty(unsanitized))
if(usr.client.prefs.muted & MUTE_IC)
return
usr.client.handle_spam_prevention("PRETTY FILTER", MUTE_ALL) // Constant message mutes someone faster for not pretty messages
to_chat(usr, "<span class='notice'>Your fingers slip. <a href='https://forums.yogstation.net/help/rules/#rule-0_1'>See rule 0.1</a>.</span>")
var/log_message = "[key_name(usr)] just tripped a pretty filter: '[unsanitized]'."
message_admins(log_message)
log_say(log_message)
return
var/newname = reject_bad_text(unsanitized, max_length = 55)
if(!newname)
computer.visible_message(span_danger("Your username is too long/has bad text!"), null, null, 1)
return
for(var/datum/computer_file/program/pdamessager/P in GLOB.NTPDAs)
if(newname == P.username)
computer.visible_message(span_danger("Someone already has the username \"[newname]\"!"), null, null, 1)
@@ -361,10 +379,24 @@ GLOBAL_LIST_EMPTY(NTPDAMessages)
if(computer.uplink_check(usr, params["name"]))
return TRUE
else
var/newring = reject_bad_text(params["name"], max_length = 10)
var/unsanitized = params["name"]
if(isnotpretty(unsanitized))
if(usr.client.prefs.muted & MUTE_IC)
return
usr.client.handle_spam_prevention("PRETTY FILTER", MUTE_ALL) // Constant message mutes someone faster for not pretty messages
to_chat(usr, "<span class='notice'>Your fingers slip. <a href='https://forums.yogstation.net/help/rules/#rule-0_1'>See rule 0.1</a>.</span>")
var/log_message = "[key_name(usr)] just tripped a pretty filter: '[unsanitized]'."
message_admins(log_message)
log_say(log_message)
return
var/newring = reject_bad_text(unsanitized, max_length = 10)
if(!newring)
computer.visible_message(span_danger("Your ringtone is too long/has bad text!"), null, null, 1)
return
ringtone = newring
computer.visible_message(span_notice("Ringtone set to [newring]."), null, null, 1)
return TRUE

View File

@@ -28,7 +28,7 @@ export const NtosPdaMsg = (props, context) => {
return (
<NtosWindow
theme={PC_device_theme}
width={400}
width={600}
height={480}>
<NtosWindow.Content scrollable>
{showing_messages ?
@@ -131,7 +131,7 @@ export const NtosPdaMsg = (props, context) => {
<Grid.Column size={4}>
<Button.Input
fluid
content={pdadata[0].substring(0, 35)}
content={pdadata[0].substring(0, 55)}
disabled={!can_message || !receiving}
color={can_message && receiving ? 'blue' : 'primary'}
onCommit={(e, value) => act('PRG_sendmsg', {

View File

@@ -33,15 +33,18 @@
var/obj/item/modular_computer/tablet/pda/PDA = locate(/obj/item/modular_computer/tablet/pda) in H.GetAllContents()
if(PDA)
PDA.finish_color = "glass"
PDA.update_icon()
if(3)//pip-boy
var/obj/item/modular_computer/tablet/pda/PDA = locate(/obj/item/modular_computer/tablet/pda) in H.GetAllContents()
if(PDA)
PDA.finish_color = "pipboy"
PDA.slot_flags |= ITEM_SLOT_GLOVES
PDA.update_icon()
if(4)//rainbow
var/obj/item/modular_computer/tablet/pda/PDA = locate(/obj/item/modular_computer/tablet/pda) in H.GetAllContents()
if(PDA)
PDA.finish_color = "rainbow"
PDA.update_icon()
/datum/job/proc/give_cape(mob/living/H, mob/M)
var/client/C = M.client