mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
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:
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ..()
|
||||
|
||||
@@ -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++)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ..()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user