()
| 1441 | } |
| 1442 | |
| 1443 | createLinesForEditor () { |
| 1444 | for (const level of this.campaign?.renderedLevels || []) { |
| 1445 | let connections = level.connections || [] |
| 1446 | connections = connections.filter(connection => connection.toLevel) |
| 1447 | for (const connection of connections) { |
| 1448 | const toLevel = _.find(this.campaign.renderedLevels, { original: connection.toLevel }) |
| 1449 | if (toLevel) { |
| 1450 | this.createLineForEditor(level.position, toLevel.position) |
| 1451 | } |
| 1452 | } |
| 1453 | if (connections.length) continue // If there are connections, we don't need to draw next levels |
| 1454 | const nextLevels = level.nextLevels || [] |
| 1455 | for (const nextLevelOriginal of nextLevels) { |
| 1456 | const nextLevel = _.find(this.campaign.renderedLevels, { original: nextLevelOriginal }) |
| 1457 | if (nextLevel) { |
| 1458 | this.createLineForEditor(level.position, nextLevel.position) |
| 1459 | } |
| 1460 | } |
| 1461 | } |
| 1462 | // Also draw lines between AI Scenarios based on explicit connections |
| 1463 | const scenarios = this.campaign?.get('scenarios') || [] |
| 1464 | if (scenarios.length) { |
| 1465 | // Map scenarios by original id for fast lookup |
| 1466 | const scenarioByOriginal = {} |
| 1467 | for (const s of scenarios) { |
| 1468 | if (s?.scenario) { scenarioByOriginal[s.scenario] = s } |
| 1469 | } |
| 1470 | for (const s of scenarios) { |
| 1471 | const fromPos = s?.position |
| 1472 | if (!fromPos) { continue } |
| 1473 | for (const conn of (s?.connections || [])) { |
| 1474 | const to = scenarioByOriginal[conn?.toScenario] |
| 1475 | const toPos = to?.position |
| 1476 | if (toPos) { |
| 1477 | // If connection is marked invisible, render as a thinner line instead of skipping |
| 1478 | this.createLineForEditor(fromPos, toPos, { thin: !!conn?.invisible }) |
| 1479 | } |
| 1480 | } |
| 1481 | } |
| 1482 | } |
| 1483 | } |
| 1484 | |
| 1485 | createLineForEditor (o1, o2, options = {}) { |
| 1486 | const mapHeight = parseFloat($('.map').css('height')) |
no test coverage detected