Skip to content

Commit

Permalink
Custom HeaderText on Wanted/Missing Posters (#44260)
Browse files Browse the repository at this point in the history
* Allows custom headertext

* Allow security console to use custom header text.

* Fix 'A' and max_length on input

* Update wanted_poster.dm
  • Loading branch information
Rockdtben authored and AnturK committed Jun 3, 2019
1 parent 1f5a062 commit 2d90bf1
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 10 deletions.
8 changes: 6 additions & 2 deletions code/game/machinery/computer/security.dm
Original file line number Diff line number Diff line change
Expand Up @@ -439,29 +439,33 @@ 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)
printing = 1
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 ))
var/missing_name = stripped_input(usr, "Please enter an alias for the missing person:", "Print Missing Persons Poster", active1.fields["name"])
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)
printing = 1
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
Expand Down
48 changes: 40 additions & 8 deletions code/game/objects/effects/wanted_poster.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,55 +9,87 @@

/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])"
desc = description

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


Binary file added icons/Font_Minimal.dmi
Binary file not shown.

0 comments on commit 2d90bf1

Please sign in to comment.