Add real-time radar feature for nearby objects

Browser can open a radar window per character that streams nearby
monsters, players, NPCs, portals, and other objects in real-time.
On-demand activation via start_radar/stop_radar commands through
the existing WebSocket command channel.

- Backend: nearby_objects event handler with in-memory cache and broadcast
- Frontend: canvas mini-map + entity list table in draggable window
- Radar button added to player list alongside Chat/Stats/Inventory/Char

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-07 23:00:53 +02:00
parent c0da36c280
commit 3852cf205e
3 changed files with 439 additions and 1 deletions

View file

@ -525,7 +525,7 @@ body {
margin-top: 4px;
}
.chat-window, .stats-window, .inventory-window, .character-window {
.chat-window, .stats-window, .inventory-window, .character-window, .radar-window {
position: absolute;
top: 10px;
/* position window to start just right of the sidebar */
@ -2502,3 +2502,131 @@ table.ts-allegiance td:first-child {
border-top: 1px solid #5a4a24;
border-bottom: 1px solid #5a4a24;
}
/* ─── Radar Window ─── */
.radar-window {
width: 360px;
height: 560px;
}
.radar-window .window-content {
display: flex;
flex-direction: column;
overflow: hidden;
}
.radar-controls {
display: flex;
align-items: center;
gap: 12px;
padding: 4px 8px;
background: #1a1a1a;
border-bottom: 1px solid #333;
font-size: 0.8rem;
}
.radar-controls label {
display: flex;
align-items: center;
gap: 4px;
color: #ccc;
}
.radar-range-select {
background: #222;
color: #ccc;
border: 1px solid #444;
padding: 2px 4px;
font-size: 0.75rem;
}
.radar-canvas {
display: block;
margin: 0 auto;
border-bottom: 1px solid #333;
flex-shrink: 0;
}
.radar-entity-list {
flex: 1;
overflow-y: auto;
font-size: 0.75rem;
min-height: 0;
}
.radar-entity-header,
.radar-entity-row {
display: flex;
align-items: center;
padding: 2px 6px;
gap: 4px;
}
.radar-entity-header {
background: #1a1a1a;
color: #888;
font-weight: bold;
border-bottom: 1px solid #333;
position: sticky;
top: 0;
}
.radar-entity-row {
border-bottom: 1px solid #222;
}
.radar-entity-row:hover {
background: #1a1a2a;
}
.re-color {
width: 8px;
height: 8px;
border-radius: 50%;
flex-shrink: 0;
display: inline-block;
}
.re-name {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #ddd;
}
.re-type {
width: 60px;
flex-shrink: 0;
color: #888;
}
.re-dist {
width: 45px;
flex-shrink: 0;
text-align: right;
color: #aaa;
}
.re-dir {
width: 24px;
flex-shrink: 0;
text-align: center;
color: #888;
}
.radar-btn {
background: #553388;
color: #fff;
border: 1px solid #774499;
padding: 1px 6px;
cursor: pointer;
font-size: 0.7rem;
border-radius: 3px;
}
.radar-btn:hover {
background: #664499;
}