From 016c9a38e7a903ae1d9a838c2c2812f124751f9f Mon Sep 17 00:00:00 2001 From: CHOMPStation2 <58959929+CHOMPStation2@users.noreply.github.com> Date: Tue, 31 Oct 2023 14:27:32 -0700 Subject: [PATCH] [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 --- code/modules/paperwork/faxmachine.dm | 43 +++++++++++++++++++++++++ code/modules/paperwork/paper.dm | 4 +-- tgui/packages/tgui/interfaces/Fax.js | 10 +++++- tgui/packages/tgui_ch/interfaces/Fax.js | 10 +++++- tgui/public/tgui.bundle.js | 2 +- 5 files changed, 64 insertions(+), 5 deletions(-) diff --git a/code/modules/paperwork/faxmachine.dm b/code/modules/paperwork/faxmachine.dm index eae964edb8..d6d2558d95 100644 --- a/code/modules/paperwork/faxmachine.dm +++ b/code/modules/paperwork/faxmachine.dm @@ -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) diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index 426426ad2e..46d2284f9f 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -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)) diff --git a/tgui/packages/tgui/interfaces/Fax.js b/tgui/packages/tgui/interfaces/Fax.js index 86d8ea2982..75f789d6b1 100644 --- a/tgui/packages/tgui/interfaces/Fax.js +++ b/tgui/packages/tgui/interfaces/Fax.js @@ -59,7 +59,15 @@ export const FaxContent = (props, context) => { - {copyItem} + {copyItem}{' '} + ",rt+='
',rt+='
',rt+="Addons:
"+function(e){var t=[];return null==e||e.forEach((function(e){t.push(''+e+"")})),0===t.length&&t.push("No Addons Set"),t}(p)+"

",rt+="== Descriptions ==
",rt+="Vore Verb:
"+a+"

",rt+="Release Verb:
"+i+"

",rt+='Description:
"'+o+'"

',rt+='Absorbed Description:
"'+r+'"

',rt+="
",rt+="== Messages ==
",rt+='
',rt+='
",rt+='
',rt+='
',rt+='
',null==M||M.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==E||E.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==O||O.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==P||P.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==F||F.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==D||D.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==R||R.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==j||j.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==W||W.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==z||z.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==U||U.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==H||H.forEach((function(e){rt+=e+"
"})),rt+="
",rt+="
",rt+="
",rt+="
",rt+="
= Idle Messages =

",rt+="

Idle Messages (Hold):

",null==G||G.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Hold Absorbed):

",null==K||K.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Digest):

",null==q||q.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Absorb):

",null==Y||Y.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Unabsorb):

",null==te||te.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Drain):

",null==X||X.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Heal):

",null==$||$.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Size Steal):

",null==Q||Q.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Shrink):

",null==Z||Z.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Grow):

",null==ee||ee.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Encase In Egg):

",null==J||J.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="


",rt+="
",rt+='
',rt+='
',rt+='

',rt+='

",rt+='
',rt+='
',rt+='
    ',rt+='
  • Can Taste: '+(N?'Yes':'No')+"
  • ",rt+='
  • Feedable: '+(g?'Yes':'No')+"
  • ",rt+='
  • Contaminates: '+(V?'Yes':'No')+"
  • ",rt+='
  • Contamination Flavor: '+v+"
  • ",rt+='
  • Contamination Color: '+_+"
  • ",rt+='
  • Nutritional Gain: '+y+"%
  • ",rt+='
  • Required Examine Size: '+100*k+"%
  • ",rt+='
  • Display Absorbed Examines: '+(x?'True':'False')+"
  • ",rt+='
  • Save Digest Mode: '+(w?'True':'False')+"
  • ",rt+='
  • Idle Emotes: '+(L?'Active':'Inactive')+"
  • ",rt+='
  • Idle Emote Delay: '+B+" seconds
  • ",rt+='
  • Shrink/Grow Size: '+100*S+"%
  • ",rt+='
  • Vore Spawn Blacklist: '+(I?'Yes':'No')+"
  • ",rt+='
  • Egg Type: '+T+"
  • ",rt+='
  • Selective Mode Preference: '+A+"
  • ",rt+="
",rt+="
",rt+='
',rt+='

',rt+='

",rt+='
',rt+='
',rt+='
    ',rt+='
  • Fleshy Belly: '+(ne?'Yes':'No')+"
  • ",rt+='
  • Internal Loop: '+(oe?'Yes':'No')+"
  • ",rt+='
  • Use Fancy Sounds: '+(re?'Yes':'No')+"
  • ",rt+='
  • Vore Sound: '+ae+"
  • ",rt+='
  • Release Sound: '+ie+"
  • ",rt+="
",rt+="
",rt+='
',rt+='

',rt+='

",rt+='
",rt+='
',rt+="Vore Sprites",rt+='
    ',rt+='
  • Affect Vore Sprites: '+(ce?'Yes':'No')+"
  • ",rt+='
  • Count Absorbed prey for vore sprites: '+(le?'Yes':'No')+"
  • ",rt+='
  • Animation when prey resist: '+(de?'Yes':'No')+"
  • ",rt+='
  • Vore Sprite Size Factor: '+se+"
  • ",rt+='
  • Belly Sprite to affect: '+ue+"
  • ",rt+="
",rt+="Belly Fullscreens Preview and Coloring",rt+='
    ',rt+='
  • Color: '+me+"",rt+="
",rt+="Vore FX",rt+='
    ',rt+='
  • Disable Prey HUD: '+(pe?'Yes':'No')+"
  • ",rt+="
",rt+="
",rt+='
',rt+='

',rt+='

",rt+='
',rt+='
',rt+="Belly Interactions ("+(he?'Enabled':'Disabled')+")",rt+='
    ',rt+='
  • Escape Chance: '+fe+"%
  • ",rt+='
  • Escape Time: '+Ce/10+"s
  • ",rt+='
  • Transfer Chance: '+be+"%
  • ",rt+='
  • Transfer Location: '+Ne+"
  • ",rt+='
  • Secondary Transfer Chance: '+ge+"%
  • ",rt+='
  • Secondary Transfer Location: '+Ve+"
  • ",rt+='
  • Absorb Chance: '+ve+"%
  • ",rt+='
  • Digest Chance: '+_e+"%
  • ",rt+="
",rt+="
",rt+="Auto-Transfer Options ("+(Be?'Enabled':'Disabled')+")",rt+='
    ',rt+='
  • Auto-Transfer Time: '+ye/10+"s
  • ",rt+='
  • Auto-Transfer Min Amount: '+Se+"
  • ",rt+='
  • Auto-Transfer Max Amount: '+Ie+"
  • ",rt+='
  • Auto-Transfer Primary Chance: '+ke+"%
  • ",rt+='
  • Auto-Transfer Primary Location: '+xe+"
  • ",rt+='
  • Auto-Transfer Primary Whitelist (Mobs): '+m(Te,!0)+"
  • ",rt+='
  • Auto-Transfer Primary Whitelist (Items): '+m(Oe,!0)+"
  • ",rt+='
  • Auto-Transfer Primary Blacklist (Mobs): '+m(Ae,!1)+"
  • ",rt+='
  • Auto-Transfer Primary Blacklist (Items): '+m(Pe,!1)+"
  • ",rt+='
  • Auto-Transfer Secondary Chance: '+we+"%
  • ",rt+='
  • Auto-Transfer Secondary Location: '+Le+"
  • ",rt+='
  • Auto-Transfer Secondary Whitelist (Mobs): '+m(Me,!0)+"
  • ",rt+='
  • Auto-Transfer Secondary Whitelist (Items): '+m(Fe,!0)+"
  • ",rt+='
  • Auto-Transfer Secondary Blacklist (Mobs): '+m(Ee,!1)+"
  • ",rt+='
  • Auto-Transfer Secondary Blacklist (Items): '+m(De,!1)+"
  • ",rt+="
",rt+="
",rt+='
',rt+='

',rt+='

",rt+='
',rt+='
',rt+='
    ',rt+='
  • Generate Liquids: '+(je?'On':'Off')+"
  • ",rt+='
  • Liquid Type: '+We+"
  • ",rt+='
  • Liquid Name: '+ze+"
  • ",rt+='
  • Transfer Verb: '+Ue+"
  • ",rt+='
  • Generation Time: '+He+"
  • ",rt+='
  • Liquid Capacity: '+qe+"
  • ",rt+='
  • Slosh Sounds: '+(Ge?'On':'Off')+"
  • ",rt+='
  • Liquid Addons: '+function(e){var t=[];return null==e||e.forEach((function(e){t.push(''+e+"")})),0===t.length&&t.push("No Addons Set"),t}(Ke)+"
  • ",rt+="
",rt+="
",rt+='
',rt+='

',rt+='

",rt+='
',rt+='
',rt+='
',rt+='
",rt+='
',rt+='
',rt+='
',null==Ze||Ze.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==et||et.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==tt||tt.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==nt||nt.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==ot||ot.forEach((function(e){rt+=e+"
"})),rt+="
",rt+="
",rt+="
",rt+="
",rt+="
",rt+="
"},h=function(e,t){var n,o=(0,r.useBackend)(e),a=(o.act,o.data),i=a.db_version,c=a.db_repo,l=a.mob_name,d=a.bellies,s=function(){var e=new Date,t=String(e.getHours());t.length<2&&(t="0"+t);var n=String(e.getMinutes());n.length<2&&(n="0"+n);var o=String(e.getDate());o.length<2&&(o="0"+o);var r=String(e.getMonth()+1);return r.length<2&&(r="0"+r)," "+String(e.getFullYear())+"-"+r+"-"+o+" ("+t+" "+n+")"}(),u=l+s+t;if(".html"===t){n=new Blob([''+d.length+" Exported Bellies (DB_VER: "+c+"-"+i+')

Bellies of '+l+'

Generated on: '+s+'

'],{type:"text/html;charset=utf8"}),d.forEach((function(e,t){n=new Blob([n,p(e,t)],{type:"text/html;charset=utf8"})})),n=new Blob([n,"
",'