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
+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)