Alexander Whitestone
|
912863e78f
|
feat: spatial search — find nearest user/object by name (#1639)
CI / test (pull_request) Failing after 1m5s
Review Approval Gate / verify-review (pull_request) Failing after 7s
CI / validate (pull_request) Failing after 55s
Adds spatial search functionality to find users/objects by name
with distance and direction indicator.
## Features
- Search by name with autocomplete
- Distance calculation (meters)
- Direction indicator (N/S/E/W/NE/SE/SW/NW)
- Pathfinding arrow on HUD
- Keyboard shortcut (Ctrl+F / Cmd+F)
## Files Added
- js/spatial-search.js — Main search module
- tests/test_spatial_search.js — 9 passing tests
## Usage
```javascript
const search = new SpatialSearch({ maxDistance: 1000 });
search.registerEntity('id', { name: 'Alice', type: 'user', position: {...} });
const results = search.searchEntities('ali', cameraPosition);
```
## Tests
All 9 tests passing:
✅ loads correctly
✅ can be instantiated
✅ can register entities
✅ can unregister entities
✅ can update entity position
✅ calculates distance correctly
✅ calculates direction correctly
✅ searches entities correctly
✅ gets status
Closes #1540
Closes #1639
|
2026-04-20 12:00:05 -04:00 |
|