Poster fixes

Fixes #7261
Fixes placed posters being visible on both sides of the wall.
Fixes the poster_type var used to specify certain poster designs on the
map not working correctly, and makes the nuke op shuttle poster an
actual poster.
Poster placement now belongs to the poster object instead of turf/simulated/
Posters can now be placed on unsimulated and shuttle walls.
This commit is contained in:
mwerezak
2014-12-07 22:14:49 -05:00
parent 1245bb6291
commit f9564cbe5e
5 changed files with 103 additions and 20 deletions

View File

@@ -26,7 +26,7 @@ var/global/list/language_keys[0] //table of say codes for all languages
var/global/list/whitelisted_species = list("Human") var/global/list/whitelisted_species = list("Human")
// Posters // Posters
var/global/list/datum/poster/poster_designs = typesof(/datum/poster) - /datum/poster var/global/list/poster_designs = list()
// Uplinks // Uplinks
var/list/obj/item/device/uplink/world_uplinks = list() var/list/obj/item/device/uplink/world_uplinks = list()
@@ -121,6 +121,12 @@ var/global/list/backbaglist = list("Nothing", "Backpack", "Satchel", "Satchel Al
if(S.flags & IS_WHITELISTED) if(S.flags & IS_WHITELISTED)
whitelisted_species += S.name whitelisted_species += S.name
//Posters
paths = typesof(/datum/poster) - /datum/poster
for(var/T in paths)
var/datum/poster/P = new T
poster_designs += P
return 1 return 1
/* // Uncomment to debug chemical reaction list. /* // Uncomment to debug chemical reaction list.

View File

@@ -5,3 +5,6 @@
while(mloc && mloc.loc && !istype(mloc.loc, /turf/)) while(mloc && mloc.loc && !istype(mloc.loc, /turf/))
mloc = mloc.loc mloc = mloc.loc
return mloc return mloc
/proc/iswall(turf/T)
return (istype(T, /turf/simulated/wall) || istype(T, /turf/unsimulated/wall) || istype(T, /turf/simulated/shuttle/wall))

View File

@@ -23,9 +23,63 @@
name += " - No. [serial_number]" name += " - No. [serial_number]"
..(loc) ..(loc)
//Places the poster on a wall
/obj/item/weapon/contraband/poster/afterattack(var/atom/A, var/mob/user, var/adjacent, var/clickparams)
if (!adjacent)
return
//must place on a wall and user must not be inside a closet/mecha/whatever
var/turf/W = A
if (!iswall(W) || !isturf(user.loc))
user << "\red You can't place this here!"
return
var/placement_dir = get_dir(user, W)
if (!(placement_dir in cardinal))
user << "<span class='warning'>You must stand directly in front of the wall you wish to place that on.</span>"
return
//just check if there is a poster on or adjacent to the wall
var/stuff_on_wall = 0
if (locate(/obj/structure/sign/poster) in W)
stuff_on_wall = 1
//crude, but will cover most cases. We could do stuff like check pixel_x/y but it's not really worth it.
for (var/dir in cardinal)
var/turf/T = get_step(W, dir)
if (locate(/obj/structure/sign/poster) in T)
stuff_on_wall = 1
break
if (stuff_on_wall)
user << "<span class='notice'>There is already a poster there!</span>"
return
user << "<span class='notice'>You start placing the poster on the wall...</span>" //Looks like it's uncluttered enough. Place the poster.
var/obj/structure/sign/poster/P = new(user.loc, placement_dir=get_dir(user, W), serial=serial_number)
flick("poster_being_set", P)
//playsound(W, 'sound/items/poster_being_created.ogg', 100, 1) //why the hell does placing a poster make printer sounds?
var/oldsrc = src //get a reference to src so we can delete it after detaching ourselves
src = null
spawn(17)
if(!P) return
if(iswall(W) && user && P.loc == user.loc) //Let's check if everything is still there
user << "<span class='notice'>You place the poster!</span>"
else
P.roll_and_drop(P.loc)
del(oldsrc) //delete it now to cut down on sanity checks afterwards. Agouri's code supports rerolling it anyway
//I'm
/obj/structure/sign/poster/proc/placement_check()
//############################## THE ACTUAL DECALS ########################### //############################## THE ACTUAL DECALS ###########################
obj/structure/sign/poster /obj/structure/sign/poster
name = "poster" name = "poster"
desc = "A large piece of space-resistant printed paper. " desc = "A large piece of space-resistant printed paper. "
icon = 'icons/obj/contraband.dmi' icon = 'icons/obj/contraband.dmi'
@@ -34,22 +88,42 @@ obj/structure/sign/poster
var/poster_type //So mappers can specify a desired poster var/poster_type //So mappers can specify a desired poster
var/ruined = 0 var/ruined = 0
obj/structure/sign/poster/New(var/serial) /obj/structure/sign/poster/New(var/newloc, var/placement_dir=null, var/serial=null)
var/designtype ..(newloc)
if(!serial)
serial = rand(1, poster_designs.len) //use a random serial if none is given
serial_number = serial
var/datum/poster/design = poster_designs[serial_number]
set_poster(design)
switch (placement_dir)
if (NORTH)
pixel_x = 0
pixel_y = 32
if (SOUTH)
pixel_x = 0
pixel_y = -32
if (EAST)
pixel_x = 32
pixel_y = 0
if (WEST)
pixel_x = -32
pixel_y = 0
/obj/structure/sign/poster/initialize()
if (poster_type) if (poster_type)
designtype = text2path(poster_type) var/path = text2path(poster_type)
else var/datum/poster/design = new path
if(serial_number == loc) set_poster(design)
serial_number = rand(1, poster_designs.len) //This is for the mappers that want individual posters without having to use rolled posters.
designtype = poster_designs[serial_number]
var/datum/poster/design=new designtype() /obj/structure/sign/poster/proc/set_poster(var/datum/poster/design)
name += " - [design.name]" name = "[initial(name)] - [design.name]"
desc += " [design.desc]" desc = "[initial(desc)] [design.desc]"
icon_state = design.icon_state // poster[serial_number] icon_state = design.icon_state // poster[serial_number]
..()
obj/structure/sign/poster/attackby(obj/item/weapon/W as obj, mob/user as mob) /obj/structure/sign/poster/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/wirecutters)) if(istype(W, /obj/item/weapon/wirecutters))
playsound(loc, 'sound/items/Wirecutter.ogg', 100, 1) playsound(loc, 'sound/items/Wirecutter.ogg', 100, 1)
if(ruined) if(ruined)

View File

@@ -758,7 +758,7 @@
"oD" = (/obj/effect/landmark{name = "Syndicate-Uplink"},/turf/unsimulated/floor{icon_state = "dark"},/area/syndicate_mothership) "oD" = (/obj/effect/landmark{name = "Syndicate-Uplink"},/turf/unsimulated/floor{icon_state = "dark"},/area/syndicate_mothership)
"oE" = (/obj/structure/rack,/obj/item/weapon/tank/emergency_oxygen/double,/obj/item/weapon/tank/emergency_oxygen/double,/obj/item/weapon/tank/emergency_oxygen/double,/obj/item/weapon/tank/emergency_oxygen/double,/obj/item/weapon/tank/emergency_oxygen/double,/obj/item/weapon/tank/emergency_oxygen/double,/turf/unsimulated/floor{icon_state = "dark"},/area/syndicate_mothership) "oE" = (/obj/structure/rack,/obj/item/weapon/tank/emergency_oxygen/double,/obj/item/weapon/tank/emergency_oxygen/double,/obj/item/weapon/tank/emergency_oxygen/double,/obj/item/weapon/tank/emergency_oxygen/double,/obj/item/weapon/tank/emergency_oxygen/double,/obj/item/weapon/tank/emergency_oxygen/double,/turf/unsimulated/floor{icon_state = "dark"},/area/syndicate_mothership)
"oF" = (/obj/structure/lattice,/obj/structure/grille,/obj/structure/lattice,/turf/space,/area/space) "oF" = (/obj/structure/lattice,/obj/structure/grille,/obj/structure/lattice,/turf/space,/area/space)
"oG" = (/obj/structure/sign{desc = "This is a pinup poster."; icon = 'icons/obj/contraband.dmi'; icon_state = "bsposter50"; name = "pinup poster"; pixel_x = -32},/turf/simulated/shuttle/floor{icon_state = "floor6"},/area/syndicate_station/start) "oG" = (/obj/structure/sign/poster{poster_type = "/datum/poster/bay_50"; pixel_x = -32},/turf/simulated/shuttle/floor{icon_state = "floor6"},/area/syndicate_station/start)
"oH" = (/obj/item/device/radio/intercom{desc = "Talk through this. Evilly"; freerange = 1; frequency = 1213; name = "Syndicate Intercom"; pixel_x = 0; pixel_y = -32; subspace_transmission = 1; syndie = 1},/turf/simulated/shuttle/floor{icon_state = "floor6"},/area/syndicate_station/start) "oH" = (/obj/item/device/radio/intercom{desc = "Talk through this. Evilly"; freerange = 1; frequency = 1213; name = "Syndicate Intercom"; pixel_x = 0; pixel_y = -32; subspace_transmission = 1; syndie = 1},/turf/simulated/shuttle/floor{icon_state = "floor6"},/area/syndicate_station/start)
"oI" = (/obj/structure/window/reinforced{dir = 1},/obj/structure/lattice,/turf/space,/area/space) "oI" = (/obj/structure/window/reinforced{dir = 1},/obj/structure/lattice,/turf/space,/area/space)
"oJ" = (/obj/structure/closet/walllocker/emerglocker{pixel_x = 28},/turf/simulated/shuttle/floor{icon_state = "floor6"},/area/syndicate_station/start) "oJ" = (/obj/structure/closet/walllocker/emerglocker{pixel_x = 28},/turf/simulated/shuttle/floor{icon_state = "floor6"},/area/syndicate_station/start)