mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 12:35:33 +01:00
[MIRROR] Diagonal macro thingu (#407)
* Diagonal macro thingu (#52927) * Diagonal macro thingu Co-authored-by: TiviPlus <57223640+TiviPlus@users.noreply.github.com>
This commit is contained in:
@@ -191,3 +191,17 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
|
||||
// This skillchip is incompatible with the Chameleon skillchip and cannot be copied.
|
||||
// If you want to blacklist an abstract path such a /obj/item/skillchip/job then look at the blacklist in /datum/action/item_action/chameleon/change/skillchip
|
||||
#define SKILLCHIP_CHAMELEON_INCOMPATIBLE (1<<2)
|
||||
|
||||
//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)
|
||||
|
||||
@@ -359,7 +359,7 @@ Turf and target are separate in case you want to teleport some distance from a t
|
||||
x = world.maxx
|
||||
else if(direction & WEST)
|
||||
x = 1
|
||||
if(direction in GLOB.diagonals) //let's make sure it's accurately-placed for diagonals
|
||||
if(ISDIAGONALDIR(direction)) //let's make sure it's accurately-placed for diagonals
|
||||
var/lowest_distance_to_map_edge = min(abs(x - A.x), abs(y - A.y))
|
||||
return get_ranged_target_turf(A, direction, lowest_distance_to_map_edge)
|
||||
return locate(x,y,A.z)
|
||||
|
||||
@@ -119,7 +119,7 @@ Buildable meters
|
||||
|
||||
/obj/item/pipe/trinary/flippable/fixed_dir()
|
||||
. = dir
|
||||
if(dir in GLOB.diagonals)
|
||||
if(ISDIAGONALDIR(dir))
|
||||
. = turn(dir, 45)
|
||||
|
||||
/obj/item/pipe/attack_self(mob/user)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
var/splatter_type = "splatter"
|
||||
|
||||
/obj/effect/temp_visual/dir_setting/bloodsplatter/Initialize(mapload, set_dir)
|
||||
if(set_dir in GLOB.diagonals)
|
||||
if(ISDIAGONALDIR(set_dir))
|
||||
icon_state = "[splatter_type][pick(1, 2, 6)]"
|
||||
else
|
||||
icon_state = "[splatter_type][pick(3, 4, 5)]"
|
||||
|
||||
@@ -123,7 +123,7 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list(
|
||||
var/i = 0
|
||||
for(var/dir in dirs)
|
||||
var/numdir = text2num(dir)
|
||||
var/flipped = ((dirtype == PIPE_TRIN_M) || (dirtype == PIPE_UNARY_FLIPPABLE)) && (numdir in GLOB.diagonals)
|
||||
var/flipped = ((dirtype == PIPE_TRIN_M) || (dirtype == PIPE_UNARY_FLIPPABLE)) && (ISDIAGONALDIR(numdir))
|
||||
row["previews"] += list(list("selected" = (numdir == selected_dir), "dir" = dir2text(numdir), "dir_name" = dirs[dir], "icon_state" = icon_state, "flipped" = flipped))
|
||||
if(i++ || dirtype == PIPE_ONEDIR)
|
||||
rows += list(row)
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
|
||||
/obj/structure/transit_tube/proc/generate_tube_overlays()
|
||||
for(var/direction in tube_dirs)
|
||||
if(direction in GLOB.diagonals)
|
||||
if(ISDIAGONALDIR(direction))
|
||||
if(direction & NORTH)
|
||||
create_tube_overlay(direction ^ 3, NORTH)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
pipe_state = "he"
|
||||
|
||||
/obj/machinery/atmospherics/pipe/heat_exchanging/simple/SetInitDirections()
|
||||
if(dir in GLOB.diagonals)
|
||||
if(ISDIAGONALDIR(dir))
|
||||
initialize_directions = dir
|
||||
return
|
||||
switch(dir)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
pipe_state = "simple"
|
||||
|
||||
/obj/machinery/atmospherics/pipe/simple/SetInitDirections()
|
||||
if(dir in GLOB.diagonals)
|
||||
if(ISDIAGONALDIR(dir))
|
||||
initialize_directions = dir
|
||||
return
|
||||
switch(dir)
|
||||
|
||||
@@ -1041,7 +1041,7 @@ Pass a positive integer as an argument to override a bot's default speed.
|
||||
var/turf/prevprevT = path[i - 2]
|
||||
var/prevDir = get_dir(prevprevT, prevT)
|
||||
var/mixDir = direction|prevDir
|
||||
if(mixDir in GLOB.diagonals)
|
||||
if(ISDIAGONALDIR(mixDir))
|
||||
prevI.dir = mixDir
|
||||
if(prevDir & (NORTH|SOUTH))
|
||||
var/matrix/ntransform = matrix()
|
||||
|
||||
@@ -456,7 +456,7 @@
|
||||
EscapeConfinement()
|
||||
var/dir_to_target = get_dir(targets_from, target)
|
||||
var/dir_list = list()
|
||||
if(dir_to_target in GLOB.diagonals) //it's diagonal, so we need two directions to hit
|
||||
if(ISDIAGONALDIR(dir_to_target)) //it's diagonal, so we need two directions to hit
|
||||
for(var/direction in GLOB.cardinals)
|
||||
if(direction & dir_to_target)
|
||||
dir_list += direction
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
return
|
||||
|
||||
var/splatter_icon_state
|
||||
if(set_dir in GLOB.diagonals)
|
||||
if(ISDIAGONALDIR(set_dir))
|
||||
splatter_icon_state = "splatter[pick(1, 2, 6)]"
|
||||
else
|
||||
splatter_icon_state = "splatter[pick(3, 4, 5)]"
|
||||
|
||||
@@ -31,7 +31,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
|
||||
|
||||
/obj/machinery/conveyor/inverted/Initialize(mapload)
|
||||
. = ..()
|
||||
if(mapload && !(dir in GLOB.diagonals))
|
||||
if(mapload && !(ISDIAGONALDIR(dir)))
|
||||
log_mapping("[src] at [AREACOORD(src)] spawned without using a diagonal dir. Please replace with a normal version.")
|
||||
|
||||
// Auto conveyour is always on unless unpowered
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
var/initialize_dirs = initial(temp.initialize_dirs)
|
||||
var/dpdir = NONE
|
||||
|
||||
if(dir in GLOB.diagonals) // Bent pipes
|
||||
if(ISDIAGONALDIR(dir)) // Bent pipes
|
||||
return dir
|
||||
|
||||
if(initialize_dirs != DISP_DIR_NONE)
|
||||
@@ -93,7 +93,7 @@
|
||||
if(rotation_type == ROTATION_FLIP)
|
||||
var/obj/structure/disposalpipe/temp = pipe_type
|
||||
if(initial(temp.flip_type))
|
||||
if(dir in GLOB.diagonals) // Fix RPD-induced diagonal turning
|
||||
if(ISDIAGONALDIR(dir)) // Fix RPD-induced diagonal turning
|
||||
setDir(turn(dir, 45))
|
||||
pipe_type = initial(temp.flip_type)
|
||||
update_icon()
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
else
|
||||
stored = new /obj/structure/disposalconstruct(src, null , SOUTH , FALSE , src)
|
||||
|
||||
if(dir in GLOB.diagonals) // Bent pipes already have all the dirs set
|
||||
if(ISDIAGONALDIR(dir)) // Bent pipes already have all the dirs set
|
||||
initialize_dirs = NONE
|
||||
|
||||
if(initialize_dirs != DISP_DIR_NONE)
|
||||
|
||||
Reference in New Issue
Block a user