From 2d90bf1ca853c130f6a74897d0fd8baa7831dd9d Mon Sep 17 00:00:00 2001 From: Rockdtben Date: Mon, 3 Jun 2019 14:15:28 -0500 Subject: [PATCH] Custom HeaderText on Wanted/Missing Posters (#44260) * Allows custom headertext * Allow security console to use custom header text. * Fix 'A' and max_length on input * Update wanted_poster.dm --- code/game/machinery/computer/security.dm | 8 +++- code/game/objects/effects/wanted_poster.dm | 48 +++++++++++++++++---- icons/Font_Minimal.dmi | Bin 0 -> 757 bytes 3 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 icons/Font_Minimal.dmi diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 629c38e918a5..03426a822449 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -439,6 +439,8 @@ What a mess.*/ default_description += "\n[c.crimeName]\n" default_description += "[c.crimeDetails]\n" + var/headerText = stripped_input(usr, "Please enter Poster Heading (Max 7 Chars):", "Print Wanted Poster", "WANTED", 8) + var/info = stripped_multiline_input(usr, "Please input a description for the poster:", "Print Wanted Poster", default_description, null) if(info) playsound(loc, 'sound/items/poster_being_created.ogg', 100, 1) @@ -446,7 +448,7 @@ What a mess.*/ sleep(30) if((istype(active1, /datum/data/record) && GLOB.data_core.general.Find(active1)))//make sure the record still exists. var/obj/item/photo/photo = active1.fields["photo_front"] - new /obj/item/poster/wanted(loc, photo.picture.picture_image, wanted_name, info) + new /obj/item/poster/wanted(loc, photo.picture.picture_image, wanted_name, info, headerText) printing = 0 if("Print Missing") if(!( printing )) @@ -454,6 +456,8 @@ What a mess.*/ if(missing_name) var/default_description = "A poster declaring [missing_name] to be a missing individual, missed by Nanotrasen. Report any sightings to security immediately." + var/headerText = stripped_input(usr, "Please enter Poster Heading (Max 7 Chars):", "Print Missing Persons Poster", "MISSING", 8) + var/info = stripped_multiline_input(usr, "Please input a description for the poster:", "Print Missing Persons Poster", default_description, null) if(info) playsound(loc, 'sound/items/poster_being_created.ogg', 100, 1) @@ -461,7 +465,7 @@ What a mess.*/ sleep(30) if((istype(active1, /datum/data/record) && GLOB.data_core.general.Find(active1)))//make sure the record still exists. var/obj/item/photo/photo = active1.fields["photo_front"] - new /obj/item/poster/wanted/missing(loc, photo.picture.picture_image, missing_name, info) + new /obj/item/poster/wanted/missing(loc, photo.picture.picture_image, missing_name, info, headerText) printing = 0 //RECORD DELETE diff --git a/code/game/objects/effects/wanted_poster.dm b/code/game/objects/effects/wanted_poster.dm index e5847f1a4001..5cc2923f5ae7 100644 --- a/code/game/objects/effects/wanted_poster.dm +++ b/code/game/objects/effects/wanted_poster.dm @@ -9,33 +9,40 @@ /obj/item/poster/wanted icon_state = "rolled_poster" - var/foreground = "wanted_foreground" + var/postHeaderText = "WANTED" // MAX 7 Characters + var/postHeaderColor = "#FF0000" var/background = "wanted_background" var/postName = "wanted poster" var/postDesc = "A wanted poster for" /obj/item/poster/wanted/missing - foreground = "missing_foreground" postName = "missing poster" postDesc = "A missing poster for" + postHeaderText = "MISSING" // MAX 7 Characters + postHeaderColor = "#0000FF" -/obj/item/poster/wanted/Initialize(mapload, icon/person_icon, wanted_name, description) - . = ..(mapload, new /obj/structure/sign/poster/wanted(src, person_icon, wanted_name, description, foreground, background, postName, postDesc)) +/obj/item/poster/wanted/Initialize(mapload, icon/person_icon, wanted_name, description, headerText) + . = ..(mapload, new /obj/structure/sign/poster/wanted(src, person_icon, wanted_name, description, headerText, postHeaderColor, background, postName, postDesc)) name = "[postName] ([wanted_name])" desc = "[postDesc] [wanted_name]." + postHeaderText = headerText /obj/structure/sign/poster/wanted var/wanted_name var/postName var/postDesc + var/posterHeaderText + var/posterHeaderColor -/obj/structure/sign/poster/wanted/Initialize(mapload, icon/person_icon, person_name, description, foreground, background, pname, pdesc) +/obj/structure/sign/poster/wanted/Initialize(mapload, icon/person_icon, person_name, description, postHeaderText, postHeaderColor, background, pname, pdesc) . = ..() if(!person_icon) return INITIALIZE_HINT_QDEL postName = pname postDesc = pdesc + posterHeaderText = postHeaderText + posterHeaderColor = postHeaderColor wanted_name = person_name name = "[postName] ([wanted_name])" @@ -43,21 +50,46 @@ person_icon = icon(person_icon, dir = SOUTH)//copy the image so we don't mess with the one in the record. var/icon/the_icon = icon("icon" = 'icons/obj/poster_wanted.dmi', "icon_state" = background) - var/icon/icon_foreground = icon("icon" = 'icons/obj/poster_wanted.dmi', "icon_state" = foreground) person_icon.Shift(SOUTH, 7) person_icon.Crop(7,4,26,30) person_icon.Crop(-5,-2,26,29) the_icon.Blend(person_icon, ICON_OVERLAY) - the_icon.Blend(icon_foreground, ICON_OVERLAY) + // Print text on top of poster. + print_across_top(the_icon, postHeaderText, postHeaderColor) + the_icon.Insert(the_icon, "wanted") the_icon.Insert(icon('icons/obj/contraband.dmi', "poster_being_set"), "poster_being_set") the_icon.Insert(icon('icons/obj/contraband.dmi', "poster_ripped"), "poster_ripped") + icon = the_icon +/* + This proc will write "WANTED" or MISSING" at the top of the poster. + + You can put other variables in like text and color + + text: Up to 7 characters of text to be printed on the top of the poster. + color: This set the text color: #ff00ff +*/ +/obj/structure/sign/poster/wanted/proc/print_across_top(icon/poster_icon, text, color) + var/textLen = min(length(text), 7) + var/startX = 16 - (2*textLen) + var/i + for(i=1; i <= textLen, i++) + var/letter = uppertext(text[i]) + var/icon/letter_icon = icon("icon" = 'icons/Font_Minimal.dmi', "icon_state" = letter) + letter_icon.Shift(EAST, startX) //16 - (2*n) + letter_icon.Shift(SOUTH, 2) + letter_icon.SwapColor(rgb(255,255,255), color) + poster_icon.Blend(letter_icon, ICON_OVERLAY) + startX = startX + 4 + /obj/structure/sign/poster/wanted/roll_and_drop(turf/location) var/obj/item/poster/wanted/P = ..(location) P.name = "[postName] ([wanted_name])" P.desc = "[postDesc] [wanted_name]." + P.postHeaderText = posterHeaderText + P.postHeaderColor = posterHeaderColor return P - \ No newline at end of file + diff --git a/icons/Font_Minimal.dmi b/icons/Font_Minimal.dmi new file mode 100644 index 0000000000000000000000000000000000000000..07ca83c0f97e50065a9a3cf0da51b03f5479b009 GIT binary patch literal 757 zcmVAi=v0(9>oKSM-+V&Pbi*I3{VVFj8KeGyrIaT z$fC%h$fGzzagO2wMFB+-MH)o{MHR&kMFd3yg@)n)#UYAU6j2m06vrq|P|Q%oQA|+0 zpqNgPlu;a^I7N{}kwURW@r~jOMTw89BB`LLp{V~SG-+7+@9Xpf>7#5-6V!&=0004e zNkl`*qU8f-Mx8!N^Ebw$-btBMpo@V-L_}l@>K*>6jG-2oKVDea*^)!ETJwTU8@X-< zC>WU=`Il>aFwl(!tW>4UtQ(1li0nzK52bEavQreCu&JBH`B`M4y6Ef~#uvTA%$Py) zKYnt|NJKjpXJ&RGa>`?7sel-(bA|B z5fPCsNZqWGDo>5YC_aP!8B0DkQFQVWL zn^LuJuIE4(D5{aPk?_kq)|b|sO~D^sMoBAjWBKunL_|bnD^d^W&v$3K0@QgtgmQ&d noOWZ;mBb#S{t*!o`B(e^y?#2?3g88E00000NkvXXu0mjfG^