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
+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;