Redesign in-game menu with tabbed canvas UI and add logistics routes, secondary detonation, and RM48U tracking
build / mod (push) Failing after 15s

This commit is contained in:
2026-12-04 14:16:21 +03:00
parent 76ef94b537
commit 48ec72d3d2
18 changed files with 2461 additions and 924 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ from .terrain import TerrainTiles
TOKEN = re.compile(r"[0-9a-f]{16,32}\Z")
MAX_PACKET = 1 << 20
MAX_REPLY = 1 << 18
MAP_LAYERS = ("units", "objects", "contacts", "interceptors", "sites")
MAP_LAYERS = ("units", "objects", "contacts", "interceptors", "sites", "strikes")
LIVE_REVISIONS = 12
+2
View File
@@ -141,6 +141,7 @@ dialog::backdrop { background: #02080dc9; }
.legend [data-layer="contacts"] { accent-color: #f0bf6a; }
.legend [data-layer="interceptors"] { accent-color: #b2e68f; }
.legend [data-layer="sites"] { accent-color: #ff9b52; }
.legend [data-layer="strikes"] { accent-color: #ff6b3d; }
#autostrike-toggle[aria-pressed="true"] { background: #234443; border-color: #3d6864; color: #d3fff3; }
#logistics-summary p { margin: .15rem 0; font-size: .82rem; }
.panel-title { margin: 0; font-size: 1.05rem; }
@@ -152,6 +153,7 @@ dialog::backdrop { background: #02080dc9; }
#object-list [data-kind="contact"] { --marker: #f0bf6a; }
#object-list [data-kind="interceptor"] { --marker: #b2e68f; }
#object-list [data-kind="site"] { --marker: #ff9b52; }
#object-list [data-kind="strike"] { --marker: #ff6b3d; }
@media (max-width: 540px) {
.map-tools { gap: .5rem; }
.inline-field { font-size: .8rem; }
+14 -1
View File
@@ -69,7 +69,7 @@ async function api(path, {method = "GET", data} = {}) {
}
}
const groups = [["units", "unit"], ["objects", "object"], ["contacts", "contact"], ["interceptors", "interceptor"], ["sites", "site"]];
const groups = [["units", "unit"], ["objects", "object"], ["contacts", "contact"], ["interceptors", "interceptor"], ["sites", "site"], ["strikes", "strike"]];
const prefs = read("view", {layers: {}, views: {}, selected: null});
prefs.layers ||= {};
prefs.views ||= {};
@@ -289,6 +289,19 @@ function showObject(opened, frame) {
nodes.push(strikeBtn);
}
}
if (kind === "strike") {
if (row.eta != null) nodes.push(paragraph(`Подлёт · ~${row.eta} с (${row.progress ?? 0}%)`));
if (row.aimX != null && row.aimZ != null) nodes.push(paragraph(`Цель · X ${Math.round(row.aimX)} · Z ${Math.round(row.aimZ)}`));
if (row.site != null && frame?.sites?.some(s => s.id === row.site)) {
nodes.push(button(`Пусковая №${row.site}`, () => select(`site:${row.site}`, true)));
}
if (row.carrier != null && frame?.units?.some(u => u.id === row.carrier)) {
nodes.push(button(`Носитель №${row.carrier}`, () => select(`unit:${row.carrier}`, true)));
}
}
if (kind === "unit" && row.job != null && frame?.units?.some(u => u.id === row.job)) {
nodes.push(button(`Цель маршрута · №${row.job}`, () => select(`unit:${row.job}`, true)));
}
if (row.target) nodes.push(button(`Контакт №${row.target}`, () => select(`contact:${row.target}`, true)));
if (row.source) {
const linked = frame?.units?.some(unit => unit.id === row.source);
+1
View File
@@ -68,6 +68,7 @@
<label><input type="checkbox" data-layer="contacts" checked> Контакты</label>
<label><input type="checkbox" data-layer="interceptors" checked> Перехватчики</label>
<label><input type="checkbox" data-layer="sites" checked> ПУ врага</label>
<label><input type="checkbox" data-layer="strikes" checked> Ударные RM48U</label>
</div>
<div class="map-readout"><span id="map-source"></span><span id="map-status" role="status"></span></div>
</footer>
+62 -1
View File
@@ -7,6 +7,7 @@ const styles = [
["contacts", "contact", "#f0bf6a"],
["interceptors", "interceptor", "#b2e68f"],
["sites", "site", "#ff9b52"],
["strikes", "strike", "#ff6b3d"],
];
const clamp = (x, low, high) => Math.min(high, Math.max(low, x));
@@ -14,7 +15,7 @@ export function createMap(canvas, {onSelect, onView, onTerrain}) {
const ctx = canvas.getContext("2d");
const view = {x: 0, z: 0, scale: .22};
const fingers = new Map();
let points = [], visible = [], selected, width = 1, height = 1, drawnFrame;
let points = [], visible = [], selected, width = 1, height = 1, drawnFrame, activeLayers = {};
const terrain = createTerrain(schedule);
let mode = "map", scope, online, radarId;
let moved = false, autoFit = true, queued = false;
@@ -98,6 +99,63 @@ export function createMap(canvas, {onSelect, onView, onTerrain}) {
const bar = steps.find(s => s * scale >= 40) || steps.at(-1);
ctx.fillText(`${bar} бл.`, 14, height - 23);
ctx.fillRect(14, height - 16, bar * scale, 2);
if (activeLayers.units !== false && drawnFrame?.units) {
const routeColors = {
rm48u: "rgba(255, 184, 92, 0.85)",
return: "rgba(255, 184, 92, 0.85)",
deliver: "rgba(112, 232, 136, 0.85)",
fetch: "rgba(106, 220, 210, 0.75)",
};
for (const row of drawnFrame.units) {
if (!Array.isArray(row.route) || row.route.length < 2) continue;
const isSel = selected === `unit:${row.id}`;
const color = routeColors[row.jobKind] || "rgba(144, 189, 192, 0.7)";
ctx.save();
ctx.strokeStyle = color;
ctx.fillStyle = color;
ctx.lineWidth = isSel ? 2.4 : 1.5;
ctx.setLineDash([6, 4]);
ctx.beginPath();
ctx.moveTo(px(row.route[0][0]), py(row.route[0][1]));
for (const pt of row.route.slice(1)) ctx.lineTo(px(pt[0]), py(pt[1]));
ctx.stroke();
ctx.setLineDash([]);
const end = row.route.at(-1);
ctx.beginPath();
ctx.arc(px(end[0]), py(end[1]), isSel ? 4 : 3, 0, Math.PI * 2);
ctx.fill();
ctx.restore();
}
}
if (activeLayers.strikes !== false && drawnFrame?.strikes) {
for (const row of drawnFrame.strikes) {
if (![row.fromX, row.fromZ, row.x, row.z, row.aimX, row.aimZ].every(Number.isFinite)) continue;
const isSel = selected === `strike:${row.id}`;
ctx.save();
ctx.strokeStyle = "rgba(255, 107, 61, 0.55)";
ctx.lineWidth = isSel ? 2.2 : 1.4;
ctx.beginPath();
ctx.moveTo(px(row.fromX), py(row.fromZ));
ctx.lineTo(px(row.x), py(row.z));
ctx.stroke();
ctx.strokeStyle = "rgba(255, 160, 64, 0.85)";
ctx.setLineDash([5, 4]);
ctx.beginPath();
ctx.moveTo(px(row.x), py(row.z));
ctx.lineTo(px(row.aimX), py(row.aimZ));
ctx.stroke();
ctx.setLineDash([]);
const ax = px(row.aimX), ay = py(row.aimZ);
ctx.strokeStyle = "#ff9b52";
ctx.beginPath();
ctx.moveTo(ax - 5, ay - 5);
ctx.lineTo(ax + 5, ay + 5);
ctx.moveTo(ax + 5, ay - 5);
ctx.lineTo(ax - 5, ay + 5);
ctx.stroke();
ctx.restore();
}
}
visible = [];
for (const point of points) {
const {row, color, kind} = point;
@@ -131,6 +189,8 @@ export function createMap(canvas, {onSelect, onView, onTerrain}) {
const links = [
focus.row.target != null ? `contact:${focus.row.target}` : null,
focus.row.source != null ? `unit:${focus.row.source}` : null,
focus.row.job != null ? `unit:${focus.row.job}` : null,
focus.row.site != null ? `site:${focus.row.site}` : null,
];
for (const key of links) {
const other = visible.find(item => item.key === key);
@@ -250,6 +310,7 @@ export function createMap(canvas, {onSelect, onView, onTerrain}) {
return {
draw(frame, options) {
drawnFrame = frame;
activeLayers = options.layers || {};
selected = options.selected;
mode = options.mode;
scope = options.scope;
+1 -1
View File
@@ -1,5 +1,5 @@
/* Cache only the public, versioned application shell. API responses are never cached. */
const CACHE = 'airdef-shell-v10';
const CACHE = 'airdef-shell-v11';
const FILES = ['index.html', 'app.css', 'app.js', 'map.js', 'terrain.js', 'symbols.js', 'live.js', 'timeline.js', 'manifest.webmanifest', 'icons/icon-192.png', 'icons/icon-512.png'];
const scope = new URL(self.registration.scope);
const shellUrls = FILES.map(path => new URL(path, scope).href);
+3
View File
@@ -94,6 +94,9 @@ export function drawSymbol(ctx, x, y, {kind, symbol, color = '#d6e5ea', selected
shape([[0,-10],[10,0],[0,10],[-10,0]]);
line([-5,0],[5,0]); line([0,-5],[0,5]);
break;
case 'strike':
shape([[0,-12],[3.5,-4],[3.5,5],[7.5,9],[2.5,8],[0,12],[-2.5,8],[-7.5,9],[-3.5,5],[-3.5,-4]]);
break;
default:
shape([[0,-11],[11,0],[0,11],[-11,0]]);
ctx.fillStyle = '#071219';