Files
Bubberstation/code/game/objects/effects/wanted_poster.dm
Sol N cba002fa91 converts contraband file into poster file, makes holiday posters work (kind of) (#72131)
## About The Pull Request

The first part of this is just something that bothered me when I was
messing around with something that I will PR in the new year,
contraband.dm and dmi is ONLY posters. There's nothing else in there and
there are plenty of official posters, and if with #71717 we will also
add holiday posters to the mix then I think that its time to retire
contraband and make it poster.

Some small things I did while messing with it was change some variables
that were single letters into actual variable names, but overall this
part of the pr is not a player facing change.

That said, speaking of #71717 I think that it didn't work? Or didn't
work the way that it was supposed to? All of the spawned posters aren't
instances of festive posters, they are instances of normal posters, so
the code on initialize was not doing anything and the only reason the
holiday_none poster was showing up was because of the proc in randomize
spawning the posters in as those other posters. Because it didn't
actually _become_ poster/official/festive it never could do the proc
that turns it into a poster for the holiday that is actually occurring.

But then when I made it work and it turned into the generic posters I
decided that it would be better if instead of 30% of all posters being a
half finished mess, that if there wasn't a holiday poster it just
wouldn't replace them at all. I have poster Ideas and Dreams so I will
try to help with adding to more holiday posters but not in this PR.

What IS in this PR though, is a new traitor poster that appears during
the holidays.

![dreamseeker_MxxBzXIxiy](https://user-images.githubusercontent.com/116288367/208793262-9d4a45dc-f7bb-4208-b3c3-78cb68cf9af5.png)

This is a generic evil holiday poster that will replace normal evil
posters in the evil poster objective, because I agree with #72003 that
it should be a feature.

## Why It's Good For The Game

Contraband file is just posters already, this is easier for people to
find the posters.
I like holiday posters and think that we should have them and add more,
it is a fun easy thing to add to a lot of the microholidays to make them
more visible in addition to the name generation, but I don't want to see
the unfinished holiday poster so I do think that it's better to only
have them spawn if the holiday actually has a poster. Looking forward to
febuary!

## Changelog

🆑
add: during holidays the spread syndicate propaganda through posters
objective has a chance of spawning evil holiday poster
fix: framework for holiday posters is more functional and modular
code: contraband.dm file and contraband.dmi file are both now poster.dm
and poster.dmi
/🆑
2022-12-24 15:44:49 -08:00

102 lines
3.5 KiB
Plaintext

/*
This type poster is of 3 parts: picture, foreground, background
background - Poster paper printed on
foreground - Text on top of poster
picture - The image on the poster: Typically a missing person or wanted individual.
*/
/obj/item/poster/wanted
icon_state = "rolled_poster_legit"
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
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, headerText, posterHeaderColor)
if(posterHeaderColor)
postHeaderColor = posterHeaderColor
var/obj/structure/sign/poster/wanted/wanted_poster = new (src, person_icon, wanted_name, description, headerText, postHeaderColor, background, postName, postDesc)
. = ..(mapload, wanted_poster)
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
var/icon/original_icon //cache the passed icon incase we ever get torn down and need to regenerate it.
poster_item_type = /obj/item/poster/wanted
/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.
original_icon = icon(person_icon) //cache this incase it gets torn down
var/icon/the_icon = icon("icon" = 'icons/obj/poster_wanted.dmi', "icon_state" = background)
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)
// 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/poster.dmi', "poster_being_set"), "poster_being_set")
the_icon.Insert(icon('icons/obj/poster.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/misc/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(atom/location)
pixel_x = 0
pixel_y = 0
var/obj/item/poster/rolled_poster = new poster_item_type(location, original_icon, wanted_name, desc, posterHeaderText, posterHeaderColor)
forceMove(rolled_poster)
return rolled_poster