diff --git a/code/__DEFINES/directional.dm b/code/__DEFINES/directional.dm index bfde544b447..83d8ce01d0a 100644 --- a/code/__DEFINES/directional.dm +++ b/code/__DEFINES/directional.dm @@ -13,6 +13,18 @@ /// West direction as a string "[8]" #define TEXT_WEST "[WEST]" +//dir macros +///Returns true if the dir is diagonal, false otherwise +#define ISDIAGONALDIR(d) (d&(d-1)) +///True if the dir is north or south, false therwise +#define NSCOMPONENT(d) (d&(NORTH|SOUTH)) +///True if the dir is east/west, false otherwise +#define EWCOMPONENT(d) (d&(EAST|WEST)) +///Flips the dir for north/south directions +#define NSDIRFLIP(d) (d^(NORTH|SOUTH)) +///Flips the dir for east/west directions +#define EWDIRFLIP(d) (d^(EAST|WEST)) + /// Inverse direction, taking into account UP|DOWN if necessary. #define REVERSE_DIR(dir) ( ((dir & 85) << 1) | ((dir & 170) >> 1) ) diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index 51a177b08ea..bb49452d250 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -255,20 +255,6 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 // This skillchip is incompatible with other skillchips from the incompatible_category list. #define SKILLCHIP_RESTRICTED_CATEGORIES (1<<1) -//dir macros -///Returns true if the dir is diagonal, false otherwise -#define ISDIAGONALDIR(d) (d&(d-1)) -///True if the dir is north or south, false therwise -#define NSCOMPONENT(d) (d&(NORTH|SOUTH)) -///True if the dir is east/west, false otherwise -#define EWCOMPONENT(d) (d&(EAST|WEST)) -///Flips the dir for north/south directions -#define NSDIRFLIP(d) (d^(NORTH|SOUTH)) -///Flips the dir for east/west directions -#define EWDIRFLIP(d) (d^(EAST|WEST)) -///Turns the dir by 180 degrees -#define DIRFLIP(d) turn(d, 180) - #define MAX_BITFIELD_SIZE 24 /// 33554431 (2^24 - 1) is the maximum value our bitflags can reach. @@ -286,7 +272,6 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 /// Used to prevent important slowdowns from being abused by drugs like kronkaine #define IGNORE_SLOWDOWNS (1<<4) - // Spacevine-related flags /// Is the spacevine / flower bud heat resistant #define SPACEVINE_HEAT_RESISTANT (1 << 0) diff --git a/code/__HELPERS/areas.dm b/code/__HELPERS/areas.dm index 932df589e0c..59dbd733457 100644 --- a/code/__HELPERS/areas.dm +++ b/code/__HELPERS/areas.dm @@ -30,9 +30,9 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(/area/station/en if(!checkT) continue checked_turfs[sourceT] |= dir - checked_turfs[checkT] |= turn(dir, 180) + checked_turfs[checkT] |= REVERSE_DIR(dir) .[sourceT] |= dir - .[checkT] |= turn(dir, 180) + .[checkT] |= REVERSE_DIR(dir) if(break_if_found[checkT.type] || break_if_found[checkT.loc.type]) return FALSE var/static/list/cardinal_cache = list("[NORTH]"=TRUE, "[EAST]"=TRUE, "[SOUTH]"=TRUE, "[WEST]"=TRUE) diff --git a/code/__HELPERS/icon_smoothing.dm b/code/__HELPERS/icon_smoothing.dm index 6fa6903be2e..5f92c67a6fc 100644 --- a/code/__HELPERS/icon_smoothing.dm +++ b/code/__HELPERS/icon_smoothing.dm @@ -85,7 +85,7 @@ xxx xxx xxx for(var/dir in cardinals) var/left = turn(dir, 90) var/right = turn(dir, -90) - var/opposite = turn(dir, 180) + var/opposite = REVERSE_DIR(dir) // Need to encode diagonals here because it's possible, even if it is always false var/list/acceptable_adjacents = new /list(largest_dir) // Alright, what directions are acceptable to us @@ -123,7 +123,7 @@ xxx xxx xxx #define CAN_DIAGONAL_SMOOTH(border_obj, target, direction) (\ (target.smoothing_flags & SMOOTH_BORDER_OBJECT) ? \ GLOB.adjacent_direction_lookup[border_obj.dir][direction + 1]?[target.dir] : \ - (GLOB.adjacent_direction_lookup[border_obj.dir][direction + 1]) ? turn(direction, 180) : NONE \ + (GLOB.adjacent_direction_lookup[border_obj.dir][direction + 1]) ? REVERSE_DIR(direction) : NONE \ ) #define DEFAULT_UNDERLAY_ICON 'icons/turf/floors.dmi' @@ -412,7 +412,7 @@ xxx xxx xxx break set_adj_in_dir; \ /// Check that non border objects use to smooth against border objects /// Returns true if the smooth is acceptable, FALSE otherwise - #define BITMASK_ON_BORDER_CHECK(target, direction) (!(target.smoothing_flags & SMOOTH_BORDER_OBJECT) || CAN_DIAGONAL_SMOOTH(target, src, turn(direction, 180))) + #define BITMASK_ON_BORDER_CHECK(target, direction) (!(target.smoothing_flags & SMOOTH_BORDER_OBJECT) || CAN_DIAGONAL_SMOOTH(target, src, REVERSE_DIR(direction))) #define BORDER_FOUND(target, direction, direction_flag) new_junction |= CAN_DIAGONAL_SMOOTH(src, target, direction) // Border objects require an object as context, so we need a dummy. I'm sorry diff --git a/code/datums/components/plumbing/_plumbing.dm b/code/datums/components/plumbing/_plumbing.dm index a5341c67b3b..b140b003e6c 100644 --- a/code/datums/components/plumbing/_plumbing.dm +++ b/code/datums/components/plumbing/_plumbing.dm @@ -217,7 +217,7 @@ for(var/obj/machinery/duct/duct in get_step(parent, direction)) if(!(duct.duct_layer & ducting_layer)) continue - duct.remove_connects(turn(direction, 180)) + duct.remove_connects(REVERSE_DIR(direction)) duct.neighbours.Remove(parent) duct.update_appearance() @@ -302,7 +302,7 @@ /datum/component/plumbing/proc/direct_connect(datum/component/plumbing/plumbing, dir) if(!plumbing.active) return - var/opposite_dir = turn(dir, 180) + var/opposite_dir = REVERSE_DIR(dir) if(plumbing.demand_connects & opposite_dir && supply_connects & dir || plumbing.supply_connects & opposite_dir && demand_connects & dir) //make sure we arent connecting two supplies or demands var/datum/ductnet/net = new() net.add_plumber(src, dir) diff --git a/code/datums/components/shuttle_cling.dm b/code/datums/components/shuttle_cling.dm index 70216bf9f80..63e11947b6e 100644 --- a/code/datums/components/shuttle_cling.dm +++ b/code/datums/components/shuttle_cling.dm @@ -142,11 +142,11 @@ var/side_dir = hyperloop.direction - direction if(is_tile_solid(get_step(clinger, side_dir))) - hyperloop.direction = direction + turn(side_dir, 180) //We're bumping a wall to the side, so switch to the other side_dir (yes this adds pingpong protocol) + hyperloop.direction = direction + REVERSE_DIR(side_dir) //We're bumping a wall to the side, so switch to the other side_dir (yes this adds pingpong protocol) return //Get the directions from the side of our current drift direction (so if we have drift south, get all cardinals and remove north and south, leaving only east and west) - var/side_dirs = shuffle(GLOB.cardinals - direction - turn(direction, 180)) + var/side_dirs = shuffle(GLOB.cardinals - direction - REVERSE_DIR(direction)) //We check if one side is solid if(!is_tile_solid(get_step(clinger, side_dirs[1]))) diff --git a/code/datums/diseases/advance/symptoms/sneeze.dm b/code/datums/diseases/advance/symptoms/sneeze.dm index 85f5c2d58b7..538decba24b 100644 --- a/code/datums/diseases/advance/symptoms/sneeze.dm +++ b/code/datums/diseases/advance/symptoms/sneeze.dm @@ -59,7 +59,7 @@ affected_mob.emote("sneeze") to_chat(affected_mob, span_userdanger("You are launched violently backwards by an all-mighty sneeze!")) var/sneeze_distance = rand(2,4) //twice as far as a normal baseball bat strike will fling you - var/turf/target = get_ranged_target_turf(affected_mob, turn(affected_mob.dir, 180), sneeze_distance) + var/turf/target = get_ranged_target_turf(affected_mob, REVERSE_DIR(affected_mob.dir), sneeze_distance) affected_mob.throw_at(target, sneeze_distance, rand(1,4)) //with the wounds update, sneezing at 7 speed was causing peoples bones to spontaneously explode, turning cartoonish sneezing into a nightmarishly lethal GBS 2.0 outbreak else if(COOLDOWN_FINISHED(src, sneeze_cooldown) || !COOLDOWN_FINISHED(src, sneeze_cooldown) && prob(60) && !off_cooldown_sneezed) affected_mob.emote("sneeze") diff --git a/code/datums/elements/knockback.dm b/code/datums/elements/knockback.dm index 59dd82b678f..2ad669f9892 100644 --- a/code/datums/elements/knockback.dm +++ b/code/datums/elements/knockback.dm @@ -67,7 +67,7 @@ if(throwee.anchored && !throw_anchored) return if(throw_distance < 0) - throw_dir = turn(throw_dir, 180) + throw_dir = REVERSE_DIR(throw_dir) throw_distance *= -1 var/atom/throw_target = get_edge_target_turf(throwee, throw_dir) throwee.safe_throw_at(throw_target, throw_distance, 1, thrower, gentle = throw_gentle) diff --git a/code/datums/mergers/_merger.dm b/code/datums/mergers/_merger.dm index 1ee6cc4cfc3..8014b6419fc 100644 --- a/code/datums/mergers/_merger.dm +++ b/code/datums/mergers/_merger.dm @@ -131,7 +131,7 @@ /datum/merger/proc/check_turf(turf/location, list/found_turfs, asking_from) var/found_something = FALSE // if asking_from is invalid (like if it's 0), we get a random output. that's bad, let's check for falsyness - var/us_to_them = asking_from && turn(asking_from, 180) + var/us_to_them = asking_from && REVERSE_DIR(asking_from) if(found_turfs[location]) found_turfs[location][MERGE_TURF_PACKET_DIR] |= us_to_them diff --git a/code/datums/mutations/body.dm b/code/datums/mutations/body.dm index a922725b113..094e650fe33 100644 --- a/code/datums/mutations/body.dm +++ b/code/datums/mutations/body.dm @@ -90,7 +90,7 @@ owner.emote("cough") if(GET_MUTATION_POWER(src) > 1) var/cough_range = GET_MUTATION_POWER(src) * 4 - var/turf/target = get_ranged_target_turf(owner, turn(owner.dir, 180), cough_range) + var/turf/target = get_ranged_target_turf(owner, REVERSE_DIR(owner.dir), cough_range) owner.throw_at(target, cough_range, GET_MUTATION_POWER(src)) /datum/mutation/human/paranoia diff --git a/code/datums/mutations/fire_breath.dm b/code/datums/mutations/fire_breath.dm index 97e5459f82c..f8631761ba2 100644 --- a/code/datums/mutations/fire_breath.dm +++ b/code/datums/mutations/fire_breath.dm @@ -67,7 +67,7 @@ // When casting, throw the caster backwards a few tiles. var/original_dir = living_cast_on.dir living_cast_on.throw_at( - get_edge_target_turf(living_cast_on, turn(living_cast_on.dir, 180)), + get_edge_target_turf(living_cast_on, REVERSE_DIR(living_cast_on.dir)), range = self_throw_range, speed = 2, gentle = TRUE, diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm index 994ea6f85fc..400b0be5d3b 100644 --- a/code/datums/wires/airlock.dm +++ b/code/datums/wires/airlock.dm @@ -148,7 +148,7 @@ if(WIRE_UNRESTRICTED_EXIT) // Pulse to switch the direction around by 180 degrees (North goes to South, East goes to West, vice-versa) if(!A.unres_sensor) //only works if the "sensor" is installed (a variable that we assign to the door either upon creation of a door with unrestricted directions or if an unrestricted helper is added to a door in mapping) return - A.unres_sides = DIRFLIP(A.unres_sides) + A.unres_sides = REVERSE_DIR(A.unres_sides) A.update_appearance() /obj/machinery/door/airlock/proc/reset_ai_wire() diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 075dacb744c..a67a2931fbe 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -1010,7 +1010,7 @@ */ /atom/proc/hitby_react(atom/movable/harmed_atom) if(harmed_atom && isturf(harmed_atom.loc)) - step(harmed_atom, turn(harmed_atom.dir, 180)) + step(harmed_atom, REVERSE_DIR(harmed_atom.dir)) ///Handle the atom being slipped over /atom/proc/handle_slip(mob/living/carbon/slipped_carbon, knockdown_amount, obj/slipping_object, lube, paralyze, force_drop) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 59cbbb205e5..182556550df 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -417,7 +417,7 @@ /obj/machinery/door/window/unrestricted_side(mob/opener) if(get_turf(opener) == loc) - return turn(dir,180) & unres_sides + return REVERSE_DIR(dir) & unres_sides return ..() /obj/machinery/door/window/try_to_crowbar(obj/item/I, mob/user, forced = FALSE) diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index 33837f79d05..79b421fa8de 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -154,7 +154,7 @@ Buildable meters do_a_flip() /obj/item/pipe/proc/do_a_flip() - setDir(turn(dir, -180)) + setDir(REVERSE_DIR(dir)) /obj/item/pipe/trinary/flippable/do_a_flip() setDir(turn(dir, flipped ? 45 : -45)) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index 17c7bab6c15..0e53fa8e36c 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -368,7 +368,7 @@ var/turf/T = loc var/obj/machinery/power/shieldwallgen/G var/steps = 0 - var/opposite_direction = turn(direction, 180) + var/opposite_direction = REVERSE_DIR(direction) for(var/i in 1 to shield_range) //checks out to 8 tiles away for another generator T = get_step(T, direction) diff --git a/code/game/objects/items/extinguisher.dm b/code/game/objects/items/extinguisher.dm index c52b836a706..9e683883a3c 100644 --- a/code/game/objects/items/extinguisher.dm +++ b/code/game/objects/items/extinguisher.dm @@ -205,10 +205,10 @@ if(user.buckled && isobj(user.buckled) && !user.buckled.anchored) var/obj/B = user.buckled - var/movementdirection = turn(direction,180) + var/movementdirection = REVERSE_DIR(direction) addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/item/extinguisher, move_chair), B, movementdirection), 1) else - user.newtonian_move(turn(direction, 180)) + user.newtonian_move(REVERSE_DIR(direction)) //Get all the turfs that can be shot at var/turf/T = get_turf(target) diff --git a/code/game/objects/items/rcd/RCL.dm b/code/game/objects/items/rcd/RCL.dm index a3c1a0b48f3..9134a7ac1e5 100644 --- a/code/game/objects/items/rcd/RCL.dm +++ b/code/game/objects/items/rcd/RCL.dm @@ -208,7 +208,7 @@ return //If we've run out, display message and exit else last = null - last = loaded.place_turf(get_turf(src), user, turn(user.dir, 180)) + last = loaded.place_turf(get_turf(src), user, REVERSE_DIR(user.dir)) is_empty(user) //If we've run out, display message update_appearance() diff --git a/code/game/objects/items/weaponry.dm b/code/game/objects/items/weaponry.dm index 00772a86c42..9ce0a4492ef 100644 --- a/code/game/objects/items/weaponry.dm +++ b/code/game/objects/items/weaponry.dm @@ -785,7 +785,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 angle = 270 if(target.dir & turn(target_to_user, 270)) angle = 90 - if(target.dir & turn(target_to_user, 180)) + if(target.dir & REVERSE_DIR(target_to_user)) angle = 180 if(target.dir & target_to_user) angle = 360 diff --git a/code/game/objects/obj_defense.dm b/code/game/objects/obj_defense.dm index 82a3b08e346..524c189acc6 100644 --- a/code/game/objects/obj_defense.dm +++ b/code/game/objects/obj_defense.dm @@ -28,7 +28,7 @@ playsound(src, P.hitsound, 50, TRUE) var/damage if(!QDELETED(src)) //Bullet on_hit effect might have already destroyed this object - damage = take_damage(P.damage * P.demolition_mod, P.damage_type, P.armor_flag, 0, turn(P.dir, 180), P.armour_penetration) + damage = take_damage(P.damage * P.demolition_mod, P.damage_type, P.armor_flag, 0, REVERSE_DIR(P.dir), P.armour_penetration) if(P.suppressed != SUPPRESSED_VERY) visible_message(span_danger("[src] is hit by \a [P][damage ? "" : ", without leaving a mark"]!"), null, null, COMBAT_MESSAGE_RANGE) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 925387aaa91..1c34e75c3d1 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -343,7 +343,7 @@ GLOBAL_LIST_EMPTY(objects_by_id_tag) /obj/handle_ricochet(obj/projectile/P) . = ..() if(. && receive_ricochet_damage_coeff) - take_damage(P.damage * receive_ricochet_damage_coeff, P.damage_type, P.armor_flag, 0, turn(P.dir, 180), P.armour_penetration) // pass along receive_ricochet_damage_coeff damage to the structure for the ricochet + take_damage(P.damage * receive_ricochet_damage_coeff, P.damage_type, P.armor_flag, 0, REVERSE_DIR(P.dir), P.armour_penetration) // pass along receive_ricochet_damage_coeff damage to the structure for the ricochet /// Handles exposing an object to reagents. /obj/expose_reagents(list/reagents, datum/reagents/source, methods=TOUCH, volume_modifier=1, show_message=TRUE) diff --git a/code/game/objects/structures/bedsheet_bin.dm b/code/game/objects/structures/bedsheet_bin.dm index 6133002b781..493268620a9 100644 --- a/code/game/objects/structures/bedsheet_bin.dm +++ b/code/game/objects/structures/bedsheet_bin.dm @@ -140,7 +140,7 @@ LINEN BINS // double check the canUseTopic args to make sure it's correct if(!istype(user) || !user.can_perform_action(src, NEED_DEXTERITY)) return - dir = turn(dir, 180) + dir = REVERSE_DIR(dir) /obj/item/bedsheet/blue icon_state = "sheetblue" diff --git a/code/game/objects/structures/fireplace.dm b/code/game/objects/structures/fireplace.dm index 33d37e9dd44..afd4d27efe6 100644 --- a/code/game/objects/structures/fireplace.dm +++ b/code/game/objects/structures/fireplace.dm @@ -34,7 +34,7 @@ /// We're offset back into the wall, account for that /obj/structure/fireplace/get_light_offset() var/list/hand_back = ..() - var/list/dir_offset = dir2offset(turn(dir, 180)) + var/list/dir_offset = dir2offset(REVERSE_DIR(dir)) hand_back[1] += dir_offset[1] * 0.5 hand_back[2] += dir_offset[2] * 0.5 return hand_back diff --git a/code/game/objects/structures/transit_tubes/station.dm b/code/game/objects/structures/transit_tubes/station.dm index 98348158285..b04d9803569 100644 --- a/code/game/objects/structures/transit_tubes/station.dm +++ b/code/game/objects/structures/transit_tubes/station.dm @@ -182,7 +182,7 @@ tube_dirs = list(NORTH, SOUTH) if(WEST) tube_dirs = list(NORTH, SOUTH) - boarding_dir = turn(dir, 180) + boarding_dir = REVERSE_DIR(dir) /obj/structure/transit_tube/station/flipped @@ -212,7 +212,7 @@ tube_dirs = list(SOUTH) if(WEST) tube_dirs = list(NORTH) - boarding_dir = turn(dir, 180) + boarding_dir = REVERSE_DIR(dir) /obj/structure/transit_tube/station/reverse/flipped icon_state = "closed_terminus1" @@ -291,7 +291,7 @@ tube_dirs = list(SOUTH) if(WEST) tube_dirs = list(NORTH) - boarding_dir = turn(dir, 180) + boarding_dir = REVERSE_DIR(dir) /obj/structure/transit_tube/station/dispenser/reverse/flipped icon_state = "open_terminusdispenser1" diff --git a/code/game/objects/structures/transit_tubes/transit_tube.dm b/code/game/objects/structures/transit_tubes/transit_tube.dm index afb7cab911c..d7b463122ff 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube.dm @@ -61,7 +61,7 @@ /obj/structure/transit_tube/proc/has_entrance(from_dir) - from_dir = turn(from_dir, 180) + from_dir = REVERSE_DIR(from_dir) for(var/direction in tube_dirs) if(direction == from_dir) diff --git a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm index 414e4172106..32a9e6293ed 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm @@ -154,7 +154,7 @@ var/obj/structure/transit_tube/TT = locate(/obj/structure/transit_tube) in loc //landed on a turf without transit tube or not in our direction - if(!TT || (!(dir in TT.tube_dirs) && !(turn(dir,180) in TT.tube_dirs))) + if(!TT || (!(dir in TT.tube_dirs) && !(REVERSE_DIR(dir) in TT.tube_dirs))) outside_tube() /obj/structure/transit_tube_pod/proc/outside_tube() @@ -187,7 +187,7 @@ for(var/obj/structure/transit_tube/station/station in loc) if(station.pod_moving) return - if(direction == turn(station.boarding_dir,180)) + if(direction == REVERSE_DIR(station.boarding_dir)) if(station.open_status == STATION_TUBE_OPEN) user.forceMove(loc) update_appearance() diff --git a/code/game/turfs/closed/walls.dm b/code/game/turfs/closed/walls.dm index c44361cc074..4b8a3883366 100644 --- a/code/game/turfs/closed/walls.dm +++ b/code/game/turfs/closed/walls.dm @@ -44,7 +44,7 @@ return if(!carbon_mob.density) return - var/turf/checked_turf = get_step(carbon_mob, turn(carbon_mob.dir, 180)) + var/turf/checked_turf = get_step(carbon_mob, REVERSE_DIR(carbon_mob.dir)) if(checked_turf == src) carbon_mob.start_leaning(src) diff --git a/code/game/turfs/open/space/transit.dm b/code/game/turfs/open/space/transit.dm index c10485cb8b0..21ecbcb45b2 100644 --- a/code/game/turfs/open/space/transit.dm +++ b/code/game/turfs/open/space/transit.dm @@ -37,7 +37,7 @@ SIGNAL_HANDLER if(enterer && !HAS_TRAIT(enterer, TRAIT_HYPERSPACED)) - enterer.AddComponent(/datum/component/shuttle_cling, turn(dir, 180)) + enterer.AddComponent(/datum/component/shuttle_cling, REVERSE_DIR(dir)) /turf/open/space/transit/proc/initialize_drifting_but_from_initialize(atom/movable/location, atom/movable/enterer, mapload) SIGNAL_HANDLER diff --git a/code/modules/admin/fun_balloon.dm b/code/modules/admin/fun_balloon.dm index cdef9b9194c..979e51bd5a1 100644 --- a/code/modules/admin/fun_balloon.dm +++ b/code/modules/admin/fun_balloon.dm @@ -142,7 +142,7 @@ for (var/S in SSshuttle.stationary_docking_ports) var/obj/docking_port/stationary/SM = S if (SM.shuttle_id == "emergency_home") - var/new_dir = turn(SM.dir, 180) + var/new_dir = REVERSE_DIR(SM.dir) SM.forceMove(get_ranged_target_turf(SM, new_dir, crash_strength)) break diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index 9abe656349d..705b88b96bd 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -126,7 +126,7 @@ GLOBAL_LIST_EMPTY(dirty_vars) if(!(locate(/obj/structure/grille) in T)) var/window_check = 0 for(var/obj/structure/window/W in T) - if (W.dir == turn(C1.dir,180) || (W.dir in list(NORTHEAST,SOUTHEAST,NORTHWEST,SOUTHWEST)) ) + if (W.dir == REVERSE_DIR(C1.dir) || (W.dir in list(NORTHEAST,SOUTHEAST,NORTHWEST,SOUTHWEST)) ) window_check = 1 break if(!window_check) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/binary_devices.dm b/code/modules/atmospherics/machinery/components/binary_devices/binary_devices.dm index 1e02b9b8537..b26f0c028d1 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/binary_devices.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/binary_devices.dm @@ -16,7 +16,7 @@ initialize_directions = EAST|WEST /obj/machinery/atmospherics/components/binary/get_node_connects() - return list(turn(dir, 180), dir) + return list(REVERSE_DIR(dir), dir) /** * Used by binary devices to set what the offset will be for each layer, called in update_icon_nopipes() diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_main_processes.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_main_processes.dm index 325ae083dad..5062ec7731f 100644 --- a/code/modules/atmospherics/machinery/components/fusion/hfr_main_processes.dm +++ b/code/modules/atmospherics/machinery/components/fusion/hfr_main_processes.dm @@ -468,7 +468,7 @@ if(moderator_list[/datum/gas/bz] < (150 / power_level)) return var/obj/machinery/hypertorus/corner/picked_corner = pick(corners) - picked_corner.loc.fire_nuclear_particle(turn(picked_corner.dir, 180)) + picked_corner.loc.fire_nuclear_particle(REVERSE_DIR(picked_corner.dir)) /obj/machinery/atmospherics/components/unary/hypertorus/core/proc/check_lightning_arcs(moderator_list) if(power_level < 4) diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm index ee766732846..ec6bc0caaa6 100644 --- a/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm +++ b/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm @@ -181,7 +181,7 @@ /obj/machinery/hypertorus/interface/multitool_act(mob/living/user, obj/item/I) . = ..() - var/turf/T = get_step(src,turn(dir,180)) + var/turf/T = get_step(src,REVERSE_DIR(dir)) var/obj/machinery/atmospherics/components/unary/hypertorus/core/centre = locate() in T if(!centre || !centre.check_part_connectivity()) diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_procs.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_procs.dm index d1e2479d2a8..1097a2a031a 100644 --- a/code/modules/atmospherics/machinery/components/fusion/hfr_procs.dm +++ b/code/modules/atmospherics/machinery/components/fusion/hfr_procs.dm @@ -38,7 +38,7 @@ corners |= object continue - if(get_step(object,turn(object.dir,180)) != loc) + if(get_step(object,REVERSE_DIR(object.dir)) != loc) . = FALSE if(istype(object,/obj/machinery/hypertorus/interface)) @@ -53,7 +53,7 @@ if(object.panel_open) . = FALSE - if(get_step(object,turn(object.dir,180)) != loc) + if(get_step(object,REVERSE_DIR(object.dir)) != loc) . = FALSE if(istype(object,/obj/machinery/atmospherics/components/unary/hypertorus/fuel_input)) diff --git a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm index 59e9cbec8fb..b71dc05d776 100644 --- a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm +++ b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm @@ -101,7 +101,7 @@ cut_overlays() var/mutable_appearance/pipe_appearance1 = mutable_appearance('icons/obj/pipes_n_cables/pipe_underlays.dmi', "intact_[dir]_[piping_layer]", layer = GAS_SCRUBBER_LAYER) pipe_appearance1.color = COLOR_LIME - var/mutable_appearance/pipe_appearance2 = mutable_appearance('icons/obj/pipes_n_cables/pipe_underlays.dmi', "intact_[turn(dir, 180)]_[piping_layer]", layer = GAS_SCRUBBER_LAYER) + var/mutable_appearance/pipe_appearance2 = mutable_appearance('icons/obj/pipes_n_cables/pipe_underlays.dmi', "intact_[REVERSE_DIR(dir)]_[piping_layer]", layer = GAS_SCRUBBER_LAYER) pipe_appearance2.color = COLOR_MOSTLY_PURE_RED . += pipe_appearance1 . += pipe_appearance2 diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm b/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm index a28ca1866b3..3d2c1d08995 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm @@ -40,13 +40,13 @@ Housekeeping and pipe network stuff //Node 3 is rest output //If we flip the filter, 1 and 3 shall exchange positions - var/node1_connect = turn(dir, -180) + var/node1_connect = REVERSE_DIR(dir) var/node2_connect = turn(dir, -90) var/node3_connect = dir if(flipped) - node1_connect = turn(node1_connect, 180) - node3_connect = turn(node3_connect, 180) + node1_connect = REVERSE_DIR(node1_connect) + node3_connect = REVERSE_DIR(node3_connect) return list(node1_connect, node2_connect, node3_connect) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm index 5c6cacb5518..db6499c04e6 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm @@ -38,7 +38,7 @@ var/obj/machinery/atmospherics/components/unary/heat_exchanger/partner = partner_ref?.resolve() if(!partner) partner_ref = null - var/partner_connect = turn(dir,180) + var/partner_connect = REVERSE_DIR(dir) for(var/obj/machinery/atmospherics/components/unary/heat_exchanger/target in get_step(src,partner_connect)) if(target.dir & get_dir(src,target)) diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/junction.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/junction.dm index eb88d6a0f32..00ef058333a 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/junction.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/junction.dm @@ -23,7 +23,7 @@ initialize_directions = WEST|EAST /obj/machinery/atmospherics/pipe/heat_exchanging/junction/get_node_connects() - return list(turn(dir, 180), dir) + return list(REVERSE_DIR(dir), dir) /obj/machinery/atmospherics/pipe/heat_exchanging/junction/is_connectable(obj/machinery/atmospherics/target, given_layer, he_type_check) if(dir == get_dir(target, src)) diff --git a/code/modules/atmospherics/machinery/pipes/layermanifold.dm b/code/modules/atmospherics/machinery/pipes/layermanifold.dm index 6aecb625237..bdfbda9ba6c 100644 --- a/code/modules/atmospherics/machinery/pipes/layermanifold.dm +++ b/code/modules/atmospherics/machinery/pipes/layermanifold.dm @@ -84,7 +84,7 @@ nodes = list() for(var/iter in PIPING_LAYER_MIN to PIPING_LAYER_MAX) var/obj/machinery/atmospherics/foundfront = find_connecting(dir, iter) - var/obj/machinery/atmospherics/foundback = find_connecting(turn(dir, 180), iter) + var/obj/machinery/atmospherics/foundback = find_connecting(REVERSE_DIR(dir), iter) front_nodes += foundfront back_nodes += foundback if(foundfront && !QDELETED(foundfront)) diff --git a/code/modules/clothing/shoes/bananashoes.dm b/code/modules/clothing/shoes/bananashoes.dm index 0c280eb2f3b..75299ad828a 100644 --- a/code/modules/clothing/shoes/bananashoes.dm +++ b/code/modules/clothing/shoes/bananashoes.dm @@ -48,7 +48,7 @@ return if(bananium.use_amount_mat(material_per_banana, /datum/material/bananium)) - new banana_type(get_step(src, turn(wearer.dir, 180))) //honk + new banana_type(get_step(src, REVERSE_DIR(wearer.dir))) //honk return toggle_clowning_action() diff --git a/code/modules/events/immovable_rod/immovable_rod_event.dm b/code/modules/events/immovable_rod/immovable_rod_event.dm index 7be48db04a6..7c618a83a76 100644 --- a/code/modules/events/immovable_rod/immovable_rod_event.dm +++ b/code/modules/events/immovable_rod/immovable_rod_event.dm @@ -23,7 +23,7 @@ /datum/round_event/immovable_rod/start() var/startside = pick(GLOB.cardinals) - var/turf/end_turf = get_edge_target_turf(get_random_station_turf(), turn(startside, 180)) + var/turf/end_turf = get_edge_target_turf(get_random_station_turf(), REVERSE_DIR(startside)) var/turf/start_turf = spaceDebrisStartLoc(startside, end_turf.z) var/atom/rod = new /obj/effect/immovablerod(start_turf, end_turf, special_target, force_looping) announce_to_ghosts(rod) diff --git a/code/modules/mapping/space_management/space_transition.dm b/code/modules/mapping/space_management/space_transition.dm index df9396ceee1..dfb2d30f225 100644 --- a/code/modules/mapping/space_management/space_transition.dm +++ b/code/modules/mapping/space_management/space_transition.dm @@ -99,7 +99,7 @@ // If they don't, we'll make them wrap all the way around to the other side of the grid for(var/direction in GLOB.cardinals) var/dir = "[direction]" - var/inverse = "[turn(direction, 180)]" + var/inverse = "[REVERSE_DIR(direction)]" for(var/datum/space_level/level as anything in transition_levels) // If we have something in this dir that isn't just us, continue on if(level.neigbours[dir] && level.neigbours[dir] != level) diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 03ec725dc31..c125671bcbf 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -404,7 +404,7 @@ if((machine_stat & NOPOWER)) return var/image/ore_input = image(icon='icons/obj/doors/airlocks/station/overlays.dmi', icon_state="unres_[input_dir]") - var/image/ore_output = image(icon='icons/obj/doors/airlocks/station/overlays.dmi', icon_state="unres_[turn(input_dir, 180)]") + var/image/ore_output = image(icon='icons/obj/doors/airlocks/station/overlays.dmi', icon_state="unres_[REVERSE_DIR(input_dir)]") switch(input_dir) if(NORTH) diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index bafd98b8873..bb12f595c3a 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -360,7 +360,7 @@ break if(target_turf != target_shove_turf && !directional_blocked) //Make sure that we don't run the exact same check twice on the same tile for(var/obj/obj_content in target_shove_turf) - if(obj_content.flags_1 & ON_BORDER_1 && obj_content.dir == turn(shove_dir, 180) && obj_content.density) + if(obj_content.flags_1 & ON_BORDER_1 && obj_content.dir == REVERSE_DIR(shove_dir) && obj_content.density) directional_blocked = TRUE break diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 6ee99e10bc9..241447b8ad2 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1040,7 +1040,7 @@ else if(newdir == (EAST|WEST)) newdir = EAST if((newdir in GLOB.cardinals) && (prob(50))) - newdir = turn(get_dir(target_turf, start), 180) + newdir = REVERSE_DIR(get_dir(target_turf, start)) if(!blood_exists) new /obj/effect/decal/cleanable/trail_holder(start, get_static_viruses()) diff --git a/code/modules/mob/living/navigation.dm b/code/modules/mob/living/navigation.dm index b97a01b5592..44847a239c1 100644 --- a/code/modules/mob/living/navigation.dm +++ b/code/modules/mob/living/navigation.dm @@ -77,15 +77,15 @@ var/dir_1 = 0 var/dir_2 = 0 if(i == 1) - dir_2 = turn(angle2dir(get_angle(path[i+1], current_turf)), 180) + dir_2 = REVERSE_DIR(angle2dir(get_angle(path[i+1], current_turf))) else if(i == length(path)) - dir_2 = turn(angle2dir(get_angle(path[i-1], current_turf)), 180) + dir_2 = REVERSE_DIR(angle2dir(get_angle(path[i-1], current_turf))) else - dir_1 = turn(angle2dir(get_angle(path[i+1], current_turf)), 180) - dir_2 = turn(angle2dir(get_angle(path[i-1], current_turf)), 180) + dir_1 = REVERSE_DIR(angle2dir(get_angle(path[i+1], current_turf))) + dir_2 = REVERSE_DIR(angle2dir(get_angle(path[i-1], current_turf))) if(dir_1 > dir_2) dir_1 = dir_2 - dir_2 = turn(angle2dir(get_angle(path[i+1], current_turf)), 180) + dir_2 = REVERSE_DIR(angle2dir(get_angle(path[i+1], current_turf))) path_image.icon_state = "[dir_1]-[dir_2]" client.images += path_image client.navigation_images += path_image diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 1b37cb58452..25adeeef125 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -165,7 +165,7 @@ var/atom/movable/P = mob.pulling if(P && !ismob(P) && P.density) - mob.setDir(turn(mob.dir, 180)) + mob.setDir(REVERSE_DIR(mob.dir)) /** * Checks to see if you're being grabbed and if so attempts to break it @@ -301,7 +301,7 @@ // last pushoff exists for one reason // to ensure pushing a mob doesn't just lead to it considering us as backup, and failing last_pushoff = world.time - if(backup.newtonian_move(turn(movement_dir, 180), instant = TRUE)) //You're pushing off something movable, so it moves + if(backup.newtonian_move(REVERSE_DIR(movement_dir), instant = TRUE)) //You're pushing off something movable, so it moves // We set it down here so future calls to Process_Spacemove by the same pair in the same tick don't lead to fucky backup.last_pushoff = world.time to_chat(src, span_info("You push off of [backup] to propel yourself.")) diff --git a/code/modules/plumbing/ducts.dm b/code/modules/plumbing/ducts.dm index 0b5132d42fb..33073ae910f 100644 --- a/code/modules/plumbing/ducts.dm +++ b/code/modules/plumbing/ducts.dm @@ -86,7 +86,7 @@ All the important duct code: ///connect to a duct /obj/machinery/duct/proc/connect_duct(obj/machinery/duct/other, direction) - var/opposite_dir = turn(direction, 180) + var/opposite_dir = REVERSE_DIR(direction) if(!active || !other.active) return @@ -128,7 +128,7 @@ All the important duct code: ///connect to a plumbing object /obj/machinery/duct/proc/connect_plumber(datum/component/plumbing/plumbing, direction) - var/opposite_dir = turn(direction, 180) + var/opposite_dir = REVERSE_DIR(direction) if(!(duct_layer & plumbing.ducting_layer)) return FALSE @@ -182,7 +182,7 @@ All the important duct code: if(!(other in neighbours)) neighbours[other] = direction if(!(src in other.neighbours)) - other.neighbours[src] = turn(direction, 180) + other.neighbours[src] = REVERSE_DIR(direction) ///remove all our neighbours, and remove us from our neighbours aswell /obj/machinery/duct/proc/lose_neighbours() @@ -212,7 +212,7 @@ All the important duct code: for(var/direction in GLOB.cardinals) if(direction & connects) for(var/obj/machinery/duct/other in get_step(src, direction)) - if((turn(direction, 180) & other.connects) && other.active) + if((REVERSE_DIR(direction) & other.connects) && other.active) adjacents += other return adjacents diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 49bfeaa8564..0852eb41d32 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -106,7 +106,7 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri var/obj/machinery/power/smes/S = locate(/obj/machinery/power/smes) in TB if(S && (!S.terminal || S.terminal == search_parent)) continue - var/inverse = turn(check_dir, 180) + var/inverse = REVERSE_DIR(check_dir) for(var/obj/structure/cable/C in TB) if(C.cable_layer & cable_layer) linked_dirs |= check_dir @@ -122,7 +122,7 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri ///Clear the linked indicator bitflags /obj/structure/cable/proc/Disconnect_cable() for(var/check_dir in GLOB.cardinals) - var/inverse = turn(check_dir, 180) + var/inverse = REVERSE_DIR(check_dir) if(linked_dirs & check_dir) var/TB = get_step(loc, check_dir) for(var/obj/structure/cable/C in TB) @@ -274,7 +274,7 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri // merge with the powernets of power objects in the given direction /obj/structure/cable/proc/mergeConnectedNetworks(direction) - var/inverse_dir = (!direction)? 0 : turn(direction, 180) //flip the direction, to match with the source position on its turf + var/inverse_dir = (!direction)? 0 : REVERSE_DIR(direction) //flip the direction, to match with the source position on its turf var/turf/TB = get_step(src, direction) diff --git a/code/modules/power/lighting/light.dm b/code/modules/power/lighting/light.dm index 554403b1e5e..55fc135058b 100644 --- a/code/modules/power/lighting/light.dm +++ b/code/modules/power/lighting/light.dm @@ -112,7 +112,7 @@ RegisterSignal(SSdcs, COMSIG_GLOB_GREY_TIDE_LIGHT, PROC_REF(grey_tide)) //Only put the signal on station lights // Light projects out backwards from the dir of the light - set_light(l_dir = turn(dir, 180)) + set_light(l_dir = REVERSE_DIR(dir)) RegisterSignal(src, COMSIG_LIGHT_EATER_ACT, PROC_REF(on_light_eater)) AddElement(/datum/element/atmos_sensitive, mapload) return INITIALIZE_HINT_LATELOAD @@ -137,14 +137,14 @@ /obj/machinery/light/setDir(newdir) . = ..() - set_light(l_dir = turn(dir, 180)) + set_light(l_dir = REVERSE_DIR(dir)) // If we're adjacent to the source, we make this sorta indentation for our light to ensure it stays lit (and to make distances look right) // By shifting the light position we use forward a bit, towards something that isn't off by 0.5 from being in angle // Because angle calculation is kinda harsh it's hard to find a happy point between fulldark and fullbright for the corners behind the light. this is good enough tho /obj/machinery/light/get_light_offset() var/list/hand_back = ..() - var/list/dir_offset = dir2offset(turn(dir, 180)) + var/list/dir_offset = dir2offset(REVERSE_DIR(dir)) hand_back[1] += dir_offset[1] * 0.5 hand_back[2] += dir_offset[2] * 0.5 return hand_back diff --git a/code/modules/power/pipecleaners.dm b/code/modules/power/pipecleaners.dm index 8070fe626a7..f052913c2e7 100644 --- a/code/modules/power/pipecleaners.dm +++ b/code/modules/power/pipecleaners.dm @@ -384,7 +384,7 @@ By design, d1 is the smallest direction and d2 is the highest // pipe_cleaner is pointing at us, we're standing on an open tile // so create a stub pointing at the clicked pipe_cleaner on our tile - var/fdirn = turn(dirn, 180) // the opposite direction + var/fdirn = REVERSE_DIR(dirn) // the opposite direction for(var/obj/structure/pipe_cleaner/LC in U) // check to make sure there's not a pipe_cleaner there already if(LC.d1 == fdirn || LC.d2 == fdirn) diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 5521a151556..fdc193b9866 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -51,7 +51,7 @@ for(var/d in GLOB.cardinals) var/turf/T = get_step(src, d) for(var/obj/machinery/power/terminal/term in T) - if(term && term.dir == turn(d, 180)) + if(term && term.dir == REVERSE_DIR(d)) terminal = term break dir_loop @@ -97,7 +97,7 @@ terminal = null var/turf/T = get_step(src, dir) for(var/obj/machinery/power/terminal/term in T) - if(term && term.dir == turn(dir, 180)) + if(term && term.dir == REVERSE_DIR(dir)) terminal = term terminal.master = src to_chat(user, span_notice("Terminal found.")) diff --git a/code/modules/power/turbine/turbine.dm b/code/modules/power/turbine/turbine.dm index 29f5660d719..2888bedbd0e 100644 --- a/code/modules/power/turbine/turbine.dm +++ b/code/modules/power/turbine/turbine.dm @@ -257,7 +257,7 @@ compressor_work = 0 compressor_pressure = MINIMUM_TURBINE_PRESSURE if(QDELETED(input_turf)) - input_turf = get_step(loc, turn(dir, 180)) + input_turf = get_step(loc, REVERSE_DIR(dir)) var/datum/gas_mixture/input_turf_mixture = input_turf.return_air() if(!input_turf_mixture) @@ -452,19 +452,19 @@ //locate compressor & turbine, when checking we simply check to see if they are still there if(!check_only) - compressor = locate(/obj/machinery/power/turbine/inlet_compressor) in get_step(src, turn(dir, 180)) + compressor = locate(/obj/machinery/power/turbine/inlet_compressor) in get_step(src, REVERSE_DIR(dir)) turbine = locate(/obj/machinery/power/turbine/turbine_outlet) in get_step(src, dir) //maybe look for them the other way around. we want the rotor to allign with them either way for player convinience if(!compressor && !turbine) compressor = locate(/obj/machinery/power/turbine/inlet_compressor) in get_step(src, dir) - turbine = locate(/obj/machinery/power/turbine/turbine_outlet) in get_step(src, turn(dir, 180)) + turbine = locate(/obj/machinery/power/turbine/turbine_outlet) in get_step(src, REVERSE_DIR(dir)) //sanity checks for compressor if(QDELETED(compressor)) feedback(user, "missing compressor!") return (all_parts_connected = FALSE) - if(compressor.dir != dir && compressor.dir != turn(dir, 180)) //make sure it's not perpendicular to the rotor + if(compressor.dir != dir && compressor.dir != REVERSE_DIR(dir)) //make sure it's not perpendicular to the rotor feedback(user, "compressor not aligned with rotor!") return (all_parts_connected = FALSE) if(!compressor.can_connect) @@ -478,7 +478,7 @@ if(QDELETED(turbine)) feedback(user, "missing turbine!") return (all_parts_connected = FALSE) - if(turbine.dir != dir && turbine.dir != turn(dir, 180)) + if(turbine.dir != dir && turbine.dir != REVERSE_DIR(dir)) feedback(user, "turbine not aligned with rotor!") return (all_parts_connected = FALSE) if(!turbine.can_connect) diff --git a/code/modules/projectiles/guns/ballistic.dm b/code/modules/projectiles/guns/ballistic.dm index e39ed1ece03..5da546268ed 100644 --- a/code/modules/projectiles/guns/ballistic.dm +++ b/code/modules/projectiles/guns/ballistic.dm @@ -577,7 +577,7 @@ var/turf/T = get_turf(user) process_fire(user, user, FALSE, null, BODY_ZONE_HEAD) user.visible_message(span_suicide("[user] blows [user.p_their()] brain[user.p_s()] out with [src]!")) - var/turf/target = get_ranged_target_turf(user, turn(user.dir, 180), BRAINS_BLOWN_THROW_RANGE) + var/turf/target = get_ranged_target_turf(user, REVERSE_DIR(user.dir), BRAINS_BLOWN_THROW_RANGE) B.Remove(user) B.forceMove(T) var/datum/callback/gibspawner = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(spawn_atom_to_turf), /obj/effect/gibspawner/generic, B, 1, FALSE, user) diff --git a/code/modules/recycling/conveyor.dm b/code/modules/recycling/conveyor.dm index c630a4b140a..84173388518 100644 --- a/code/modules/recycling/conveyor.dm +++ b/code/modules/recycling/conveyor.dm @@ -136,7 +136,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) if(QDELETED(valid)) continue neighbors["[direction]"] = TRUE - valid.neighbors["[DIRFLIP(direction)]"] = TRUE + valid.neighbors["[REVERSE_DIR(direction)]"] = TRUE RegisterSignal(valid, COMSIG_MOVABLE_MOVED, PROC_REF(nearby_belt_changed), override=TRUE) RegisterSignal(valid, COMSIG_QDELETING, PROC_REF(nearby_belt_changed), override=TRUE) valid.RegisterSignal(src, COMSIG_MOVABLE_MOVED, PROC_REF(nearby_belt_changed), override=TRUE) diff --git a/code/modules/recycling/disposal/construction.dm b/code/modules/recycling/disposal/construction.dm index 381abd0850c..b1556ca679f 100644 --- a/code/modules/recycling/disposal/construction.dm +++ b/code/modules/recycling/disposal/construction.dm @@ -83,7 +83,7 @@ if(initialize_dirs & DISP_DIR_RIGHT) dpdir |= turn(dir, -90) if(initialize_dirs & DISP_DIR_FLIP) - dpdir |= turn(dir, 180) + dpdir |= REVERSE_DIR(dir) return dpdir /obj/structure/disposalconstruct/proc/AfterRotation(mob/user, degrees) diff --git a/code/modules/recycling/disposal/holder.dm b/code/modules/recycling/disposal/holder.dm index 69b7ca823c9..cf9ae8f6b4e 100644 --- a/code/modules/recycling/disposal/holder.dm +++ b/code/modules/recycling/disposal/holder.dm @@ -168,7 +168,7 @@ if(!T) return null - var/fdir = turn(dir, 180) // flip the movement direction + var/fdir = REVERSE_DIR(dir) // flip the movement direction for(var/obj/structure/disposalpipe/P in T) if(fdir & P.dpdir) // find pipe direction mask that matches flipped dir if(QDELING(P)) diff --git a/code/modules/recycling/disposal/pipe.dm b/code/modules/recycling/disposal/pipe.dm index e1a86274557..c5d60979c58 100644 --- a/code/modules/recycling/disposal/pipe.dm +++ b/code/modules/recycling/disposal/pipe.dm @@ -49,7 +49,7 @@ if(initialize_dirs & DISP_DIR_RIGHT) dpdir |= turn(dir, -90) if(initialize_dirs & DISP_DIR_FLIP) - dpdir |= turn(dir, 180) + dpdir |= REVERSE_DIR(dir) AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE) if(isturf(loc)) @@ -85,7 +85,7 @@ // returns the direction of the next pipe object, given the entrance dir // by default, returns the bitmask of remaining directions /obj/structure/disposalpipe/proc/nextdir(obj/structure/disposalholder/H) - return dpdir & (~turn(H.dir, 180)) + return dpdir & (~REVERSE_DIR(H.dir)) // transfer the holder through this pipe segment // overridden for special behaviour @@ -210,7 +210,7 @@ // if coming in from secondary dirs, then next is primary dir // if coming in from primary dir, then next is equal chance of other dirs /obj/structure/disposalpipe/junction/nextdir(obj/structure/disposalholder/H) - var/flipdir = turn(H.dir, 180) + var/flipdir = REVERSE_DIR(H.dir) if(flipdir != dir) // came from secondary dir, so exit through primary return dir diff --git a/code/modules/recycling/disposal/pipe_sorting.dm b/code/modules/recycling/disposal/pipe_sorting.dm index e5a8a5a12ec..90cd5832966 100644 --- a/code/modules/recycling/disposal/pipe_sorting.dm +++ b/code/modules/recycling/disposal/pipe_sorting.dm @@ -7,7 +7,7 @@ initialize_dirs = DISP_DIR_RIGHT | DISP_DIR_FLIP /obj/structure/disposalpipe/sorting/nextdir(obj/structure/disposalholder/H) - var/sortdir = dpdir & ~(dir | turn(dir, 180)) + var/sortdir = dpdir & ~(dir | REVERSE_DIR(dir)) if(H.dir != sortdir) // probably came from the negdir if(check_sorting(H)) // if destination matches filtered type... return sortdir // exit through sortdirection diff --git a/code/modules/research/ordnance/tank_compressor.dm b/code/modules/research/ordnance/tank_compressor.dm index 44d1505b086..85a2cf44836 100644 --- a/code/modules/research/ordnance/tank_compressor.dm +++ b/code/modules/research/ordnance/tank_compressor.dm @@ -86,7 +86,7 @@ return TRUE /obj/machinery/atmospherics/components/binary/circulator/get_node_connects() - return list(turn(dir, 180), dir) // airs[2] is input which is facing dir, airs[1] is output which is facing the other side of dir + return list(REVERSE_DIR(dir), dir) // airs[2] is input which is facing dir, airs[1] is output which is facing the other side of dir /obj/machinery/atmospherics/components/binary/tank_compressor/screwdriver_act(mob/living/user, obj/item/tool) if(active || inserted_tank) @@ -263,7 +263,7 @@ /obj/machinery/atmospherics/components/binary/tank_compressor/update_overlays() . = ..() . += get_pipe_image(icon, "[base_icon_state]-pipe", dir, COLOR_VIBRANT_LIME, piping_layer) - . += get_pipe_image(icon, "[base_icon_state]-pipe", turn(dir, 180), COLOR_RED, piping_layer) + . += get_pipe_image(icon, "[base_icon_state]-pipe", REVERSE_DIR(dir), COLOR_RED, piping_layer) if(!istype(inserted_tank)) . += mutable_appearance(icon, "[base_icon_state]-doors",) if(panel_open) diff --git a/code/modules/shuttle/docking.dm b/code/modules/shuttle/docking.dm index 62a7c0d66a9..1100fb0584d 100644 --- a/code/modules/shuttle/docking.dm +++ b/code/modules/shuttle/docking.dm @@ -49,7 +49,7 @@ rotation = SIMPLIFY_DEGREES(rotation) if(!movement_direction) - movement_direction = turn(preferred_direction, 180) + movement_direction = REVERSE_DIR(preferred_direction) var/list/moved_atoms = list() //Everything not a turf that gets moved in the shuttle var/list/areas_to_move = list() //unique assoc list of areas on turfs being moved diff --git a/code/modules/vehicles/mecha/equipment/tools/other_tools.dm b/code/modules/vehicles/mecha/equipment/tools/other_tools.dm index df80a13b6d0..f0da97cc85f 100644 --- a/code/modules/vehicles/mecha/equipment/tools/other_tools.dm +++ b/code/modules/vehicles/mecha/equipment/tools/other_tools.dm @@ -426,8 +426,8 @@ /obj/item/mecha_parts/mecha_equipment/thrusters/proc/generate_effect(movement_dir) var/obj/effect/particle_effect/E = new effect_type(get_turf(chassis)) - E.dir = turn(movement_dir, 180) - step(E, turn(movement_dir, 180)) + E.dir = REVERSE_DIR(movement_dir) + step(E, REVERSE_DIR(movement_dir)) QDEL_IN(E, 5) diff --git a/code/modules/vehicles/mecha/equipment/weapons/weapons.dm b/code/modules/vehicles/mecha/equipment/weapons/weapons.dm index 99a56a7d499..2fbe84101de 100644 --- a/code/modules/vehicles/mecha/equipment/weapons/weapons.dm +++ b/code/modules/vehicles/mecha/equipment/weapons/weapons.dm @@ -43,7 +43,7 @@ /obj/item/mecha_parts/mecha_equipment/weapon/action(mob/source, atom/target, list/modifiers) if(!action_checks(target)) return FALSE - var/newtonian_target = turn(chassis.dir,180) + var/newtonian_target = REVERSE_DIR(chassis.dir) . = ..()//start the cooldown early because of sleeps for(var/i in 1 to projectiles_per_shot) if(energy_drain && !chassis.has_charge(energy_drain))//in case we run out of energy mid-burst, such as emp diff --git a/code/modules/vehicles/mecha/mecha_movement.dm b/code/modules/vehicles/mecha/mecha_movement.dm index b8fb8f86e4e..eb7e517268e 100644 --- a/code/modules/vehicles/mecha/mecha_movement.dm +++ b/code/modules/vehicles/mecha/mecha_movement.dm @@ -44,7 +44,7 @@ if(!istype(backup) || !movement_dir || backup.anchored || continuous_move) //get_spacemove_backup() already checks if a returned turf is solid, so we can just go return TRUE last_pushoff = world.time - if(backup.newtonian_move(turn(movement_dir, 180), instant = TRUE)) + if(backup.newtonian_move(REVERSE_DIR(movement_dir), instant = TRUE)) backup.last_pushoff = world.time step_silent = TRUE if(return_drivers()) diff --git a/code/modules/vehicles/scooter.dm b/code/modules/vehicles/scooter.dm index 760420a6c1f..4e1f115e55c 100644 --- a/code/modules/vehicles/scooter.dm +++ b/code/modules/vehicles/scooter.dm @@ -115,7 +115,7 @@ grinding_mulitipler = 2 victim.Knockdown(4 * grinding_mulitipler SECONDS) else - var/backdir = turn(dir, 180) + var/backdir = REVERSE_DIR(dir) step(src, backdir) rider.spin(4, 1)