namespace UAI { /// /// Named constants for V4 UtilityAI tasks and considerations. /// Replaces magic numbers previously scattered across individual task and consideration files. /// public static class AIConstants { // ── Vision ─────────────────────────────────────────────────────────────── /// View cone half-angle (degrees) for wide checks such as attack range. public const float ViewConeAngleWide = 70f; /// View cone half-angle (degrees) for narrow / facing checks. public const float ViewConeAngleNarrow = 30f; /// Squared distance below which a target is considered "close" (attack/revenge). public const float CloseDistanceSq = 20f; /// Squared distance beyond which the view-cone check is skipped on initial CanSee. public const float ViewConeSkipDistSq = 100f; /// Squared distance at which the secondary view-cone re-check is applied in CanSee. public const float ViewConeReCheckDistSq = 30f; /// Offset applied along the ray direction to avoid self-intersection on raycasts. public const float RaycastOriginNudge = 0.2f; // ── Combat ─────────────────────────────────────────────────────────────── /// Angle threshold (degrees) used to determine attack alignment. public const float AttackAngleThreshold = 45f; // ── Movement / Pathing ─────────────────────────────────────────────────── /// Y-delta above which ladder edge-alignment is applied in GetMoveToLocation. public const float LadderYDeltaThreshold = 1.5f; /// /// Horizontal distance within which GetMoveToLocation treats the entity as having /// arrived and returns its own position instead of the destination. Must stay below /// the 5f early-out, or every short-range move is reported as "already arrived" and /// the approach branch becomes unreachable. /// public const float MoveToArrivalDistance = 1f; /// Minimum drop distance (units) before a low jump is preferred over a standard one. public const float LowJumpDropThreshold = 2f; /// Downward raycast length used to check for ground below the entity's feet. public const float GroundCheckRayLength = 3.4f; /// Maximum ground-ray distance that still indicates solid ground (no gap ahead). public const float GroundCheckMaxHitDist = 2.2f; /// Forward nudge applied to foot position when sampling the ground for jump detection. public const float JumpForwardNudge = 0.2f; /// Vertical nudge applied to foot position when sampling the ground for jump detection. public const float JumpVerticalNudge = 0.4f; /// Y offset (above entity base) used to check headroom when deciding jump height. public const float JumpHeadroomYOffset = 2.35f; /// Downward raycast length used to confirm a landing surface in GetMoveToLocation. public const float LandingCheckRayLength = 1.02f; // ── Teleport ───────────────────────────────────────────────────────────── /// Minimum spawn radius when placing the entity near the leader after a teleport. public const int TeleportSpawnRadiusMin = 1; /// Maximum spawn radius when placing the entity near the leader after a teleport. public const int TeleportSpawnRadiusMax = 2; /// Preferred clearance radius passed to GetRandomSpawnPositionMinMaxToPosition. public const int TeleportSpawnClearance = 3; // ── Containers / Looting ───────────────────────────────────────────────── /// Chunk search radius (±n chunks) used when scanning for tile entities. public const int TileEntityScanChunkRadius = 1; /// Raycast length used in CheckContainer to validate line-of-sight to the container. public const float ContainerRaycastLength = 3f; /// Squared distance below which a container is considered within reach. public const float ContainerReachDistSq = 1f; /// Time in seconds before a cached tile-entity scan result is considered stale. public const float TileEntityCacheTtl = 2f; // ── Doors ──────────────────────────────────────────────────────────────── /// Delay in milliseconds before automatically closing a door the NPC opened. public const int DoorAutoCloseDelayMs = 2000; // ── Entity Search ──────────────────────────────────────────────────────── /// Default radius (units) for nearby-entity bounds queries. public const float DefaultNearbySearchRadius = 20f; /// Initial capacity of the shared pooled entity-search buffer. public const int EntityBufferInitialCapacity = 32; // ── IsFacing ───────────────────────────────────────────────────────────── /// Angle in degrees within which an entity is considered to be facing a target. public const float FacingAngleThreshold = 10f; } }