refactor 'dir = ' into 'set_dir()'

This should have little/no gameplay effect right now, just paving the
 way for directional lights.
Replaced handle_rotation() on buckly things with this.

Signed-off-by: Mloc-Argent <colmohici@gmail.com>
This commit is contained in:
Mloc-Argent
2014-12-01 13:44:02 +00:00
committed by Mloc
parent a1a66870ca
commit 117ca6a135
143 changed files with 480 additions and 480 deletions
@@ -15,7 +15,7 @@
if(istype(W, /obj/item/weapon/wrench))
var/obj/structure/stool/bed/chair/C = new /obj/structure/stool/bed/chair(loc)
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
C.dir = dir
C.set_dir(dir)
part.loc = loc
part.master = null
part = null
+14 -11
View File
@@ -170,14 +170,14 @@
/obj/structure/stool/bed/chair/janicart/New()
handle_rotation()
create_reagents(100)
update_layer()
/obj/structure/stool/bed/chair/janicart/examine(mob/user)
if(!..(user, 1))
return
user << "\icon[src] This [callme] contains [reagents.total_volume] unit\s of water!"
if(mybag)
user << "\A [mybag] is hanging on the [callme]."
@@ -215,7 +215,6 @@
if(istype(user.l_hand, /obj/item/key) || istype(user.r_hand, /obj/item/key))
step(src, direction)
update_mob()
handle_rotation()
else
user << "<span class='notice'>You'll need the keys in one of your hands to drive this [callme].</span>"
@@ -238,13 +237,20 @@
"<span class='notice'>You climb onto the [callme]!</span>")
M.buckled = src
M.loc = loc
M.dir = dir
M.set_dir(dir)
M.update_canmove()
buckled_mob = M
update_mob()
add_fingerprint(user)
/obj/structure/stool/bed/chair/janicart/update_layer()
if(dir == SOUTH)
layer = FLY_LAYER
else
layer = OBJ_LAYER
/obj/structure/stool/bed/chair/janicart/unbuckle()
if(buckled_mob)
buckled_mob.pixel_x = 0
@@ -252,12 +258,9 @@
..()
/obj/structure/stool/bed/chair/janicart/handle_rotation()
if(dir == SOUTH)
layer = FLY_LAYER
else
layer = OBJ_LAYER
/obj/structure/stool/bed/chair/janicart/set_dir()
..()
update_layer()
if(buckled_mob)
if(buckled_mob.loc != loc)
buckled_mob.buckled = null //Temporary, so Move() succeeds.
@@ -268,7 +271,7 @@
/obj/structure/stool/bed/chair/janicart/proc/update_mob()
if(buckled_mob)
buckled_mob.dir = dir
buckled_mob.set_dir(dir)
switch(dir)
if(SOUTH)
buckled_mob.pixel_x = 0
+1 -1
View File
@@ -77,7 +77,7 @@
for(var/atom/movable/A as mob|obj in src)
A.loc = src.connected.loc
src.connected.icon_state = "morguet"
src.connected.dir = src.dir
src.connected.set_dir(src.dir)
else
//src.connected = null
del(src.connected)
@@ -56,7 +56,7 @@
"<span class='notice'>You hear squelching...</span>")
M.buckled = src
M.loc = src.loc
M.dir = src.dir
M.set_dir(src.dir)
M.update_canmove()
M.pixel_y = 6
M.old_y = 6
@@ -33,9 +33,6 @@
manual_unbuckle(user)
return
/obj/structure/stool/bed/proc/handle_rotation()
return
/obj/structure/stool/bed/MouseDrop(atom/over_object)
return
@@ -104,7 +101,7 @@
"You hear metal clanking")
M.buckled = src
M.loc = src.loc
M.dir = src.dir
M.set_dir(src.dir)
M.update_canmove()
src.buckled_mob = M
src.add_fingerprint(user)
@@ -11,7 +11,7 @@
/obj/structure/stool/bed/chair/New()
..()
spawn(3) //sorry. i don't think there's a better way to do this.
handle_rotation()
update_layer()
return
/obj/structure/stool/bed/chair/attackby(obj/item/weapon/W as obj, mob/user as mob)
@@ -24,7 +24,7 @@
user.drop_item()
var/obj/structure/stool/bed/chair/e_chair/E = new /obj/structure/stool/bed/chair/e_chair(src.loc)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
E.dir = dir
E.set_dir(dir)
E.part = SK
SK.loc = E
SK.master = E
@@ -37,13 +37,17 @@
rotate()
return
/obj/structure/stool/bed/chair/handle_rotation() //making this into a seperate proc so office chairs can call it on Move()
/obj/structure/stool/bed/chair/proc/update_layer()
if(src.dir == NORTH)
src.layer = FLY_LAYER
else
src.layer = OBJ_LAYER
/obj/structure/stool/bed/chair/set_dir()
..()
update_layer()
if(buckled_mob)
buckled_mob.dir = dir
buckled_mob.set_dir(dir)
/obj/structure/stool/bed/chair/verb/rotate()
set name = "Rotate Chair"
@@ -51,8 +55,7 @@
set src in oview(1)
if(config.ghost_interaction)
src.dir = turn(src.dir, 90)
handle_rotation()
src.set_dir(turn(src.dir, 90))
return
else
if(istype(usr,/mob/living/simple_animal/mouse))
@@ -62,8 +65,7 @@
if(usr.stat || usr.restrained())
return
src.dir = turn(src.dir, 90)
handle_rotation()
src.set_dir(turn(src.dir, 90))
return
/obj/structure/stool/bed/chair/MouseDrop_T(mob/M as mob, mob/user as mob)
@@ -142,7 +144,6 @@
Bump(O)
else
unbuckle()
handle_rotation()
/obj/structure/stool/bed/chair/office/Bump(atom/A)
..()
@@ -10,12 +10,13 @@
var/bloodiness
/obj/structure/stool/bed/chair/wheelchair/handle_rotation()
/obj/structure/stool/bed/chair/wheelchair/set_dir()
..()
overlays = null
var/image/O = image(icon = 'icons/obj/objects.dmi', icon_state = "w_overlay", layer = FLY_LAYER, dir = src.dir)
overlays += O
if(buckled_mob)
buckled_mob.dir = dir
buckled_mob.set_dir(dir)
/obj/structure/stool/bed/chair/wheelchair/relaymove(mob/user, direction)
// Redundant check?
@@ -64,8 +65,7 @@
step(src, direction)
if(buckled_mob) // Make sure it stays beneath the occupant
Move(buckled_mob.loc)
dir = direction
handle_rotation()
set_dir(direction)
if(pulling) // Driver
if(pulling.loc == src.loc) // We moved onto the wheelchair? Revert!
pulling.loc = T
@@ -74,7 +74,7 @@
if(get_dist(src, pulling) > 1) // We are too far away? Losing control.
pulling = null
user.pulledby = null
pulling.dir = get_dir(pulling, src) // When everything is right, face the wheelchair
pulling.set_dir(get_dir(pulling, src)) // When everything is right, face the wheelchair
if(bloodiness)
create_track()
driving = 0
@@ -101,7 +101,6 @@
else
if (occupant && (src.loc != occupant.loc))
src.loc = occupant.loc // Failsafe to make sure the wheelchair stays beneath the occupant after driving
handle_rotation()
/obj/structure/stool/bed/chair/wheelchair/attack_hand(mob/user as mob)
if (pulling)
@@ -122,7 +121,7 @@
usr.pulledby = src
if(usr.pulling)
usr.stop_pulling()
usr.dir = get_dir(usr, src)
usr.set_dir(get_dir(usr, src))
usr << "You grip \the [name]'s handles."
else
if(usr != pulling)
@@ -176,14 +175,14 @@
var/obj/effect/decal/cleanable/blood/tracks/B = new(loc)
var/newdir = get_dir(get_step(loc, dir), loc)
if(newdir == dir)
B.dir = newdir
B.set_dir(newdir)
else
newdir = newdir | dir
if(newdir == 3)
newdir = 1
else if(newdir == 12)
newdir = 4
B.dir = newdir
B.set_dir(newdir)
bloodiness--
/obj/structure/stool/bed/chair/wheelchair/buckle_mob(mob/M as mob, mob/user as mob)
+3 -3
View File
@@ -250,9 +250,9 @@
if(6)
icon_state = "tabledir3"
if (dir_sum in list(1,2,4,8,5,6,9,10))
dir = dir_sum
set_dir(dir_sum)
else
dir = 2
set_dir(2)
/obj/structure/table/attack_tk() // no telehulk sorry
return
@@ -445,7 +445,7 @@
spawn(0)
A.throw_at(pick(targets),1,1)
dir = direction
set_dir(direction)
if(dir != NORTH)
layer = 5
climbable = 0 //flipping tables allows them to be used as makeshift barriers
@@ -170,7 +170,7 @@ obj/structure/ex_act(severity)
nexttube = tube
break
if(!nexttube)
pod.dir = turn(pod.dir, 180)
pod.set_dir(turn(pod.dir, 180))
if(icon_state == "closed" && pod)
pod.follow_tube()
@@ -320,13 +320,13 @@ obj/structure/ex_act(severity)
break
if(current_tube == null)
dir = next_dir
set_dir(next_dir)
Move(get_step(loc, dir)) // Allow collisions when leaving the tubes.
break
last_delay = current_tube.enter_delay(src, next_dir)
sleep(last_delay)
dir = next_dir
set_dir(next_dir)
loc = next_loc // When moving from one tube to another, skip collision and such.
density = current_tube.density
@@ -429,14 +429,14 @@ obj/structure/ex_act(severity)
station.open_animation()
else if(direction in station.directions())
dir = direction
set_dir(direction)
station.launch_pod()
return
for(var/obj/structure/transit_tube/tube in loc)
if(dir in tube.directions())
if(tube.has_exit(direction))
dir = direction
set_dir(direction)
return
@@ -32,9 +32,9 @@ obj/structure/windoor_assembly/New(Loc, start_dir=NORTH, constructed=0)
anchored = 0
switch(start_dir)
if(NORTH, SOUTH, EAST, WEST)
dir = start_dir
set_dir(start_dir)
else //If the user is facing northeast. northwest, southeast, southwest or north, default to north
dir = NORTH
set_dir(NORTH)
update_nearby_tiles(need_rebuild=1)
@@ -220,7 +220,7 @@ obj/structure/windoor_assembly/Del()
else
windoor.icon_state = "rightsecureopen"
windoor.base_state = "rightsecure"
windoor.dir = src.dir
windoor.set_dir(src.dir)
windoor.density = 0
if(src.electronics.one_access)
@@ -238,7 +238,7 @@ obj/structure/windoor_assembly/Del()
else
windoor.icon_state = "rightopen"
windoor.base_state = "right"
windoor.dir = src.dir
windoor.set_dir(src.dir)
windoor.density = 0
if(src.electronics.one_access)
@@ -272,7 +272,7 @@ obj/structure/windoor_assembly/Del()
if(src.state != "01")
update_nearby_tiles(need_rebuild=1) //Compel updates before
src.dir = turn(src.dir, 270)
src.set_dir(turn(src.dir, 270))
if(src.state != "01")
update_nearby_tiles(need_rebuild=1)
+4 -4
View File
@@ -246,7 +246,7 @@
return 0
update_nearby_tiles(need_rebuild=1) //Compel updates before
dir = turn(dir, 90)
set_dir(turn(dir, 90))
// updateSilicate()
update_nearby_tiles(need_rebuild=1)
return
@@ -262,7 +262,7 @@
return 0
update_nearby_tiles(need_rebuild=1) //Compel updates before
dir = turn(dir, 270)
set_dir(turn(dir, 270))
// updateSilicate()
update_nearby_tiles(need_rebuild=1)
return
@@ -292,7 +292,7 @@
anchored = 0
if (start_dir)
dir = start_dir
set_dir(start_dir)
health = maxhealth
@@ -313,7 +313,7 @@
var/ini_dir = dir
update_nearby_tiles(need_rebuild=1)
..()
dir = ini_dir
set_dir(ini_dir)
update_nearby_tiles(need_rebuild=1)
//checks if this window is full-tile one