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