Retrofit TG pathfinder with upstream improvements (#25583)

* Retrofit TG pathfinder with upstream improvements

* i know how things work

* don't use HAS_TRAIT for things that aren't traits

* unique filenames

* i'm just a goofy lil moron

* use new block syntax

* apparently values don't need clamping with new block syntax?

* silence invalid JPS dest runtime

* fix runtime passing ID instead of access list
This commit is contained in:
warriorstar-orion
2024-07-08 15:48:43 +00:00
committed by GitHub
parent 62dc3d57dd
commit ca93f6bc77
34 changed files with 1324 additions and 580 deletions
+25
View File
@@ -0,0 +1,25 @@
// Define set that decides how an atom will be scanned for astar things
/// If set, we make the assumption that CanPathfindPass() will NEVER return FALSE unless density is true
#define CANPATHFINDPASS_DENSITY 0
/// If this is set, we bypass density checks and always call the proc
#define CANPATHFINDPASS_ALWAYS_PROC 1
/**
* A helper macro to see if it's possible to step from the first turf into the second one, minding things like door access and directional windows.
* If you really want to optimize things, optimize this, cuz this gets called a lot.
* We do early next.density check despite it being already checked in LinkBlockedWithAccess for short-circuit performance
*/
#define CAN_STEP(cur_turf, next, simulated_only, pass_info, avoid) (next && !next.density && !(simulated_only && SSpathfinder.space_type_cache[next.type]) && !cur_turf.LinkBlockedWithAccess(next, pass_info) && (next != avoid))
#define DIAGONAL_DO_NOTHING NONE
#define DIAGONAL_REMOVE_ALL 1
#define DIAGONAL_REMOVE_CLUNKY 2
// Set of delays for path_map reuse
// The longer you go, the higher the risk of invalid paths
#define MAP_REUSE_INSTANT (0)
#define MAP_REUSE_SNAPPY (0.5 SECONDS)
#define MAP_REUSE_FAST (2 SECONDS)
#define MAP_REUSE_SLOW (20 SECONDS)
// Longest delay, so any maps older then this will be discarded from the subsystem cache
#define MAP_REUSE_SLOWEST (60 SECONDS)
+1
View File
@@ -101,6 +101,7 @@
#define FIRE_PRIORITY_AIR 20
#define FIRE_PRIORITY_NPC 20
#define FIRE_PRIORITY_CAMERA 20
#define FIRE_PRIORITY_PATHFINDING 23
#define FIRE_PRIORITY_PROCESS 25
#define FIRE_PRIORITY_THROWING 25
#define FIRE_PRIORITY_SPACEDRIFT 30
+6
View File
@@ -4,3 +4,9 @@
#define TURF_PATHING_PASS_PROC 1
/// Turf is never passable
#define TURF_PATHING_PASS_NO 2
/// Returns a list of turfs similar to CORNER_BLOCK but with offsets
#define CORNER_BLOCK_OFFSET(corner, width, height, offset_x, offset_y) (block(corner.x + offset_x, corner.y + offset_y, corner.z, corner.x + (width - 1) + offset_x, corner.y + (height - 1) + offset_y))
/// Returns a list of around us
#define TURF_NEIGHBORS(turf) (CORNER_BLOCK_OFFSET(turf, 3, 3, -1, -1) - turf)