Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poster Refactor + TCAF GPS Tags #20278

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aurorastation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,7 @@
#include "code\game\objects\effects\decals\Cleanable\robots.dm"
#include "code\game\objects\effects\decals\Cleanable\tracks.dm"
#include "code\game\objects\effects\decals\posters\bs12.dm"
#include "code\game\objects\effects\decals\posters\poster_subtypes.dm"
#include "code\game\objects\effects\decals\posters\tgposters.dm"
#include "code\game\objects\effects\projectile\projectile_effects.dm"
#include "code\game\objects\effects\projectile\projectile_impact.dm"
Expand Down
11 changes: 1 addition & 10 deletions code/__HELPERS/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ GLOBAL_LIST_INIT(whitelisted_species, list(SPECIES_HUMAN))
/// A list of ALL playable species, whitelisted, latejoin or otherwise.
GLOBAL_LIST_EMPTY(playable_species)

/// Poster designs (/datum/poster).
GLOBAL_LIST_EMPTY(poster_designs)
Ben10083 marked this conversation as resolved.
Show resolved Hide resolved

/// All uplinks.
GLOBAL_LIST_EMPTY_TYPED(world_uplinks, /obj/item/device/uplink)

Expand Down Expand Up @@ -243,13 +240,7 @@ GLOBAL_LIST_EMPTY(outfit_cache)
if(S.spawn_flags & IS_WHITELISTED)
GLOB.whitelisted_species += S.name

//Posters
paths = subtypesof(/datum/poster)
for(var/T in paths)
var/datum/poster/P = new T
GLOB.poster_designs += P

return 1
return TRUE

GLOBAL_LIST_INIT(correct_punctuation, list("!" = TRUE, "." = TRUE, "?" = TRUE, "-" = TRUE, "~" = TRUE, \
"*" = TRUE, "/" = TRUE, ">" = TRUE, "\"" = TRUE, "'" = TRUE, \
Expand Down
63 changes: 35 additions & 28 deletions code/game/objects/effects/decals/contraband.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,23 @@
icon_state = "rolled_poster"
drop_sound = 'sound/items/drop/wrapper.ogg'
pickup_sound = 'sound/items/pickup/wrapper.ogg'
var/serial_number = 0


/obj/item/contraband/poster/Initialize(mapload, given_serial = 0)
/// Set this variable to a /singleton/poster_design specify a desired poster.
/// If unset, is randomly set on `Initialize()`
var/singleton/poster_design/poster_type
/// If `poster_type` is unset, this is used to select a new design through stricter categories
/// See `poster_subtypes.dm` for implementations
var/random_type = /singleton/poster_design

/obj/item/contraband/poster/Initialize(mapload, given_type)
. = ..()
if(given_serial == 0)
serial_number = rand(1, GLOB.poster_designs.len)
if(!poster_type)
if(!given_type)
poster_type = pick(GET_SINGLETON_SUBTYPE_LIST(random_type))
else
poster_type = given_type
Ben10083 marked this conversation as resolved.
Show resolved Hide resolved
else
serial_number = given_serial
name += " - No. [serial_number]"
poster_type = GET_SINGLETON(poster_type)
name += " - [poster_type.name]"

//Places the poster on a wall
/obj/item/contraband/poster/afterattack(var/atom/A, var/mob/user, var/adjacent, var/clickparams)
Expand Down Expand Up @@ -59,7 +66,7 @@

to_chat(user, SPAN_NOTICE("You start placing the poster on the wall...")) //Looks like it's uncluttered enough. Place the poster.)

var/obj/structure/sign/poster/P = new(user.loc, get_dir(user, W), serial_number)
var/obj/structure/sign/poster/P = new(user.loc, get_dir(user, W), poster_type)

flick("poster_being_set", P)
playsound(W, 'sound/items/package_wrap.ogg', 100, 1)
Expand All @@ -85,26 +92,25 @@
icon = 'icons/obj/contraband.dmi'
icon_state = "poster_map"
anchored = 1
var/serial_number //Will hold the value of src.loc if nobody initialises it
var/poster_type //So mappers can specify a desired poster
/// Set this variable to a /singleton/poster_design to specify a desired poster.
/// If unset, is randomly set on `Initialize()`
var/singleton/poster_design/poster_type
/// If `poster_type` is unset, this is used to select a new design through stricter categories
/// See `poster_subtypes.dm` for implementations
var/random_type = /singleton/poster_design
var/ruined = FALSE

/obj/structure/sign/poster/Initialize(mapload, placement_dir = null, serial = null)
/obj/structure/sign/poster/Initialize(mapload, placement_dir = null, type = null)
. = ..()

if(!serial)
serial = rand(1, GLOB.poster_designs.len) //use a random serial if none is given

serial_number = serial

var/datum/poster/design
if (poster_type)
var/path = text2path(poster_type)
design = new path
poster_type = GET_SINGLETON(poster_type)
else if(type)
poster_type = type
else
design = GLOB.poster_designs[serial_number]
poster_type = pick(GET_SINGLETON_SUBTYPE_LIST(random_type))

set_poster(design)
set_poster(poster_type)

switch (placement_dir)
if (NORTH)
Expand All @@ -121,10 +127,10 @@
pixel_y = 0


/obj/structure/sign/poster/proc/set_poster(var/datum/poster/design)
/obj/structure/sign/poster/proc/set_poster(var/singleton/poster_design/design)
name = "[initial(name)] - [design.name]"
desc = "[initial(desc)] [design.desc]"
icon_state = design.icon_state // poster[serial_number]
icon_state = design.icon_state

/obj/structure/sign/poster/attackby(obj/item/attacking_item, mob/user)
if(attacking_item.iswirecutter())
Expand Down Expand Up @@ -156,14 +162,15 @@
add_fingerprint(user)

/obj/structure/sign/poster/proc/roll_and_drop(turf/newloc)
var/obj/item/contraband/poster/P = new(src, serial_number)
var/obj/item/contraband/poster/P = new(src, poster_type)
P.forceMove(newloc)
src.forceMove(P)
qdel(src)

/datum/poster
// Name suffix. Poster - [name]
/singleton/poster_design
/// Name suffix. Poster - [name]
var/name = ""
// Description suffix
/// Description suffix
var/desc = ""
/// The actual design
var/icon_state = ""
Loading
Loading