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
+7 -7
View File
@@ -30,7 +30,7 @@
if(!IsValidBiomassLoc(T))
continue
var/obj/effect/biomass/starting = new /obj/effect/biomass(T)
starting.dir = get_dir(src,starting)
starting.set_dir(get_dir(src,starting))
starting.originalRift = src
linkedBiomass += starting
spawn(1) //DEBUG
@@ -53,13 +53,13 @@
return
switch(dir)
if(NORTHWEST)
dir = NORTH
set_dir(NORTH)
if(NORTHEAST)
dir = EAST
set_dir(EAST)
if(SOUTHWEST)
dir = WEST
set_dir(WEST)
if(SOUTHEAST)
dir = SOUTH
set_dir(SOUTH)
sleep(spreadDelay)
Spread()
@@ -93,7 +93,7 @@
var/obj/effect/biomass/newBiomass = new /obj/effect/biomass(get_step(src,direction))
newBiomass.curDistance = curDistance + 1
newBiomass.maxDistance = maxDistance
newBiomass.dir = direction
newBiomass.set_dir(direction)
newBiomass.originalRift = originalRift
newBiomass.icon_state = "[originalRift.newicon]" //DEBUG
originalRift.linkedBiomass += newBiomass
@@ -110,7 +110,7 @@
if(!IsValidBiomassLoc(T,src))
continue
var/obj/effect/biomass/starting = new /obj/effect/biomass(T)
starting.dir = get_dir(src,starting)
starting.set_dir(get_dir(src,starting))
starting.maxDistance = maxDistance
/proc/IsValidBiomassLoc(turf/location,obj/effect/biomass/source = null)
+1 -1
View File
@@ -192,7 +192,7 @@
chemholder.reagents.copy_to(smoke, chemholder.reagents.total_volume / dist, safety = 1) //copy reagents to the smoke so mob/breathe() can handle inhaling the reagents
smoke.icon = I
smoke.layer = 6
smoke.dir = pick(cardinal)
smoke.set_dir(pick(cardinal))
smoke.pixel_x = -32 + rand(-8,8)
smoke.pixel_y = -32 + rand(-8,8)
walk_to(smoke, T)
@@ -40,7 +40,7 @@ obj/effect/decal/cleanable/liquid_fuel
icon_state = "mustard"
anchored = 0
New(newLoc, amt = 1, d = 0)
dir = d //Setting this direction means you won't get torched by your own flamethrower.
set_dir(d) //Setting this direction means you won't get torched by your own flamethrower.
. = ..()
Spread()
+2 -2
View File
@@ -402,7 +402,7 @@ steam.start() -- spawns the effect
if(istype(T, /turf/space))
var/obj/effect/effect/ion_trails/I = new /obj/effect/effect/ion_trails(src.oldposition)
src.oldposition = T
I.dir = src.holder.dir
I.set_dir(src.holder.dir)
flick("ion_fade", I)
I.icon_state = "blank"
spawn( 20 )
@@ -449,7 +449,7 @@ steam.start() -- spawns the effect
var/obj/effect/effect/steam/I = new /obj/effect/effect/steam(src.oldposition)
src.number++
src.oldposition = get_turf(holder)
I.dir = src.holder.dir
I.set_dir(src.holder.dir)
spawn(10)
I.delete()
src.number--
+1 -1
View File
@@ -28,7 +28,7 @@
..()
dir = CalcDir()
set_dir(CalcDir())
if(!floor)
switch(dir) //offset to make it be on the wall rather than on the floor
+1 -1
View File
@@ -71,7 +71,7 @@
var/predir = AM.dir
step(AM, direction)
if(!facedir)
AM.dir = predir
AM.set_dir(predir)
@@ -95,7 +95,7 @@
icon = new_icon
icon_state = new_iconstate
overlays = new_overlays
dir = O.dir
set_dir(O.dir)
M.loc = src
master = C
master.active_dummy = src
@@ -29,7 +29,7 @@
switch(tile_dir_mode)
if(1) // All directions accepted
F.dir = D
F.set_dir(D)
F.icon_state = mode
if(2) // Corner mode - diagonal directions converted CW around.
switch(D)
@@ -41,7 +41,7 @@
D = WEST
if(NORTHWEST)
D = NORTH
F.dir = D
F.set_dir(D)
F.icon_state = mode
if(3) // cardinal directions only. I've adjusted diagonals the same way the facing code does.
switch(D)
@@ -53,7 +53,7 @@
D = WEST
if(NORTHWEST)
D = WEST
F.dir = D
F.set_dir(D)
F.icon_state = mode
if(4) // floors.dmi icon_states "warningcorner" and "warnwhitecorner" are incorrect, this fixes it
var/D2
@@ -66,16 +66,16 @@
D2 = NORTH
if(NORTHWEST)
D2 = EAST
F.dir = D2
F.set_dir(D2)
F.icon_state = mode
if(5)
F.dir = 0
F.set_dir(0)
if(D == NORTH || D == SOUTH || D == NORTHEAST || D == SOUTHWEST)
F.icon_state = mode
else
F.icon_state = "[mode]_inv"
else
F.dir = 0
F.set_dir(0)
F.icon_state = mode
else
usr << "You can't paint that!"
+1 -1
View File
@@ -116,7 +116,7 @@
if(Proj.damage >= 20 || istype(Proj, /obj/item/projectile/beam/practice))
bmark.icon_state = "scorch"
bmark.dir = pick(NORTH,SOUTH,EAST,WEST) // random scorch design
bmark.set_dir(pick(NORTH,SOUTH,EAST,WEST)) // random scorch design
else
+1 -1
View File
@@ -131,7 +131,7 @@
if (src.amount < R.req_amount*multiplier)
return
var/atom/O = new R.result_type( usr.loc )
O.dir = usr.dir
O.set_dir(usr.dir)
if (R.max_res_amount>1)
var/obj/item/stack/new_item = O
new_item.amount = R.res_amount*multiplier
@@ -35,7 +35,7 @@
spawn(det_time)
prime()
return
user.dir = get_dir(user, target)
user.set_dir(get_dir(user, target))
user.drop_item()
var/t = (isturf(target) ? target : target.loc)
walk_towards(src, t, 3)
+1 -1
View File
@@ -169,7 +169,7 @@
if((wielded) && prob(50))
spawn(0)
for(var/i in list(1,2,4,8,4,2,1,2,4,8,4,2))
user.dir = i
user.set_dir(i)
sleep(1)
/obj/item/weapon/twohanded/dualsaber/IsShield()
@@ -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