Turns movable chairs on click

This commit is contained in:
Hubblenaut
2014-07-02 22:33:33 +02:00
committed by ZomgPonies
parent 6e9f55f262
commit 8a0e43ae1e
+10 -5
View File
@@ -358,14 +358,19 @@
G.next_shock = world.time + time
// Simple helper to face what you clicked on, in case it should be needed in more than one place
/mob/proc/face_atom(var/atom/A)
if( stat || buckled || !A || !x || !y || !A.x || !A.y ) return
if( stat || (buckled && !buckled.movable) || !A || !x || !y || !A.x || !A.y ) return
var/dx = A.x - x
var/dy = A.y - y
if(!dx && !dy) return
var/direction
if(abs(dx) < abs(dy))
if(dy > 0) usr.dir = NORTH
else usr.dir = SOUTH
if(dy > 0) direction = NORTH
else direction = SOUTH
else
if(dx > 0) usr.dir = EAST
else usr.dir = WEST
if(dx > 0) direction = EAST
else direction = WEST
usr.dir = direction
if(buckled && buckled.movable)
buckled.dir = direction
buckled.handle_rotation()