Skip to content

Commit

Permalink
redefine fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dageavtobusnick committed Dec 22, 2024
1 parent c6c0bfc commit e9dc3f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 54 deletions.
13 changes: 2 additions & 11 deletions code/__DEFINES/flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@
#define MOB_SPAWN_ALLOWED (1<<3)
/// If megafauna can be spawned by natural random generation
#define MEGAFAUNA_SPAWN_ALLOWED (1<<4)
/// If blobs can spawn there and if it counts towards their score.
#define BLOBS_ALLOWED (1<<5)

//ORGAN TYPE FLAGS
#define AFFECT_ROBOTIC_ORGAN 1
Expand Down Expand Up @@ -208,17 +210,6 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define MOBILITY_FLAGS_CARBON_DEFAULT (MOBILITY_MOVE|MOBILITY_STAND|MOBILITY_PICKUP|MOBILITY_USE|MOBILITY_UI|MOBILITY_STORAGE|MOBILITY_PULL|MOBILITY_REST|MOBILITY_LIEDOWN)
#define MOBILITY_FLAGS_REST_CAPABLE_DEFAULT (MOBILITY_MOVE|MOBILITY_STAND|MOBILITY_PICKUP|MOBILITY_USE|MOBILITY_UI|MOBILITY_STORAGE|MOBILITY_PULL|MOBILITY_REST|MOBILITY_LIEDOWN)

//AREA FLAGS
/// If mining tunnel generation is allowed in this area
#define CAVES_ALLOWED (1<<1)
/// If flora are allowed to spawn in this area randomly through tunnel generation
#define FLORA_ALLOWED (1<<2)
/// If mobs can be spawned by natural random generation
#define MOB_SPAWN_ALLOWED (1<<3)
/// If megafauna can be spawned by natural random generation
#define MEGAFAUNA_SPAWN_ALLOWED (1<<4)
/// If blobs can spawn there and if it counts towards their score.
#define BLOBS_ALLOWED (1<<5)

// timed_action_flags parameter for [/proc/do_after()]
/// Can do the action even if mob moves location.
Expand Down
43 changes: 0 additions & 43 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,49 +100,6 @@

#define in_range(source, user) (get_dist(source, user) <= 1)

#define RANGE_TURFS(RADIUS, CENTER) \
RECT_TURFS(RADIUS, RADIUS, CENTER)

#define RECT_TURFS(H_RADIUS, V_RADIUS, CENTER) \
block( \
max(CENTER.x - (H_RADIUS), 1), max(CENTER.y - (V_RADIUS), 1), CENTER.z, \
min(CENTER.x + (H_RADIUS), world.maxx), min(CENTER.y + (V_RADIUS), world.maxy), CENTER.z \
)

#define RANGE_TURFS_MULTIZ(RADIUS, CENTER, Z_MIN, Z_MAX) \
RECT_TURFS_MULTIZ(RADIUS, RADIUS, Z_MIN, Z_MAX, CENTER)

#define RECT_TURFS_MULTIZ(H_RADIUS, V_RADIUS, Z_MIN, Z_MAX, CENTER) \
block( \
max(CENTER.x - (H_RADIUS), 1), max(CENTER.y - (V_RADIUS), 1), Z_MIN, \
min(CENTER.x + (H_RADIUS), world.maxx), min(CENTER.y + (V_RADIUS), world.maxy), Z_MAX \
)

/// Returns the turfs on the edge of a square with CENTER in the middle and with the given RADIUS. If used near the edge of the map, will still work fine.
// order of the additions: top edge + bottom edge + left edge + right edge
#define RANGE_EDGE_TURFS(RADIUS, CENTER)\
(CENTER.y + RADIUS < world.maxy ? block(max(CENTER.x - RADIUS, 1), min(CENTER.y + RADIUS, world.maxy), CENTER.z, min(CENTER.x + RADIUS, world.maxx), min(CENTER.y + RADIUS, world.maxy), CENTER.z) : list()) +\
(CENTER.y - RADIUS > 1 ? block(max(CENTER.x - RADIUS, 1), max(CENTER.y - RADIUS, 1), CENTER.z, min(CENTER.x + RADIUS, world.maxx), max(CENTER.y - RADIUS, 1), CENTER.z) : list()) +\
(CENTER.x - RADIUS > 1 ? block(max(CENTER.x - RADIUS, 1), min(CENTER.y + RADIUS - 1, world.maxy), CENTER.z, max(CENTER.x - RADIUS, 1), max(CENTER.y - RADIUS + 1, 1), CENTER.z) : list()) +\
(CENTER.x + RADIUS < world.maxx ? block(min(CENTER.x + RADIUS, world.maxx), min(CENTER.y + RADIUS - 1, world.maxy), CENTER.z, min(CENTER.x + RADIUS, world.maxx), max(CENTER.y - RADIUS + 1, 1), CENTER.z) : list())

/// Returns a list of turfs in the rectangle specified by BOTTOM LEFT corner and height/width, checks for being outside the world border for you
#define CORNER_BLOCK(corner, width, height) CORNER_BLOCK_OFFSET(corner, width, height, 0, 0)

/// Returns a list of turfs similar to CORNER_BLOCK but with offsets
#define CORNER_BLOCK_OFFSET(corner, width, height, offset_x, offset_y) ((block(locate(corner.x + offset_x, corner.y + offset_y, corner.z), locate(min(corner.x + (width - 1) + offset_x, world.maxx), min(corner.y + (height - 1) + offset_y, world.maxy), corner.z))))

/// Returns an outline (neighboring turfs) of the given block
#define CORNER_OUTLINE(corner, width, height) ( \
CORNER_BLOCK_OFFSET(corner, width + 2, 1, -1, -1) + \
CORNER_BLOCK_OFFSET(corner, width + 2, 1, -1, height) + \
CORNER_BLOCK_OFFSET(corner, 1, height, -1, 0) + \
CORNER_BLOCK_OFFSET(corner, 1, height, width, 0))

/// Returns a list of around us
#define TURF_NEIGHBORS(turf) (CORNER_BLOCK_OFFSET(turf, 3, 3, -1, -1) - turf)


#define FOR_DVIEW(type, range, center, invis_flags) \
GLOB.dview_mob.loc = center; \
GLOB.dview_mob.set_invis_see(invis_flags); \
Expand Down
9 changes: 9 additions & 0 deletions code/__DEFINES/turfs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@
min(CENTER.x + (H_RADIUS), world.maxx), min(CENTER.y + (V_RADIUS), world.maxy), CENTER.z \
)

#define RANGE_TURFS_MULTIZ(RADIUS, CENTER, Z_MIN, Z_MAX) \
RECT_TURFS_MULTIZ(RADIUS, RADIUS, Z_MIN, Z_MAX, CENTER)

#define RECT_TURFS_MULTIZ(H_RADIUS, V_RADIUS, Z_MIN, Z_MAX, CENTER) \
block( \
max(CENTER.x - (H_RADIUS), 1), max(CENTER.y - (V_RADIUS), 1), Z_MIN, \
min(CENTER.x + (H_RADIUS), world.maxx), min(CENTER.y + (V_RADIUS), world.maxy), Z_MAX \
)

/// Returns the turfs on the edge of a square with CENTER in the middle and with the given RADIUS. If used near the edge of the map, will still work fine.
// order of the additions: top edge + bottom edge + left edge + right edge
#define RANGE_EDGE_TURFS(RADIUS, CENTER)\
Expand Down

0 comments on commit e9dc3f8

Please sign in to comment.