mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-09 16:12:17 +00:00
[MIRROR] Creates prompt to rename faxes if using default name, updates bundle naming logic (#7149)
Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com> Co-authored-by: Nadyr <41974248+Darlantanis@users.noreply.github.com> Co-authored-by: Darlantan <forlirnglacignis@gmail.com>
This commit is contained in:
@@ -224,9 +224,18 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("rename")
|
||||
if(copyitem)
|
||||
var/new_name = tgui_input_text(usr, "Enter new paper title", "This will show up in the preview for staff chat on discord when sending \
|
||||
to central.", copyitem.name, MAX_NAME_LEN)
|
||||
if(!new_name)
|
||||
return
|
||||
copyitem.name = new_name
|
||||
if("send")
|
||||
if(copyitem)
|
||||
if (destination in admin_departments)
|
||||
if(check_if_default_title_and_rename())
|
||||
return
|
||||
send_admin_fax(usr, destination)
|
||||
else
|
||||
sendfax(destination)
|
||||
@@ -243,6 +252,40 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
|
||||
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/proc/check_if_default_title_and_rename()
|
||||
/*
|
||||
Returns TRUE only on "Cancel" or invalid newname, else returns null/false
|
||||
Extracted to its own procedure for easier logic handling with paper bundles.
|
||||
*/
|
||||
var/question_text = "Your fax is set to its default name. It's advisable to rename it to something self-explanatory to"
|
||||
|
||||
if(istype(copyitem, /obj/item/weapon/paper_bundle))
|
||||
var/obj/item/weapon/paper_bundle/B = copyitem
|
||||
if(B.name != initial(B.name))
|
||||
var/atom/page1 = B.pages[1] //atom is enough for us to ensure it has name var. would've used ?. opertor, but linter doesnt like.
|
||||
var/atom/page2 = B.pages[2]
|
||||
if((istype(page1) && B.name == page1.name) || (istype(page2) && B.name == page2.name) )
|
||||
question_text = "Your fax is set to use the title of its first or second page. It's advisable to rename it to something \
|
||||
summarizing the entire bundle succintly to"
|
||||
else
|
||||
return FALSE
|
||||
else if(copyitem.name != initial(copyitem.name))
|
||||
return FALSE
|
||||
|
||||
var/choice = tgui_alert(usr, "[question_text] improve response time from staff when sending to discord. \
|
||||
Renaming it changes its preview in staff chat.", \
|
||||
"Default name detected", list("Change Title","Continue", "Cancel"))
|
||||
if(choice == "Cancel")
|
||||
return TRUE
|
||||
else if(choice == "Change Title")
|
||||
var/new_name = tgui_input_text(usr, "Enter new fax title", "This will show up in the preview for staff chat on discord when sending \
|
||||
to central.", copyitem.name, MAX_NAME_LEN)
|
||||
if(!new_name)
|
||||
return TRUE
|
||||
copyitem.name = new_name
|
||||
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/attackby(obj/item/O as obj, mob/user as mob)
|
||||
if(istype(O, /obj/item/weapon/card/id) && !scan)
|
||||
user.drop_from_inventory(O)
|
||||
|
||||
@@ -570,9 +570,9 @@
|
||||
add_fingerprint(user)
|
||||
return
|
||||
var/obj/item/weapon/paper_bundle/B = new(src.loc)
|
||||
if (name != "paper")
|
||||
if (name != initial(name))
|
||||
B.name = name
|
||||
else if (P.name != "paper" && P.name != "photo")
|
||||
else if (P.name != initial(P.name))
|
||||
B.name = P.name
|
||||
user.drop_from_inventory(P)
|
||||
if (istype(user, /mob/living/carbon/human))
|
||||
|
||||
@@ -59,7 +59,15 @@ export const FaxContent = (props, context) => {
|
||||
<Box mt={1}>
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Currently Sending">
|
||||
{copyItem}
|
||||
{copyItem}{' '}
|
||||
<Button
|
||||
icon="pen"
|
||||
onClick={() => act('rename')}
|
||||
tooltip={
|
||||
'Renames the paper. This changes its preview in staff chat when sending to centcom/job board/supply (admin departments).\
|
||||
It is advisable to name your faxes something self-explanatory for quick response.'
|
||||
}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Sending To">
|
||||
<Button
|
||||
|
||||
@@ -59,7 +59,15 @@ export const FaxContent = (props, context) => {
|
||||
<Box mt={1}>
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Currently Sending">
|
||||
{copyItem}
|
||||
{copyItem}{' '}
|
||||
<Button
|
||||
icon="pen"
|
||||
onClick={() => act('rename')}
|
||||
tooltip={
|
||||
'Renames the paper. This changes its preview in staff chat when sending to centcom/job board/supply (admin departments).\
|
||||
It is advisable to name your faxes something self-explanatory for quick response.'
|
||||
}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Sending To">
|
||||
<Button
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user