Poster Rework Part 3

This commit is contained in:
SamCroswell
2015-04-04 23:04:45 -04:00
parent 0406cb1796
commit 57703695ed
2 changed files with 49 additions and 3 deletions
+18
View File
@@ -4,6 +4,24 @@
* A large number of misc global procs.
*/
/* Get the direction of startObj relative to endObj.
* Return values: To the right, 1. Below, 2. To the left, 3. Above, 4. Not found adjacent in cardinal directions, 0.
*/
/proc/getRelativeDirection(var/atom/movable/startObj, var/atom/movable/endObj)
if(endObj.x == startObj.x + 1 && endObj.y == startObj.y)
return EAST
if(endObj.x == startObj.x - 1 && endObj.y == startObj.y)
return WEST
if(endObj.y == startObj.y + 1 && endObj.x == startObj.x)
return NORTH
if(endObj.y == startObj.y - 1 && endObj.x == startObj.x)
return SOUTH
return 0
//Inverts the colour of an HTML string
/proc/invertHTML(HTMLstring)
+31 -3
View File
@@ -80,8 +80,13 @@ obj/structure/sign/poster
var/ruined = 0
var/subtype = 0
obj/structure/sign/poster/New(serial,subtype)
obj/structure/sign/poster/legit // For mappers looking to pre-spawn NT approved posters.
subtype = 1
obj/structure/sign/poster/New(serial,var/subtypeIn = -1)
serial_number = serial
if(subtypeIn != -1)
subtype = subtypeIn
if(serial_number == loc)
if(subtype == 0)
@@ -332,7 +337,11 @@ obj/structure/sign/poster/attackby(obj/item/I, mob/user, params)
return
/obj/structure/sign/poster/proc/roll_and_drop(turf/location)
var/obj/item/weapon/contraband/poster/P = new(src, serial_number)
var/obj/item/weapon/contraband/poster/P
if(subtype == 1)
P = new/obj/item/weapon/contraband/poster/legit/(src, serial_number)
else
P = new(src, serial_number)
P.resulting_poster = src
P.loc = location
loc = P
@@ -358,8 +367,27 @@ obj/structure/sign/poster/attackby(obj/item/I, mob/user, params)
var/obj/structure/sign/poster/D = P.resulting_poster
var/temp_loc = user.loc
switch(getRelativeDirection(user, src))
if(NORTH)
D.pixel_x = 0
D.pixel_y = 32
if(EAST)
D.pixel_x = 32
D.pixel_y = 0
if(SOUTH)
D.pixel_x = 0
D.pixel_y = -32
if(WEST)
D.pixel_x = -32
D.pixel_y = 0
else
user << "<span class='notice'>You cannot reach the wall from here!</span>"
return
flick("poster_being_set",D)
D.loc = src
D.loc = temp_loc
qdel(P) //delete it now to cut down on sanity checks afterwards. Agouri's code supports rerolling it anyway
playsound(D.loc, 'sound/items/poster_being_created.ogg', 100, 1)