Refactored directionals (#20082)

Refactored directionals, ported lists of directions from TG, got rid of
useless proc to get the reverse direction.
This commit is contained in:
Fluffy
2024-10-25 17:56:02 +00:00
committed by GitHub
parent e8107c3170
commit d9c44532fc
146 changed files with 377 additions and 281 deletions
+2 -2
View File
@@ -162,7 +162,7 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin
A.fire_act(air_contents.temperature, air_contents.volume)
//spread
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
var/turf/simulated/enemy_tile = get_step(my_tile, direction)
if(istype(enemy_tile))
@@ -202,7 +202,7 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin
qdel(src)
return
set_dir(pick(GLOB.cardinal))
set_dir(pick(GLOB.cardinals))
var/datum/gas_mixture/air_contents = loc.return_air()
color = fire_color(air_contents.temperature)
+2 -2
View File
@@ -93,7 +93,7 @@
var/connected_dirs
GET_ZONE_NEIGHBOURS(T, connected_dirs)
if(connected_dirs && (dir & GLOB.reverse_dir[connected_dirs]) == dir)
if(connected_dirs && (dir & REVERSE_DIR(connected_dirs)) == dir)
. &= ~dir //they are, so unflag the cardinals in question
//it is safe to remove src from the zone if all cardinals are connected by corner turfs
@@ -179,7 +179,7 @@
if(istype(unsim, /turf/simulated))
var/turf/simulated/sim = unsim
sim.open_directions |= GLOB.reverse_dir[d]
sim.open_directions |= REVERSE_DIR(d)
if(TURF_HAS_VALID_ZONE(sim))
//Might have assigned a zone, since this happens for each direction.
-8
View File
@@ -77,14 +77,6 @@ GLOBAL_LIST_EMPTY(tdomeobserve)
GLOBAL_LIST_EMPTY(tdomeadmin)
GLOBAL_LIST_EMPTY(ninjastart)
GLOBAL_LIST_INIT(cardinal, list(NORTH, SOUTH, EAST, WEST))
GLOBAL_LIST_INIT(cornerdirs, list(NORTHWEST, SOUTHEAST, NORTHEAST, SOUTHWEST))
GLOBAL_LIST_INIT(alldirs, list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST))
GLOBAL_LIST_INIT(reverse_dir, list( // reverse_dir[dir] = reverse of dir
2, 1, 3, 8, 10, 9, 11, 4, 6, 5, 7, 12, 14, 13, 15, 32, 34, 33, 35, 40, 42,
41, 43, 36, 38, 37, 39, 44, 46, 45, 47, 16, 18, 17, 19, 24, 26, 25, 27, 20, 22, 21,
23, 28, 30, 29, 31, 48, 50, 49, 51, 56, 58, 57, 59, 52, 54, 53, 55, 60, 62, 61, 63
))
GLOBAL_LIST_INIT(all_days, list("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"))
GLOBAL_LIST_EMPTY(combatlog)
+1 -1
View File
@@ -345,7 +345,7 @@ example:
CALCULATE_NEIGHBORS(src, result, T, isopenturf(T))
*/
#define CALCULATE_NEIGHBORS(ORIGIN, VAR, TVAR, FUNC) \
for (var/_tdir in GLOB.cardinal) { \
for (var/_tdir in GLOB.cardinals) { \
TVAR = get_step(ORIGIN, _tdir); \
if ((TVAR) && (FUNC)) { \
VAR |= 1 << _tdir; \
+3 -3
View File
@@ -209,13 +209,13 @@
return mixedcolor
/**
* Gets the highest and lowest pressures from the tiles in GLOB.cardinal directions
* Gets the highest and lowest pressures from the tiles in GLOB.cardinals directions
* around us, then checks the difference.
*/
/proc/getOPressureDifferential(var/turf/loc)
var/minp=16777216;
var/maxp=0;
for(var/dir in GLOB.cardinal)
for(var/dir in GLOB.cardinals)
var/turf/simulated/T=get_turf(get_step(loc,dir))
var/cp=0
if(T && istype(T) && T.zone)
@@ -236,7 +236,7 @@
/proc/getCardinalAirInfo(var/turf/loc, var/list/stats=list("temperature"))
var/list/temps = new/list(4)
for(var/dir in GLOB.cardinal)
for(var/dir in GLOB.cardinals)
var/direction
switch(dir)
if(NORTH)
+1 -1
View File
@@ -89,7 +89,7 @@
else
var/atom/movable/AM
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
AM = find_type_in_direction(src, direction)
if(AM == NULLTURF_BORDER)
if((smoothing_flags & SMOOTH_BORDER))
-19
View File
@@ -1031,25 +1031,6 @@ var/global/list/common_tools = list(
surgery_attempt = SURGERY_IGNORE //hit yourself if you're not lying
return surgery_attempt
/proc/reverse_direction(var/dir)
switch(dir)
if(NORTH)
return SOUTH
if(NORTHEAST)
return SOUTHWEST
if(EAST)
return WEST
if(SOUTHEAST)
return NORTHWEST
if(SOUTH)
return NORTH
if(SOUTHWEST)
return NORTHEAST
if(WEST)
return EAST
if(NORTHWEST)
return SOUTHEAST
/*
Checks if that loc and dir has a item on the wall
*/
+94
View File
@@ -0,0 +1,94 @@
GLOBAL_LIST_INIT(cardinals, list(
NORTH,
SOUTH,
EAST,
WEST,
))
GLOBAL_LIST_INIT(cardinals_multiz, list(
NORTH,
SOUTH,
EAST,
WEST,
UP,
DOWN,
))
GLOBAL_LIST_INIT(diagonals, list(
NORTHEAST,
NORTHWEST,
SOUTHEAST,
SOUTHWEST,
))
GLOBAL_LIST_INIT(corners_multiz, list(
UP|NORTHEAST,
UP|NORTHWEST,
UP|SOUTHEAST,
UP|SOUTHWEST,
DOWN|NORTHEAST,
DOWN|NORTHWEST,
DOWN|SOUTHEAST,
DOWN|SOUTHWEST,
))
GLOBAL_LIST_INIT(diagonals_multiz, list(
NORTHEAST,
NORTHWEST,
SOUTHEAST,
SOUTHWEST,
UP|NORTH,
UP|SOUTH,
UP|EAST,
UP|WEST,
UP|NORTHEAST,
UP|NORTHWEST,
UP|SOUTHEAST,
UP|SOUTHWEST,
DOWN|NORTH,
DOWN|SOUTH,
DOWN|EAST,
DOWN|WEST,
DOWN|NORTHEAST,
DOWN|NORTHWEST,
DOWN|SOUTHEAST,
DOWN|SOUTHWEST,
))
GLOBAL_LIST_INIT(alldirs_multiz, list(
NORTH,
SOUTH,
EAST,
WEST,
NORTHEAST,
NORTHWEST,
SOUTHEAST,
SOUTHWEST,
UP,
UP|NORTH,
UP|SOUTH,
UP|EAST,
UP|WEST,
UP|NORTHEAST,
UP|NORTHWEST,
UP|SOUTHEAST,
UP|SOUTHWEST,
DOWN,
DOWN|NORTH,
DOWN|SOUTH,
DOWN|EAST,
DOWN|WEST,
DOWN|NORTHEAST,
DOWN|NORTHWEST,
DOWN|SOUTHEAST,
DOWN|SOUTHWEST,
))
GLOBAL_LIST_INIT(alldirs, list(
NORTH,
SOUTH,
EAST,
WEST,
NORTHEAST,
NORTHWEST,
SOUTHEAST,
SOUTHWEST,
))
+1 -1
View File
@@ -631,7 +631,7 @@
if(Proj.damage_flags & DAMAGE_FLAG_LASER)
if(Proj.damage >= 20)
bullet_mark_icon_state = "scorch"
bullet_mark_dir = pick(GLOB.cardinal) // Pick random scorch design
bullet_mark_dir = pick(GLOB.cardinals) // Pick random scorch design
else
bullet_mark_icon_state = "light_scorch"
@@ -100,7 +100,7 @@
to_chat(daddy, SPAN_WARNING("You feel a bit less real. Which one of you two was original again?.."))
/obj/effect/bluegoast/proc/mirror_dir(var/atom/movable/am, var/old_dir, var/new_dir)
set_dir(GLOB.reverse_dir[new_dir])
set_dir(REVERSE_DIR(new_dir))
/obj/effect/bluegoast/examine(mob/user, distance, is_adjacent, infix, suffix, show_extended)
SHOULD_CALL_PARENT(FALSE)
+1 -1
View File
@@ -44,7 +44,7 @@ In my current plan for it, 'solid' will be defined as anything with density == 1
var/starty = 0
var/endy = 0
var/endx = 0
var/startside = pick(GLOB.cardinal)
var/startside = pick(GLOB.cardinals)
switch(startside)
if(NORTH)
+1 -1
View File
@@ -71,7 +71,7 @@
next_wave = round_duration_in_ticks + meteor_wave_delay
// Starts as barely noticeable dust impact, ends as barrage of most severe meteor types the code has to offer. Have fun.
spawn()
spawn_meteors(meteor_severity, get_meteor_types(), pick(GLOB.cardinal), pick(SSmapping.levels_by_trait(ZTRAIT_STATION)))
spawn_meteors(meteor_severity, get_meteor_types(), pick(GLOB.cardinals), pick(SSmapping.levels_by_trait(ZTRAIT_STATION)))
var/escalated = FALSE
if(prob(escalation_probability) && (meteor_severity < maximal_severity))
meteor_severity++
@@ -25,7 +25,7 @@
/obj/item/clothing/suit/armor/shield/New()
..()
spark(src, 5, GLOB.cardinal)
spark(src, 5, GLOB.cardinals)
/obj/item/clothing/suit/armor/shield/handle_shield(mob/user, var/on_back, var/damage, atom/damage_source = null, mob/attacker = null, var/def_zone = null, var/attack_text = "the attack")
//Since this is a pierce of armor that is passive, we do not need to check if the user is incapacitated.
@@ -63,7 +63,7 @@
user.visible_message(SPAN_DANGER("\The [user]'s [src] absorbs [attack_text]!"))
to_chat(user, SPAN_WARNING("Your shield has absorbed most of \the [damage_source]."))
spark(src, 5, GLOB.cardinal)
spark(src, 5, GLOB.cardinals)
playsound(src, 'sound/weapons/blade.ogg', 50, 1)
return BULLET_ACT_HIT // This shield does not block all damage, so returning 0 is needed to tell the game to apply the new damage.
@@ -34,8 +34,8 @@
if(isitem(hit_atom))
var/obj/item/I = hit_atom
spark(I, 5, GLOB.cardinal)
spark(user, 5, GLOB.cardinal)
spark(I, 5, GLOB.cardinals)
spark(user, 5, GLOB.cardinals)
I.visible_message(SPAN_DANGER("\The [I] vanishes into thin air!"))
I.forceMove(get_turf(user))
user.drop_item(src)
@@ -48,8 +48,8 @@
else if(isliving(hit_atom))
var/mob/living/L = hit_atom
to_chat(L, SPAN_DANGER("You are teleported towards \the [user]!"))
spark(L, 5, GLOB.cardinal)
spark(user, 5, GLOB.cardinal)
spark(L, 5, GLOB.cardinals)
spark(user, 5, GLOB.cardinals)
L.throw_at(get_step(get_turf(src), get_dir(src, L)), 4, 1, src)
addtimer(CALLBACK(src, PROC_REF(seize_mob), L, user), 1 SECOND)
user.drop_item(src)
@@ -40,7 +40,7 @@
visible_message("<span class='info'>[user] rests a hand on \the [hit_atom].</span>")
busy = 1
spark(our_turf, 3, GLOB.cardinal)
spark(our_turf, 3, GLOB.cardinals)
while(i)
checked_turf = get_step(checked_turf, direction) //Advance in the given direction
@@ -38,7 +38,7 @@
return BULLET_ACT_HIT
//block as long as they are not directly behind us
var/bad_arc = reverse_direction(user.dir) //arc of directions from which we cannot block
var/bad_arc = REVERSE_DIR(user.dir) //arc of directions from which we cannot block
if(check_shield_arc(user, bad_arc, damage_source, attacker))
if(istype(damage_source, /obj/projectile))
@@ -75,7 +75,7 @@
to_chat(attacker, SPAN_DANGER("Your [damage_source.name] goes through \the [src] in one location, comes out \
on the same side, and hits you!"))
spark(src, 5, GLOB.cardinal)
spark(src, 5, GLOB.cardinals)
playsound(src, 'sound/weapons/blade.ogg', 50, 1)
log_and_message_admins("[user] reflected [attacker]'s attack back at them.")
@@ -50,10 +50,10 @@
return BULLET_ACT_HIT
//block as long as they are not directly behind us
var/bad_arc = reverse_direction(user.dir) //arc of directions from which we cannot block
var/bad_arc = REVERSE_DIR(user.dir) //arc of directions from which we cannot block
if(check_shield_arc(user, bad_arc, damage_source, attacker))
user.visible_message(SPAN_DANGER("\The [user]'s [src] blocks [attack_text]!"))
spark(src, 3, GLOB.cardinal)
spark(src, 3, GLOB.cardinals)
playsound(src, 'sound/weapons/blade.ogg', 50, 1)
adjust_instability(2)
return BULLET_ACT_BLOCK
+2 -2
View File
@@ -131,7 +131,7 @@
pulse2.icon_state = "empdisable"
pulse2.name = "emp sparks"
pulse2.anchored = 1
pulse2.set_dir(pick(GLOB.cardinal))
pulse2.set_dir(pick(GLOB.cardinals))
QDEL_IN(pulse2, 10)
@@ -174,7 +174,7 @@
// for(var/turf/simulated/t in oview(src,1))
for(var/d in GLOB.cardinal)
for(var/d in GLOB.cardinals)
var/turf/simulated/T = get_step(src, d)
if(istype(T) && !T.density)
if(!LinkBlockedWithAccess(src, T, ID))
+1 -1
View File
@@ -488,7 +488,7 @@
var/turf/T = get_turf(src)
var/list/valid_turfs = list()
for(var/dir_to_test in GLOB.cardinal)
for(var/dir_to_test in GLOB.cardinals)
var/turf/new_turf = get_step(T, dir_to_test)
if(!new_turf.contains_dense_objects())
valid_turfs += new_turf
+1 -1
View File
@@ -312,7 +312,7 @@ Deployable Kits
/obj/item/deployable_kit/surgery_table/assemble_kit(mob/user)
..()
var/free_spot = null
for(var/check_dir in GLOB.cardinal)
for(var/check_dir in GLOB.cardinals)
var/turf/T = get_step(src, check_dir)
if(turf_clear(T))
free_spot = T
+1 -1
View File
@@ -1954,7 +1954,7 @@ About the new airlock wires panel:
var/turf/T = loc
if(istype(T))
var/list/valid_turfs = list()
for(var/dir_to_test in GLOB.cardinal)
for(var/dir_to_test in GLOB.cardinals)
var/turf/new_turf = get_step(T, dir_to_test)
if(!new_turf.contains_dense_objects())
valid_turfs |= new_turf
@@ -33,7 +33,7 @@
t1 += "<B>Unrestricted Access Settings</B><br>"
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
if(direction & unres_dir)
t1 += "<a style='color:#00dd12' href='?src=[REF(src)];unres_dir=[direction]'>[capitalize(dir2text(direction))]</a><br>"
else
+1 -1
View File
@@ -77,7 +77,7 @@
if(!mapload)
enable_smart_generation = 0
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
var/turf/T = get_step(src,direction)
A = get_area(T)
if(istype(A) && !(A in areas_added))
+1 -1
View File
@@ -29,7 +29,7 @@
else
ndir = get_dir(on_floor,usr)
if (!(ndir in GLOB.cardinal))
if (!(ndir in GLOB.cardinals))
return
var/turf/loc = get_turf(on_floor)
+1 -1
View File
@@ -208,7 +208,7 @@ Class Procs:
pulse2.icon_state = "empdisable"
pulse2.name = "emp sparks"
pulse2.anchored = 1
pulse2.set_dir(pick(GLOB.cardinal))
pulse2.set_dir(pick(GLOB.cardinals))
QDEL_IN(pulse2, 10)
+2 -2
View File
@@ -109,7 +109,7 @@
return
var/placement_dir = get_dir(user, W)
if (!(placement_dir in GLOB.cardinal))
if (!(placement_dir in GLOB.cardinals))
to_chat(user, SPAN_WARNING("You must stand directly in front of the wall you wish to place that on."))
return
@@ -119,7 +119,7 @@
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 GLOB.cardinal)
for (var/dir in GLOB.cardinals)
var/turf/T = get_step(W, dir)
if (locate(/obj/machinery/button) in T)
stuff_on_wall = 1
+1 -1
View File
@@ -405,7 +405,7 @@
/obj/item/pipe/Move()
..()
if ((pipe_type in list (PIPE_SIMPLE_BENT, PIPE_SUPPLY_BENT, PIPE_SCRUBBERS_BENT, PIPE_FUEL_BENT, PIPE_AUX_BENT, PIPE_HE_BENT)) \
&& (src.dir in GLOB.cardinal))
&& (src.dir in GLOB.cardinals))
src.set_dir(src.dir|turn(src.dir, 90))
else if (pipe_type in list (PIPE_SIMPLE_STRAIGHT, PIPE_SUPPLY_STRAIGHT, PIPE_SCRUBBERS_STRAIGHT, PIPE_FUEL_STRAIGHT, PIPE_AUX_STRAIGHT, PIPE_UNIVERSAL, PIPE_HE_STRAIGHT, PIPE_MVALVE))
if(dir==2)
+1 -1
View File
@@ -29,7 +29,7 @@
else
ndir = get_dir(on_wall,usr)
if (!(ndir in GLOB.cardinal))
if (!(ndir in GLOB.cardinals))
return
var/turf/loc = get_turf(usr)
+2 -2
View File
@@ -19,7 +19,7 @@
if(cached_icon)
icon = cached_icon
set_dir(pick(GLOB.cardinal))
set_dir(pick(GLOB.cardinals))
pixel_x = -32 + rand(-8, 8)
pixel_y = -32 + rand(-8, 8)
@@ -285,7 +285,7 @@
while(pending.len)
for(var/turf/current in pending)
for(var/D in GLOB.cardinal)
for(var/D in GLOB.cardinals)
var/turf/target = get_step(current, D)
if(wallList)
if(istype(target, /turf/simulated/wall))
+1 -1
View File
@@ -55,7 +55,7 @@
if(--amount < 0)
return
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
var/turf/T = get_step(src, direction)
if(!T)
continue
@@ -33,7 +33,7 @@
if(amount < 15) return //lets suppose welder fuel is fairly thick and sticky. For something like water, 5 or less would be more appropriate.
var/turf/simulated/S = loc
if(!istype(S)) return
for(var/d in GLOB.cardinal)
for(var/d in GLOB.cardinals)
var/turf/simulated/target = get_step(src,d)
var/turf/simulated/origin = get_turf(src)
if(origin.CanPass(null, target, 0, 0) && target.CanPass(null, origin, 0, 0))
@@ -88,7 +88,7 @@
var/turf/simulated/S = loc
if(!istype(S))
return
for(var/d in GLOB.cardinal)
for(var/d in GLOB.cardinals)
var/turf/simulated/target = get_step(src,d)
var/turf/simulated/origin = get_turf(src)
if(origin.CanPass(null, target, 0, 0) && target.CanPass(null, origin, 0, 0))
@@ -149,7 +149,7 @@
if(amount < 15) return
var/turf/simulated/S = loc
if(!istype(S)) return
for(var/d in GLOB.cardinal)
for(var/d in GLOB.cardinals)
var/turf/simulated/target = get_step(src,d)
var/turf/simulated/origin = get_turf(src)
if(origin.CanPass(null, target, 0, 0) && target.CanPass(null, origin, 0, 0))
@@ -37,7 +37,7 @@
return
var/placement_dir = get_dir(user, W)
if (!(placement_dir in GLOB.cardinal))
if (!(placement_dir in GLOB.cardinals))
to_chat(user, SPAN_WARNING("You must stand directly in front of the wall you wish to place that on."))
return
@@ -47,7 +47,7 @@
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 GLOB.cardinal)
for (var/dir in GLOB.cardinals)
var/turf/T = get_step(W, dir)
if (locate(/obj/structure/sign/poster) in T)
stuff_on_wall = 1
+2 -2
View File
@@ -13,7 +13,7 @@
icon_state = "drift"
/obj/effect/floor_decal/snowdrift/random/Initialize(mapload, newdir, newcolour, bypass, set_icon_state)
supplied_dir = pick(GLOB.cardinal)
supplied_dir = pick(GLOB.cardinals)
return ..()
/obj/effect/floor_decal/snowdrift/large
@@ -22,5 +22,5 @@
pixel_x = -16
/obj/effect/floor_decal/snowdrift/large/random/Initialize(mapload, newdir, newcolour, bypass, set_icon_state)
supplied_dir = pick(GLOB.cardinal)
supplied_dir = pick(GLOB.cardinals)
return ..()
+2 -2
View File
@@ -78,7 +78,7 @@ steam.start() -- spawns the effect
var/obj/effect/effect/steam/steam = new /obj/effect/effect/steam(src.location)
var/direction
if(src.cardinals)
direction = pick(GLOB.cardinal)
direction = pick(GLOB.cardinals)
else
direction = pick(GLOB.alldirs)
for(i=0, i<pick(1,2,3), i++)
@@ -282,7 +282,7 @@ steam.start() -- spawns the effect
var/direction = src.direction
if(!direction)
if(src.cardinals)
direction = pick(GLOB.cardinal)
direction = pick(GLOB.cardinals)
else
direction = pick(GLOB.alldirs)
for(i=0, i<pick(0,1,1,1,2,2,2,3), i++)
+1 -1
View File
@@ -62,7 +62,7 @@
/obj/effect/overlay/temp/New()
..()
if(randomdir)
dir = (pick(GLOB.cardinal))
dir = (pick(GLOB.cardinals))
flick("[icon_state]", src)
QDEL_IN(src, duration)
@@ -7,7 +7,7 @@
var/splatter_type = "splatter"
/obj/effect/temp_visual/dir_setting/bloodsplatter/Initialize(mapload, set_dir, _color)
if(set_dir in GLOB.cornerdirs)
if(set_dir in GLOB.diagonals)
icon_state = "[splatter_type][pick(1, 2, 6)]"
else
icon_state = "[splatter_type][pick(3, 4, 5)]"
@@ -13,7 +13,7 @@
if(new_dir)
set_dir(new_dir)
else if(randomdir)
set_dir(pick(GLOB.cardinal))
set_dir(pick(GLOB.cardinals))
QDEL_IN(src, duration)
+1 -1
View File
@@ -23,7 +23,7 @@
return
var/ndir = get_dir(user, on_wall)
if(!(ndir in GLOB.cardinal))
if(!(ndir in GLOB.cardinals))
to_chat(user, SPAN_WARNING("You need to stand in front of the wall, directly, to build an APC!"))
return
+1 -1
View File
@@ -115,7 +115,7 @@
var/dir_offset = 0
if(target_turf != source_turf)
dir_offset = get_dir(source_turf, target_turf)
if(!(dir_offset in GLOB.cardinal))
if(!(dir_offset in GLOB.cardinals))
to_chat(user, SPAN_WARNING("You cannot reach that from here."))
return
@@ -60,8 +60,8 @@
update_icon()
var/obj/machinery/door/airlock/newtarget = (locate(/obj/machinery/door/airlock) in get_turf(src))
if(newtarget)
var/direction = reverse_direction(dir)
forceMove(get_step(newtarget.loc, reverse_direction(direction)))
var/direction = REVERSE_DIR(dir)
forceMove(get_step(newtarget.loc, REVERSE_DIR(direction)))
for (var/obj/machinery/door/airlock/A in oview(1, newtarget))
var/rdir = get_dir(newtarget, A)
if (istype(A, newtarget.type) && (rdir == turn(direction, -90) || rdir == turn(direction, 90)))
@@ -300,7 +300,7 @@
return
var/direction = get_dir(user, newtarget)
if ((direction in GLOB.alldirs) && !(direction in GLOB.cardinal))
if ((direction in GLOB.alldirs) && !(direction in GLOB.cardinals))
direction = turn(direction, -45)
if (check_neighbor_density(get_turf(newtarget.loc), direction))
direction = turn(direction, 90)
@@ -326,8 +326,8 @@
user.drop_from_inventory(src, src.loc)
forceMove(get_step(newtarget.loc, reverse_direction(direction)))
set_dir(reverse_direction(direction))
forceMove(get_step(newtarget.loc, REVERSE_DIR(direction)))
set_dir(REVERSE_DIR(direction))
status = STATUS_ACTIVE
attach(newtarget)
user.visible_message(SPAN_NOTICE("[user] attached [src] onto [newtarget] and flicks it on. The magnetic lock now seals [newtarget]."),
@@ -39,7 +39,7 @@
if(!src) return 1
if(src.loc != user) return 1
var/list/directions = new/list(GLOB.cardinal)
var/list/directions = new/list(GLOB.cardinals)
var/i = 0
for (var/obj/structure/window/win in user.loc)
i++
@@ -47,7 +47,7 @@
to_chat(user, SPAN_WARNING("There are too many windows in this location."))
return 1
directions-=win.dir
if(!(win.dir in GLOB.cardinal))
if(!(win.dir in GLOB.cardinals))
to_chat(user, SPAN_WARNING("Can't let you do that."))
return 1
@@ -76,7 +76,7 @@
return BULLET_ACT_HIT
//block as long as they are not directly behind us
var/bad_arc = reverse_direction(user.dir) //arc of directions from which we cannot block
var/bad_arc = REVERSE_DIR(user.dir) //arc of directions from which we cannot block
if(check_shield_arc(user, bad_arc, damage_source, attacker))
if(prob(base_block_chance) && shield_power)
+3 -3
View File
@@ -23,7 +23,7 @@
return 0
//block as long as they are not directly behind us
var/bad_arc = reverse_direction(user.dir) //arc of directions from which we cannot block
var/bad_arc = REVERSE_DIR(user.dir) //arc of directions from which we cannot block
if(!check_shield_arc(user, bad_arc, damage_source, attacker))
return 0
@@ -40,7 +40,7 @@
recyclable = TRUE
/obj/item/shield/handle_shield(mob/user, var/on_back, var/damage, atom/damage_source = null, mob/attacker = null, def_zone = null, attack_text = "the attack")
var/shield_dir = on_back ? user.dir : GLOB.reverse_dir[user.dir]
var/shield_dir = on_back ? user.dir : REVERSE_DIR(user.dir)
if(user.incapacitated() || !(check_shield_arc(user, shield_dir, damage_source, attacker)))
return BULLET_ACT_HIT
@@ -177,7 +177,7 @@
user.update_inv_r_hand()
/obj/item/shield/energy/handle_shield(mob/user, on_back, damage, atom/damage_source = null, mob/attacker = null, def_zone = null, attack_text = "the attack")
var/shield_dir = on_back ? user.dir : GLOB.reverse_dir[user.dir]
var/shield_dir = on_back ? user.dir : REVERSE_DIR(user.dir)
if(!active || user.incapacitated() || !(check_shield_arc(user, shield_dir, damage_source, attacker)))
return BULLET_ACT_HIT
+1 -1
View File
@@ -48,7 +48,7 @@
icon_state = "c-4[size]_1"
spawn(50)
explosion(get_turf(src), power, power*2, power*3, power*4, power*4)
for(var/dirn in GLOB.cardinal) //This is to guarantee that C4 at least breaks down all immediately adjacent walls and doors.
for(var/dirn in GLOB.cardinals) //This is to guarantee that C4 at least breaks down all immediately adjacent walls and doors.
var/turf/simulated/wall/T = get_step(src,dirn)
if(locate(/obj/machinery/door/airlock) in T)
var/obj/machinery/door/airlock/D = locate() in T
+2 -2
View File
@@ -139,8 +139,8 @@
var/dir_offset = 0
if(target_turf != source_turf)
dir_offset = get_dir(source_turf, target_turf)
if(!(dir_offset in GLOB.cardinal))
to_chat(user, "You cannot reach that from here.") // can only place stuck papers in GLOB.cardinal directions, to)
if(!(dir_offset in GLOB.cardinals))
to_chat(user, "You cannot reach that from here.") // can only place stuck papers in GLOB.cardinals directions, to)
return // reduce papers around corners issue.
user.drop_from_inventory(src,source_turf)
@@ -224,7 +224,7 @@
/obj/structure/barricade/ex_act(severity, direction, cause_data)
for(var/obj/structure/barricade/B in get_step(src,dir)) //discourage double-stacking barricades by removing health from opposing barricade
if(B.dir == reverse_direction(dir))
if(B.dir == REVERSE_DIR(dir))
INVOKE_ASYNC(B, TYPE_PROC_REF(/atom, ex_act), severity, direction)
update_health(round(severity))
@@ -255,7 +255,7 @@
/obj/structure/barricade/proc/take_damage(var/damage)
for(var/obj/structure/barricade/B in get_step(src,dir)) //discourage double-stacking barricades by removing health from opposing barricade
if(B.dir == reverse_direction(dir))
if(B.dir == REVERSE_DIR(dir))
B.update_health(damage)
update_health(damage)
@@ -26,7 +26,7 @@
/obj/structure/barricade/plasteel/update_icon()
..()
if(linked)
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
for(var/obj/structure/barricade/plasteel/cade in get_step(src, direction))
if(((dir & (NORTH|SOUTH) && get_dir(src, cade) & (EAST|WEST)) || (dir & (EAST|WEST) && get_dir(src, cade) & (NORTH|SOUTH))) && dir == cade.dir && cade.linked && cade.closed == src.closed && hasconnectionoverlay)
if(closed)
@@ -102,7 +102,7 @@
to_chat(user, SPAN_WARNING("The [src] has no linking points."))
return
linked = !linked
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
for(var/obj/structure/barricade/plasteel/cade in get_step(src, direction))
cade.update_icon()
update_icon()
@@ -197,7 +197,7 @@
closed = 0
density = 1
if(linked)
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
for(var/obj/structure/barricade/plasteel/cade in get_step(src, direction))
if(((dir & (NORTH|SOUTH) && get_dir(src, cade) & (EAST|WEST)) || (dir & (EAST|WEST) && get_dir(src, cade) & (NORTH|SOUTH))) && dir == cade.dir && cade != origin && cade.linked)
cade.open(src)
@@ -210,7 +210,7 @@
closed = 1
density = 0
if(linked)
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
for(var/obj/structure/barricade/plasteel/cade in get_step(src, direction))
if(((dir & (NORTH|SOUTH) && get_dir(src, cade) & (EAST|WEST)) || (dir & (EAST|WEST) && get_dir(src, cade) & (NORTH|SOUTH))) && dir == cade.dir && cade != origin && cade.linked)
cade.close(src)
@@ -178,7 +178,7 @@
return
var/placement_dir = get_dir(user, A)
if (!(placement_dir in GLOB.cardinal))
if (!(placement_dir in GLOB.cardinals))
to_chat(user, SPAN_WARNING("You must stand directly in front of the location you wish to place that on."))
return
@@ -60,13 +60,13 @@
new /obj/effect/decal/cleanable/blood/no_dry(loc)
START_PROCESSING(SSprocessing, src)
dirs_left = GLOB.cardinal.Copy()
dirs_left = GLOB.cardinals.Copy()
/obj/structure/gore/tendrils/proc/update_neighbours(turf/U)
if(!U)
U = loc
if(istype(U))
for(var/dirn in GLOB.cardinal)
for(var/dirn in GLOB.cardinals)
var/turf/T = get_step(U, dirn)
if(!istype(T))
continue
@@ -76,7 +76,7 @@
/obj/structure/gore/tendrils/proc/update_sprite()
var/my_dir = 0
for(var/check_dir in GLOB.cardinal)
for(var/check_dir in GLOB.cardinals)
var/turf/check = get_step(src, check_dir)
if(!istype(check))
continue
@@ -42,7 +42,7 @@
buckled.set_dir(dir)
/obj/structure/bed/stool/chair/MouseDrop_T(atom/dropping, mob/user)
if(dropping == user && user.loc != loc && (GLOB.reverse_dir[dir] & angle2dir(Get_Angle(src, user))))
if(dropping == user && user.loc != loc && (REVERSE_DIR(dir) & angle2dir(Get_Angle(src, user))))
user.visible_message("<b>[user]</b> starts climbing over the back of \the [src]...", SPAN_NOTICE("You start climbing over the back of \the [src]..."))
if(do_after(user, 2 SECONDS, do_flags = DO_UNIQUE))
user.forceMove(loc)
@@ -51,7 +51,7 @@
/obj/structure/bed/stool/chair/CanPass(atom/movable/mover, turf/target, height, air_group)
if(anchored && padding_material)
if(mover?.density && isliving(mover) && (GLOB.reverse_dir[dir] & angle2dir(Get_Angle(src, mover))))
if(mover?.density && isliving(mover) && (REVERSE_DIR(dir) & angle2dir(Get_Angle(src, mover))))
return FALSE
return ..()
+3 -3
View File
@@ -23,7 +23,7 @@
ClearOverlays()
var/has_border = 0
//Check the cardinal turfs
for(var/step_dir in GLOB.cardinal)
for(var/step_dir in GLOB.cardinals)
var/turf/simulated/floor/T = get_step(src, step_dir)
var/is_linked = flooring.symmetric_test_link(src, T)
@@ -41,7 +41,7 @@
//We can only have inner corners if we're smoothed with something
if (has_smooth && flooring.flags & TURF_HAS_INNER_CORNERS)
for(var/direction in GLOB.cornerdirs)
for(var/direction in GLOB.diagonals)
if((has_smooth & direction) == direction)
if(!flooring.symmetric_test_link(src, get_step(src, direction)))
if(flooring.has_damage_state && !isnull(broken) && (flooring.flags & TURF_CAN_BREAK))
@@ -51,7 +51,7 @@
//Next up, outer corners
if (has_border && flooring.flags & TURF_HAS_CORNERS)
for(var/direction in GLOB.cornerdirs)
for(var/direction in GLOB.diagonals)
if((has_border & direction) == direction)
if(!flooring.symmetric_test_link(src, get_step(src, direction)))
if(flooring.has_damage_state && !isnull(broken) && (flooring.flags & TURF_CAN_BREAK))
+1 -1
View File
@@ -28,7 +28,7 @@
to_chat(usr, "Checking for overlapping pipes...")
next_turf:
for(var/turf/T in world)
for(var/dir in GLOB.cardinal)
for(var/dir in GLOB.cardinals)
var/list/connect_types = list(1 = 0, 2 = 0, 3 = 0)
for(var/obj/machinery/atmospherics/pipe in T)
if(dir & pipe.initialize_directions)
+1 -1
View File
@@ -27,7 +27,7 @@
var/obj/structure/reagent_dispensers/fueltank/tank = src.loc.loc
if(tank?.is_leaking)
tank.ex_act(3)
spark(src, 4, GLOB.cardinal)
spark(src, 4, GLOB.cardinals)
return TRUE
/obj/item/device/assembly/igniter/attack_self(mob/user)
+2 -2
View File
@@ -176,7 +176,7 @@
var/cache_name = state
for(var/D in GLOB.cardinal)
for(var/D in GLOB.cardinals)
var/image/I = image('icons/atmos/pipe_underlays.dmi', icon_state = state, dir = D)
underlays[cache_name + "[D]"] = I
for(var/pipe_color in GLOB.pipe_colors)
@@ -208,7 +208,7 @@
if(state == "")
continue
for(var/D in GLOB.cardinal)
for(var/D in GLOB.cardinals)
var/image/I = image('icons/atmos/pipe_underlays.dmi', icon_state = state, dir = D)
switch(state)
if("intact")
@@ -29,7 +29,7 @@
/obj/machinery/atmospherics/omni/Initialize()
icon_state = "base"
ports = new()
for(var/d in GLOB.cardinal)
for(var/d in GLOB.cardinals)
var/datum/omni_port/new_port = new(src, d)
switch(d)
if(NORTH)
@@ -146,7 +146,7 @@
var/node1_dir
var/node2_dir
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
if(direction&initialize_directions)
if (!node1_dir)
node1_dir = direction
+1 -1
View File
@@ -31,7 +31,7 @@
var/node1_dir
var/node2_dir
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
if(direction&initialize_directions_he)
if (!node1_dir)
node1_dir = direction
+4 -4
View File
@@ -308,7 +308,7 @@
var/node1_dir
var/node2_dir
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
if(direction&initialize_directions)
if (!node1_dir)
node1_dir = direction
@@ -629,7 +629,7 @@
/obj/machinery/atmospherics/pipe/manifold/atmos_init()
var/connect_directions = (NORTH|SOUTH|EAST|WEST)&(~dir)
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
if(direction&connect_directions)
for(var/obj/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src))
@@ -641,7 +641,7 @@
break
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
if(direction&connect_directions)
for(var/obj/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src))
@@ -653,7 +653,7 @@
break
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
if(direction&connect_directions)
for(var/obj/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src))
+1 -1
View File
@@ -297,7 +297,7 @@
process_core_health()
regen()
for(var/i = 1 to times_to_pulse)
pulse(pulse_power, GLOB.cardinal.Copy())
pulse(pulse_power, GLOB.cardinals.Copy())
blob_may_process = TRUE
if(world.time < (attack_time + attack_cooldown))
return
+1 -1
View File
@@ -298,7 +298,7 @@ var/list/preferences_datums = list()
BG.screen_loc = "character_preview_map:1,1 to 1,5"
var/index = 0
for(var/D in GLOB.cardinal)
for(var/D in GLOB.cardinals)
var/atom/movable/screen/O = LAZYACCESS(char_render_holders, "[D]")
if(!O)
O = new
+1 -1
View File
@@ -976,7 +976,7 @@
wearer.inertia_dir = 0 //If not then we can reset inertia and move
if(malfunctioning)
direction = pick(GLOB.cardinal)
direction = pick(GLOB.cardinals)
// Inside an object, tell it we moved.
if(isobj(wearer.loc) || ismob(wearer.loc))
+1 -1
View File
@@ -24,7 +24,7 @@
/obj/machinery/gibber/autogibber/Initialize()
. = ..()
for(var/i in GLOB.cardinal)
for(var/i in GLOB.cardinals)
var/obj/machinery/mineral/input/input_obj = locate( /obj/machinery/mineral/input, get_step(loc, i) )
if(input_obj)
if(isturf(input_obj.loc))
+1 -1
View File
@@ -117,7 +117,7 @@
if(H.mob_size < 10) // smaller than an unathi
H.visible_message(SPAN_WARNING("\The [src] goes flying out of \the [H]'s hand!"), SPAN_WARNING("\The [src] flies out of your hand!"))
H.drop_item(src)
src.throw_at(get_edge_target_turf(src, GLOB.reverse_dir[H.dir]), 3, 3)
src.throw_at(get_edge_target_turf(src, REVERSE_DIR(H.dir)), 3, 3)
var/obj/item/organ/external/LH = H.get_organ(BP_L_HAND)
var/obj/item/organ/external/RH = H.get_organ(BP_R_HAND)
@@ -4,7 +4,7 @@
var/effect_system_type = null // Which effect system to attach.
var/effect_amount = 10 // How many effect objects to create on each interval. Note that there's a hard cap on certain effect_systems.
var/effect_cardinals_only = FALSE // If true, effects only move in GLOB.cardinal directions.
var/effect_cardinals_only = FALSE // If true, effects only move in GLOB.cardinals directions.
var/effect_forced_dir = null // If set, effects emitted will always move in this direction.
/obj/effect/map_effect/interval/effect_emitter/Initialize()
@@ -61,7 +61,7 @@
new_firedoor.req_one_access = req_one_access
if(!single_window)
var/list/neighbours = list()
for (var/dir in GLOB.cardinal)
for (var/dir in GLOB.cardinals)
var/turf/T = get_step(src, dir)
var/obj/effect/map_effect/window_spawner/other = locate(/obj/effect/map_effect/window_spawner) in T
if(!other)
@@ -133,7 +133,7 @@ do { \
// On both tiles
for(var/obj/structure/window/reinforced/crescent/W in T3)
if(W.dir == GLOB.reverse_dir[text2num(D)])
if(W.dir == REVERSE_DIR(text2num(D)))
qdel(W)
// Mark as visited
@@ -68,7 +68,7 @@
var/turf/T3 = unvisited_neighbours["[D]"] // Pick random dir turf
// Remove the color between the two
var/turf/T4 = get_step(T3, GLOB.reverse_dir[text2num(D)])
var/turf/T4 = get_step(T3, REVERSE_DIR(text2num(D)))
T4?.color = MAZEGEN_TURF_CELL
// Mark as visited
+2 -2
View File
@@ -1,8 +1,8 @@
// -- Spark Procs --
/proc/spark(var/atom/movable/loc, var/amount = 1, var/spread_dirs = GLOB.cardinal)
/proc/spark(var/atom/movable/loc, var/amount = 1, var/spread_dirs = GLOB.cardinals)
new /datum/effect_system/sparks(get_turf(loc), TRUE, amount, spread_dirs)
/proc/bind_spark(var/atom/movable/loc, var/amount = 1, var/spread_dirs = GLOB.cardinal)
/proc/bind_spark(var/atom/movable/loc, var/amount = 1, var/spread_dirs = GLOB.cardinals)
var/datum/effect_system/sparks/S = new(loc, FALSE, amount, spread_dirs)
S.bind(loc)
return S
+1 -1
View File
@@ -21,7 +21,7 @@
for(var/n in 1 to severity)
waves += rand(5,15)
start_side = pick(GLOB.cardinal)
start_side = pick(GLOB.cardinals)
endWhen = worst_case_end()
/datum/event/meteor_wave/announce()
@@ -271,7 +271,7 @@
return
if(hallucination >= EMP_MOVE_DISRUPT && prob(30))
direction = pick(GLOB.cardinal)
direction = pick(GLOB.cardinals)
var/do_strafe = !isnull(user.facing_dir) && (legs.turn_delay <= legs.move_delay)
if(!do_strafe && dir != direction)
@@ -208,7 +208,7 @@
var/direction = 16
for(var/wallDir in GLOB.cardinal)
for(var/wallDir in GLOB.cardinals)
var/turf/newTurf = get_step(T,wallDir)
if(newTurf.density)
direction |= wallDir
@@ -2,7 +2,7 @@
/obj/effect/plant/proc/get_cardinal_neighbors()
var/list/cardinal_neighbors = list()
for(var/check_dir in GLOB.cardinal)
for(var/check_dir in GLOB.cardinals)
var/turf/simulated/T = get_step(get_turf(src), check_dir)
if(istype(T))
cardinal_neighbors |= T
@@ -83,5 +83,5 @@
//entangling people
if(victim.loc == src.loc)
buckle(victim)
victim.set_dir(pick(GLOB.cardinal))
victim.set_dir(pick(GLOB.cardinals))
to_chat(victim, SPAN_DANGER("Tendrils tighten around you!"))
@@ -195,7 +195,7 @@
if(get_dist(on_wall,user) > 1)
return
var/ndir = get_dir(on_wall, user)
if(!(ndir in GLOB.cardinal))
if(!(ndir in GLOB.cardinals))
return
var/turf/T = get_turf(user)
if(!istype(T, /turf/simulated/floor))
+1 -1
View File
@@ -69,7 +69,7 @@
attack_message = "[A] attempted to strike [D], but missed!"
else
attack_message = "[A] attempted to strike [D], but [D.get_pronoun("he")] rolled out of the way!"
D.set_dir(pick(GLOB.cardinal))
D.set_dir(pick(GLOB.cardinals))
miss_type = 1
if(!miss_type && block)
+1 -1
View File
@@ -555,7 +555,7 @@
return 1
// Get data for building windows here.
var/list/possible_directions = GLOB.cardinal.Copy()
var/list/possible_directions = GLOB.cardinals.Copy()
var/window_count = 0
for (var/obj/structure/window/check_window in user.loc)
window_count++
+1 -1
View File
@@ -556,7 +556,7 @@
return ..()
/obj/machinery/mining/brace/proc/connect()
for(var/angle in GLOB.cardinal) // make it face any drill in GLOB.cardinal direction from it
for(var/angle in GLOB.cardinals) // make it face any drill in GLOB.cardinals direction from it
var/obj/machinery/mining/drill/D = locate() in get_step(src, angle)
if(D)
src.dir = angle
+3 -3
View File
@@ -355,19 +355,19 @@ GLOBAL_LIST_EMPTY_TYPED(alloy_data, /datum/alloy)
. = ..()
//Locate our output and input machinery.
for(var/dir in GLOB.cardinal)
for(var/dir in GLOB.cardinals)
var/input_spot = locate(/obj/machinery/mineral/input, get_step(src, dir))
if(input_spot)
input = get_turf(input_spot) // thought of qdeling the spots here, but it's useful when rebuilding a destroyed machine
break
for(var/dir in GLOB.cardinal)
for(var/dir in GLOB.cardinals)
var/output_spot = locate(/obj/machinery/mineral/output, get_step(src, dir))
if(output)
output = get_turf(output_spot)
break
if(!input)
input = get_step(src, GLOB.reverse_dir[dir])
input = get_step(src, REVERSE_DIR(dir))
if(!output)
output = get_step(src, dir)
+3 -3
View File
@@ -143,19 +143,19 @@
stack_paths[stacktype] = capitalize(initial(S.name))
//Locate our output and input machinery.
for(var/dir in GLOB.cardinal)
for(var/dir in GLOB.cardinals)
var/input_spot = locate(/obj/machinery/mineral/input, get_step(src, dir))
if(input_spot)
input = get_turf(input_spot) // thought of qdeling the spots here, but it's useful when rebuilding a destroyed machine
break
for(var/dir in GLOB.cardinal)
for(var/dir in GLOB.cardinals)
var/output_spot = locate(/obj/machinery/mineral/output, get_step(src, dir))
if(output)
output = get_turf(output_spot)
break
if(!input)
input = get_step(src, GLOB.reverse_dir[dir])
input = get_step(src, REVERSE_DIR(dir))
if(!output)
output = get_step(src, dir)
+3 -3
View File
@@ -22,19 +22,19 @@
. = ..()
//Locate our output and input machinery.
for(var/dir in GLOB.cardinal)
for(var/dir in GLOB.cardinals)
var/input_spot = locate(/obj/machinery/mineral/input, get_step(src, dir))
if(input_spot)
input = get_turf(input_spot) // thought of qdeling the spots here, but it's useful when rebuilding a destroyed machine
break
for(var/dir in GLOB.cardinal)
for(var/dir in GLOB.cardinals)
var/output_spot = locate(/obj/machinery/mineral/output, get_step(src, dir))
if(output)
output = get_turf(output_spot)
break
if(!input)
input = get_step(src, GLOB.reverse_dir[dir])
input = get_step(src, REVERSE_DIR(dir))
if(!output)
output = get_step(src, dir)
+3 -3
View File
@@ -488,13 +488,13 @@
qdel(src)
return
updateOverlays()
for(var/dir in GLOB.cardinal)
for(var/dir in GLOB.cardinals)
var/obj/structure/track/R = locate(/obj/structure/track, get_step(src, dir))
if(R)
R.updateOverlays()
/obj/structure/track/Destroy()
for(var/dir in GLOB.cardinal)
for(var/dir in GLOB.cardinals)
var/obj/structure/track/R = locate(/obj/structure/track, get_step(src, dir))
if(R)
R.updateOverlays()
@@ -527,7 +527,7 @@
var/dir_sum = 0
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
if(locate(/obj/structure/track, get_step(src, direction)))
dir_sum += direction
+2 -2
View File
@@ -22,11 +22,11 @@
/obj/machinery/mineral/mint/Initialize()
. = ..()
for(var/dir in GLOB.cardinal)
for(var/dir in GLOB.cardinals)
src.input = locate(/obj/machinery/mineral/input, get_step(src, dir))
if(src.input)
break
for(var/dir in GLOB.cardinal)
for(var/dir in GLOB.cardinals)
src.output = locate(/obj/machinery/mineral/output, get_step(src, dir))
if(src.output)
break
@@ -202,7 +202,7 @@
break
var/turf/T = pending_turfs[1]
pending_turfs -= T
for(var/dir in GLOB.cardinal) // Floodfill to find all turfs contiguous with the randomly chosen start_turf.
for(var/dir in GLOB.cardinals) // Floodfill to find all turfs contiguous with the randomly chosen start_turf.
var/turf/NT = get_step(T, dir)
if(!isturf(NT) || !(NT in selected_turfs) || (NT in pending_turfs) || (NT in checked_turfs))
continue
@@ -229,7 +229,7 @@
attack_message = "[H] attempted to strike [src], but missed!"
else
attack_message = "[H] attempted to strike [src], but [src.get_pronoun("he")] rolled out of the way!"
src.set_dir(pick(GLOB.cardinal))
src.set_dir(pick(GLOB.cardinals))
miss_type = 1
if(!miss_type && block)
@@ -380,7 +380,7 @@
problem_railing = R
break
for(var/obj/structure/railing/R in get_step(T, dir))
if(R.dir == GLOB.reverse_dir[dir])
if(R.dir == REVERSE_DIR(dir))
problem_railing = R
same_loc = TRUE
break
@@ -752,7 +752,7 @@
if(length(trail_info))
var/track_path = trail_info["footprint_type"]
T.add_tracks(track_path ? track_path : H.species.get_move_trail(H), trail_info["footprint_DNA"], H.dir, 0, trail_info["footprint_color"]) // Coming
var/turf/simulated/from = get_step(H, reverse_direction(H.dir))
var/turf/simulated/from = get_step(H, REVERSE_DIR(H.dir))
if(istype(from))
from.add_tracks(track_path ? track_path : H.species.get_move_trail(H), trail_info["footprint_DNA"], 0, H.dir, trail_info["footprint_color"]) // Going
@@ -58,7 +58,7 @@
return
if(prob(33) && H.canmove && isturf(H.loc) && !H.pulledby) //won't move if being pulled
step(H, pick(GLOB.cardinal))
step(H, pick(GLOB.cardinals))
if(prob(1))
H.emote(pick("scratch","jump","roll","tail"))
@@ -97,7 +97,7 @@ GLOBAL_LIST_EMPTY(sparring_attack_cache)
else
target.visible_message(SPAN_DANGER("[target] slams into [T]!"))
if(prob(50))
target.set_dir(GLOB.reverse_dir[target.dir])
target.set_dir(REVERSE_DIR(target.dir))
target.apply_effect(attack_damage * 0.4, WEAKEN, armor)
if(BP_GROIN)
if(pain_message)
+2 -2
View File
@@ -267,13 +267,13 @@
if(holding_still)
holding_still = max(holding_still - 1 - hungry, 0)
else if(canmove && !pulledby && !length(grabbed_by) && isturf(loc) && prob(50))
step(src, pick(GLOB.cardinal))
step(src, pick(GLOB.cardinals))
else
if(holding_still)
holding_still = max(holding_still - 1, 0)
else if(canmove && !pulledby && !length(grabbed_by) && isturf(loc) && prob(33))
step(src, pick(GLOB.cardinal))
step(src, pick(GLOB.cardinals))
/mob/living/carbon/slime/proc/handle_AI() // the master AI process
if(victim?.stat & DEAD)
@@ -187,7 +187,7 @@
if(strength <= 0)
qdel(src)
return
var/turf/simulated/floor/T = get_step(src, pick(GLOB.cardinal))
var/turf/simulated/floor/T = get_step(src, pick(GLOB.cardinals))
if(istype(T))
Move(T)
break
@@ -294,7 +294,7 @@
latest_child = new /mob/living/simple_animal/hostile/hivebot/bomber(Destination, src)
if(GUARDIAN)
Destination = null
for(var/check_dir in GLOB.cardinal)
for(var/check_dir in GLOB.cardinals)
var/turf/T = get_step(src, check_dir)
if(turf_clear(T))
Destination = T
@@ -236,7 +236,7 @@
var/turf/T
if((!last_prospect_target) || (last_prospect_loc != src.loc))
destination = pick(GLOB.cardinal)
destination = pick(GLOB.cardinals)
T = get_step(src, destination)
last_prospect_target = T
last_prospect_loc = src.loc
@@ -297,7 +297,7 @@
if(istype(O, /obj/structure/window))
var/dir = get_dir(T,src.loc)
var/obj/structure/window/W = O
if(W.dir == GLOB.reverse_dir[dir])
if(W.dir == REVERSE_DIR(dir))
W.attack_generic(src,rand(melee_damage_lower,melee_damage_upper),attacktext)
else
W.attack_generic(src,rand(melee_damage_lower,melee_damage_upper),attacktext)
@@ -385,7 +385,7 @@ ABSTRACT_TYPE(/mob/living/simple_animal/hostile)
return FALSE
if(prob(break_stuff_probability) || bypass_prob) //bypass_prob is used to make mob destroy things in the way to our target
for(var/card_dir in GLOB.cardinal) // North, South, East, West
for(var/card_dir in GLOB.cardinals) // North, South, East, West
var/turf/target_turf = get_step(src, card_dir)
var/obj/found_obj = locate(/obj/effect/energy_field) in target_turf
@@ -401,7 +401,7 @@ ABSTRACT_TYPE(/mob/living/simple_animal/hostile)
found_obj = locate(/obj/structure/window) in target_turf
if(found_obj)
if((found_obj.atom_flags & ATOM_FLAG_CHECKS_BORDER) && found_obj.dir != GLOB.reverse_dir[card_dir])
if((found_obj.atom_flags & ATOM_FLAG_CHECKS_BORDER) && found_obj.dir != REVERSE_DIR(card_dir))
continue
found_obj.attack_generic(src, rand(melee_damage_lower, melee_damage_upper), attacktext, TRUE)
hostile_last_attack = world.time
@@ -60,7 +60,7 @@
if(1)
rival.forceMove(loc)
visible_message("<b>[src]</b> lifts \the [rival] over its head and slams them down into the ground behind them!")
rival.throw_at(get_step(src, GLOB.reverse_dir[dir]), 1, 3, src, TRUE)
rival.throw_at(get_step(src, REVERSE_DIR(dir)), 1, 3, src, TRUE)
playsound(loc, 'sound/effects/bang.ogg', 50, 1)
rival.apply_damage(2, DAMAGE_BRUTE)
if(2)
@@ -364,7 +364,7 @@
//Wander around aimlessly. This will help keep the loops from searches down
//and possibly move the mob into a new are in view of something they can use
if(prob(90))
step(src, pick(GLOB.cardinal))
step(src, pick(GLOB.cardinals))
return
if(!held_item && !parrot_perch) //If we've got nothing to do.. look for something to do.
+4 -4
View File
@@ -360,7 +360,7 @@
move_delay = (old_move_delay + world.tick_lag > world.time) ? old_move_delay : world.time
//drunk driving
if(mob.confused && prob(25))
direct = pick(GLOB.cardinal)
direct = pick(GLOB.cardinals)
return mob.buckled_to.relaymove(mob,direct)
//TODO: Fuck wheelchairs.
@@ -376,7 +376,7 @@
min_move_delay = driver.min_walk_delay
//drunk wheelchair driving
if(mob.confused && prob(25))
direct = pick(GLOB.cardinal)
direct = pick(GLOB.cardinals)
move_delay += max((mob.movement_delay() + GLOB.config.walk_speed) * GLOB.config.walk_delay_multiplier, min_move_delay)
return mob.buckled_to.relaymove(mob,direct)
@@ -432,13 +432,13 @@
step(G.affecting, get_dir(G.affecting.loc, mob.loc))
if(mob.confused && prob(25) && mob.m_intent == M_RUN)
step(mob, pick(GLOB.cardinal))
step(mob, pick(GLOB.cardinals))
else
. = mob.SelfMove(new_loc, direct)
for (var/obj/item/grab/G in list(mob.l_hand, mob.r_hand))
if (G.state == GRAB_NECK)
mob.set_dir(GLOB.reverse_dir[direct])
mob.set_dir(REVERSE_DIR(direct))
G.adjust_position()
for (var/obj/item/grab/G in mob.grabbed_by)
+2 -2
View File
@@ -156,7 +156,7 @@
normalize_dir()
var/node1_dir
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
if(direction&initialize_directions)
if (!node1_dir)
node1_dir = direction
@@ -200,7 +200,7 @@
normalize_dir()
var/node1_dir
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
if(direction&initialize_directions)
if (!node1_dir)
node1_dir = direction
+4 -4
View File
@@ -258,7 +258,7 @@
var/obj/structure/stairs/staircase = locate() in target
var/target_dir = get_dir(mover, target)
if(!staircase && (target_dir != dir && target_dir != GLOB.reverse_dir[dir]))
if(!staircase && (target_dir != dir && target_dir != REVERSE_DIR(dir)))
INVOKE_ASYNC(src, PROC_REF(mob_fall), mover)
return ..()
@@ -437,7 +437,7 @@
return TRUE
if(mover.throwing)
return TRUE
if(get_dir(mover, target) == GLOB.reverse_dir[dir])
if(get_dir(mover, target) == REVERSE_DIR(dir))
return FALSE
if(height && (mover.dir == dir))
return FALSE
@@ -446,7 +446,7 @@
/obj/structure/platform/CheckExit(var/atom/movable/O, var/turf/target)
if(istype(O) && CanPass(O, target))
return TRUE
if(get_dir(O, target) == GLOB.reverse_dir[dir])
if(get_dir(O, target) == REVERSE_DIR(dir))
return FALSE
return TRUE
@@ -456,7 +456,7 @@
/// If the user is on the same turf as the platform, we're trying to go past it, so we need to use reverse_dir.
/// Otherwise, use our own turf.
var/same_turf = get_turf(user) == get_turf(src)
var/turf/next_turf = get_step(src, same_turf ? GLOB.reverse_dir[dir] : 0)
var/turf/next_turf = get_step(src, same_turf ? REVERSE_DIR(dir) : 0)
if(istype(next_turf) && !next_turf.density && can_climb(user))
var/climb_text = same_turf ? "over" : "down"
LAZYADD(climbers, user)
+1 -1
View File
@@ -78,6 +78,6 @@ var/list/moving_levels = list()
T.icon_state = "speedspace_[gen_dir]_[rand(1,15)]"
for(var/atom/movable/AM in T)
if (AM.simulated && !AM.anchored)
AM.throw_at(get_step(T,reverse_direction(direction)), 5, 1)
AM.throw_at(get_step(T,REVERSE_DIR(direction)), 5, 1)
CHECK_TICK
CHECK_TICK
@@ -80,7 +80,7 @@
AddOverlays(resource_indicator)
if(LAZYLEN(decals))
AddOverlays(decals)
for(var/direction in GLOB.cardinal)
for(var/direction in GLOB.cardinals)
var/turf/turf_to_check = get_step(src,direction)
if(!istype(turf_to_check, type))
var/image/rock_side = image(icon, "edge[pick(0,1,2)]", dir = turn(direction, 180))
@@ -51,5 +51,5 @@
icon_state = "drift"
/obj/effect/floor_decal/dune/random/Initialize(mapload, newdir, newcolour, bypass, set_icon_state)
supplied_dir = pick(GLOB.cardinal)
supplied_dir = pick(GLOB.cardinals)
. = ..()

Some files were not shown because too many files have changed in this diff Show More