BlueGit

projects-timfalken-com meteors

feat: land arcs on that column, go around the field, draw hits grey (t1126–t1130)

Enemy→player ends at land_col on the field; player→enemy and
enemy→enemy aim at the same column on the target mini. Player↔enemy
paths route around the field (up the outside, across the top) and
never over the interior; enemy→enemy still passes behind. Every
hit is drawn as a grey garbage block, matching what the target
receives; misses keep the sender's colour.

timfa Grok Bot · pushed by timfa

Authored 2026-11-13 · 4 days ago

Hash
02b385ee7ce9324f23e5ae4f42e2f88bc76e21ce
Parent
a879e2b4
2 files changed +224 −8
src/main.js +6 −2
@@ -1359,7 +1359,8 @@ function tickOffline (dt)
1359 1359 color: s.color,
1360 1360 startX: start.x,
1361 1361 startY: start.y,
1362 from_id: s.from_id
1362 from_id: s.from_id,
1363 land_col: s.land_col
1363 1364 };
1364 1365 }
1365 1366 Online.spawnFlights(result.flights, locals);
@@ -1792,7 +1793,10 @@ function bindOnlineUi ()
1792 1793 if (!app.core || app.core.state !== 'playing')
1793 1794 { return; }
1794 1795 for (var i = 0; i < incoming.length; i++)
1795 { app.core.ingestGarbage(); }
1796 {
1797 var col = Online.takeLandCol ? Online.takeLandCol(incoming[i]) : incoming[i].land_col;
1798 app.core.ingestGarbage(col);
1799 }
1796 1800 };
1797 1801 Online.onFinished = function (lobby)
1798 1802 { showPodium(lobby); };
@@ -1359,7 +1359,8 @@ function tickOffline (dt)
1359 color: s.color,
1359 color: s.color,
1360 startX: start.x,
1360 startX: start.x,
1361 startY: start.y,
1361 startY: start.y,
1362 from_id: s.from_id
1362 from_id: s.from_id,
1363 land_col: s.land_col
1363 };
1364 };
1364 }
1365 }
1365 Online.spawnFlights(result.flights, locals);
1366 Online.spawnFlights(result.flights, locals);
@@ -1792,7 +1793,10 @@ function bindOnlineUi ()
1792 if (!app.core || app.core.state !== 'playing')
1793 if (!app.core || app.core.state !== 'playing')
1793 { return; }
1794 { return; }
1794 for (var i = 0; i < incoming.length; i++)
1795 for (var i = 0; i < incoming.length; i++)
1795 { app.core.ingestGarbage(); }
1796 {
1797 var col = Online.takeLandCol ? Online.takeLandCol(incoming[i]) : incoming[i].land_col;
1798 app.core.ingestGarbage(col);
1799 }
1796 };
1800 };
1797 Online.onFinished = function (lobby)
1801 Online.onFinished = function (lobby)
1798 { showPodium(lobby); };
1802 { showPodium(lobby); };
src/online.js +218 −6
@@ -485,6 +485,174 @@ Online.easeInOutCubic = function (t)
485 485 return 1 - (u * u * u) / 2;
486 486 };
487 487
488 /** Bounding box of the player's field in viewport pixels. */
489 Online.playerFieldRect = function ()
490 {
491 var appRef = typeof app !== 'undefined' ? app : null;
492 var canvas = appRef && appRef.scene && appRef.scene.canvas;
493 if (canvas && canvas.getBoundingClientRect)
494 { return canvas.getBoundingClientRect(); }
495 if (appRef && appRef.fieldW)
496 {
497 return {
498 left: appRef.fieldX,
499 top: appRef.fieldY,
500 right: appRef.fieldX + appRef.fieldW,
501 bottom: appRef.fieldY + appRef.fieldH,
502 width: appRef.fieldW,
503 height: appRef.fieldH
504 };
505 }
506 return null;
507 };
508
509 /**
510 * True if (x, y) is inside the field's interior. The top edge (a few
511 * pixels) is not interior: that is where arcs may land (t1128).
512 */
513 Online.pointInFieldInterior = function (x, y, field, slop)
514 {
515 if (!field)
516 { return false; }
517 slop = slop == null ? 6 : slop;
518 return x > field.left + 0.5 && x < field.right - 0.5
519 && y > field.top + slop && y < field.bottom - 0.5;
520 };
521
522 /**
523 * Waypoints that route a player↔enemy arc around the field, never
524 * through its interior: up the outside, across above the top edge,
525 * then into the target (t1128). If both ends already sit at or above
526 * the top, a simple two-point path is enough.
527 */
528 Online.waypointsAroundField = function (start, end, field, clearance)
529 {
530 if (!start || !end)
531 { return [start || { x: 0, y: 0 }, end || { x: 0, y: 0 }]; }
532 if (!field)
533 { return [start, end]; }
534 clearance = clearance || 64;
535 var top = field.top;
536 var left = field.left;
537 var right = field.right;
538 var pad = 10;
539 var apexY = Math.min(start.y, end.y, top) - clearance;
540 if (apexY < 8)
541 { apexY = Math.max(8, top - Math.max(24, clearance * 0.5)); }
542
543 if (start.y <= top + 6 && end.y <= top + 6)
544 { return [start, end]; }
545
546 var w1x = start.x;
547 var w2x = end.x;
548 if (start.x < left)
549 { w1x = Math.min(start.x, left - pad); }
550 else if (start.x > right)
551 { w1x = Math.max(start.x, right + pad); }
552 if (end.x < left)
553 { w2x = Math.min(end.x, left - pad); }
554 else if (end.x > right)
555 { w2x = Math.max(end.x, right + pad); }
556
557 return [
558 start,
559 { x: w1x, y: apexY },
560 { x: w2x, y: apexY },
561 end
562 ];
563 };
564
565 /**
566 * Point at parameter u ∈ [0, 1] along a polyline, with a small upward
567 * bulge on each segment so the path reads as a "boogje".
568 */
569 Online.pointOnPath = function (points, u)
570 {
571 u = u < 0 ? 0 : (u > 1 ? 1 : u);
572 if (!points || !points.length)
573 { return { x: 0, y: 0 }; }
574 if (points.length === 1)
575 { return { x: points[0].x, y: points[0].y }; }
576 var lens = [];
577 var total = 0;
578 for (var i = 1; i < points.length; i++)
579 {
580 var dx = points[i].x - points[i - 1].x;
581 var dy = points[i].y - points[i - 1].y;
582 var L = Math.sqrt(dx * dx + dy * dy);
583 if (L < 1)
584 { L = 1; }
585 lens.push(L);
586 total += L;
587 }
588 var dist = u * total;
589 var acc = 0;
590 for (var i = 0; i < lens.length; i++)
591 {
592 if (acc + lens[i] >= dist || i === lens.length - 1)
593 {
594 var t = (dist - acc) / lens[i];
595 if (t < 0)
596 { t = 0; }
597 if (t > 1)
598 { t = 1; }
599 var a = points[i];
600 var b = points[i + 1];
601 var bump = 4 * 16 * t * (1 - t);
602 return {
603 x: a.x + (b.x - a.x) * t,
604 y: a.y + (b.y - a.y) * t - bump
605 };
606 }
607 acc += lens[i];
608 }
609 var last = points[points.length - 1];
610 return { x: last.x, y: last.y };
611 };
612
613 /** Sample a player↔enemy path; used by tests and the ticker. */
614 Online.aroundFieldPoint = function (start, end, u, field, clearance)
615 {
616 var pts = this.waypointsAroundField(start, end, field, clearance);
617 if (pts.length === 2)
618 {
619 var h = this.arcHeight(start, end);
620 return this.arcPoint(start, end, u, h);
621 }
622 return this.pointOnPath(pts, u);
623 };
624
625 Online.rememberLandCol = function (id, col)
626 {
627 if (id == null || col == null || !isFinite(col))
628 { return; }
629 if (!this._pendingLandCol)
630 { this._pendingLandCol = Object.create(null); }
631 this._pendingLandCol[String(id)] = col | 0;
632 };
633
634 /** Resolve the landing column for an incoming shot (t1126). */
635 Online.takeLandCol = function (incoming)
636 {
637 if (!incoming)
638 { return null; }
639 if (incoming.land_col != null && isFinite(incoming.land_col))
640 { return incoming.land_col | 0; }
641 if (!this._pendingLandCol)
642 { return null; }
643 var keys = [];
644 if (incoming.id != null)
645 { keys.push(String(incoming.id)); }
646 if (incoming.client_id)
647 { keys.push(String(incoming.client_id)); }
648 for (var i = 0; i < keys.length; i++)
649 {
650 if (this._pendingLandCol[keys[i]] != null)
651 { return this._pendingLandCol[keys[i]]; }
652 }
653 return null;
654 };
655
488 656 Online._miniCellSize = function (playerId)
489 657 {
490 658 var el = this.miniElement(playerId);
@@ -559,6 +727,21 @@ Online.spawnFlights = function (results, locals)
559 727 if (r.age != null && isFinite(r.age) && r.age * 1000 >= duration)
560 728 { continue; }
561 729
730 var landCol = null;
731 if (r.land_col != null && isFinite(r.land_col))
732 { landCol = r.land_col | 0; }
733 else if (meta.land_col != null && isFinite(meta.land_col))
734 { landCol = meta.land_col | 0; }
735 else if (kind === 'enemy-to-player'
736 && typeof app !== 'undefined' && app.core && app.core.pickGarbageColumn)
737 { landCol = app.core.pickGarbageColumn(); }
738 if (landCol != null)
739 {
740 this.rememberLandCol(sid, landCol);
741 if (r.client_id)
742 { this.rememberLandCol(r.client_id, landCol); }
743 }
744
562 745 var start;
563 746 if (meta.startX != null && isFinite(meta.startX))
564 747 { start = { x: meta.startX, y: meta.startY }; }
@@ -571,9 +754,15 @@ Online.spawnFlights = function (results, locals)
571 754 if (miss)
572 755 { end = this._missEnd(start, kind === 'enemy-miss'); }
573 756 else if (kind === 'enemy-to-player')
574 { end = this._fieldTop(null); }
757 { end = this._fieldTop(landCol != null ? landCol : 4.5); }
575 758 else
576 { end = this._targetEnd(targetId, start); }
759 { end = this._targetEnd(targetId, start, landCol); }
760
761 // Hits are ingested as grey garbage; draw them grey (t1130).
762 // Misses keep the sender's colour — nothing is received.
763 var flightColor = miss
764 ? (r.color != null ? r.color : meta.color)
765 : -1;
577 766
578 767 var startScale;
579 768 var endScale;
@@ -608,7 +797,7 @@ Online.spawnFlights = function (results, locals)
608 797
609 798 var layer = (kind === 'enemy-to-enemy' && back) ? back : front;
610 799 var el = document.createElement('img');
611 el.src = colorSpriteUrl(r.color != null ? r.color : meta.color);
800 el.src = colorSpriteUrl(flightColor);
612 801 el.alt = '';
613 802 el.className = 'flight' + (kind === 'enemy-to-enemy' ? ' flight-behind' : '');
614 803 el.style.width = full + 'px';
@@ -624,6 +813,9 @@ Online.spawnFlights = function (results, locals)
624 813 var height = miss
625 814 ? Math.max(40, Math.min(160, Math.abs(end.y - start.y) * 0.35))
626 815 : this.arcHeight(start, end);
816 var field = this.playerFieldRect();
817 var around = !miss && (kind === 'enemy-to-player' || kind === 'player-to-enemy');
818 var waypoints = around ? this.waypointsAroundField(start, end, field, height * 0.45) : null;
627 819 this._flights.push({
628 820 el: el,
629 821 start: start,
@@ -638,7 +830,11 @@ Online.spawnFlights = function (results, locals)
638 830 startScale: startScale,
639 831 endScale: endScale,
640 832 angle: Math.random() * 360,
641 id: sid
833 id: sid,
834 landCol: landCol,
835 field: field,
836 waypoints: waypoints,
837 color: flightColor
642 838 });
643 839 }
644 840 this._flightLocals = {};
@@ -680,14 +876,17 @@ Online._flightStart = function (col)
680 876 return { x: window.innerWidth / 2, y: window.innerHeight * 0.3 };
681 877 };
682 878
683 Online._targetEnd = function (targetId, start)
879 Online._targetEnd = function (targetId, start, col)
684 880 {
685 881 var el = targetId && this.miniElement(targetId);
686 882 if (el)
687 883 {
688 884 var canvas = el.querySelector('canvas') || el;
689 885 var r = canvas.getBoundingClientRect();
690 return { x: r.left + r.width / 2, y: r.top + r.height / 2 };
886 var x = r.left + r.width / 2;
887 if (col != null && isFinite(col))
888 { x = r.left + ((col + 0.5) / 10) * r.width; }
889 return { x: x, y: r.top + 4 };
691 890 }
692 891 return { x: start.x + (Math.random() - 0.5) * 80, y: 40 };
693 892 };
@@ -747,6 +946,18 @@ Online.tickFlights = function (now)
747 946 x = mt * mt * f.start.x + 2 * mt * e * f.ctrl.x + e * e * f.end.x;
748 947 y = mt * mt * f.start.y + 2 * mt * e * f.ctrl.y + e * e * f.end.y;
749 948 }
949 else if (f.waypoints && f.waypoints.length > 2)
950 {
951 var pt = this.pointOnPath(f.waypoints, u);
952 x = pt.x;
953 y = pt.y;
954 }
955 else if (f.waypoints && f.field)
956 {
957 var pt = this.aroundFieldPoint(f.start, f.end, u, f.field, (f.height || 80) * 0.45);
958 x = pt.x;
959 y = pt.y;
960 }
750 961 else
751 962 {
752 963 var pt = this.arcPoint(f.start, f.end, u, f.height || 80);
@@ -789,6 +1000,7 @@ Online.clearFlights = function ()
789 1000 this._flights = [];
790 1001 this._flightLocals = {};
791 1002 this._flightSeen = Object.create(null);
1003 this._pendingLandCol = Object.create(null);
792 1004 };
793 1005
794 1006 if (typeof globalThis !== 'undefined')
@@ -485,6 +485,174 @@ Online.easeInOutCubic = function (t)
485 return 1 - (u * u * u) / 2;
485 return 1 - (u * u * u) / 2;
486};
486};
487
487
488/** Bounding box of the player's field in viewport pixels. */
489Online.playerFieldRect = function ()
490{
491 var appRef = typeof app !== 'undefined' ? app : null;
492 var canvas = appRef && appRef.scene && appRef.scene.canvas;
493 if (canvas && canvas.getBoundingClientRect)
494 { return canvas.getBoundingClientRect(); }
495 if (appRef && appRef.fieldW)
496 {
497 return {
498 left: appRef.fieldX,
499 top: appRef.fieldY,
500 right: appRef.fieldX + appRef.fieldW,
501 bottom: appRef.fieldY + appRef.fieldH,
502 width: appRef.fieldW,
503 height: appRef.fieldH
504 };
505 }
506 return null;
507};
508
509/**
510 * True if (x, y) is inside the field's interior. The top edge (a few
511 * pixels) is not interior: that is where arcs may land (t1128).
512 */
513Online.pointInFieldInterior = function (x, y, field, slop)
514{
515 if (!field)
516 { return false; }
517 slop = slop == null ? 6 : slop;
518 return x > field.left + 0.5 && x < field.right - 0.5
519 && y > field.top + slop && y < field.bottom - 0.5;
520};
521
522/**
523 * Waypoints that route a player↔enemy arc around the field, never
524 * through its interior: up the outside, across above the top edge,
525 * then into the target (t1128). If both ends already sit at or above
526 * the top, a simple two-point path is enough.
527 */
528Online.waypointsAroundField = function (start, end, field, clearance)
529{
530 if (!start || !end)
531 { return [start || { x: 0, y: 0 }, end || { x: 0, y: 0 }]; }
532 if (!field)
533 { return [start, end]; }
534 clearance = clearance || 64;
535 var top = field.top;
536 var left = field.left;
537 var right = field.right;
538 var pad = 10;
539 var apexY = Math.min(start.y, end.y, top) - clearance;
540 if (apexY < 8)
541 { apexY = Math.max(8, top - Math.max(24, clearance * 0.5)); }
542
543 if (start.y <= top + 6 && end.y <= top + 6)
544 { return [start, end]; }
545
546 var w1x = start.x;
547 var w2x = end.x;
548 if (start.x < left)
549 { w1x = Math.min(start.x, left - pad); }
550 else if (start.x > right)
551 { w1x = Math.max(start.x, right + pad); }
552 if (end.x < left)
553 { w2x = Math.min(end.x, left - pad); }
554 else if (end.x > right)
555 { w2x = Math.max(end.x, right + pad); }
556
557 return [
558 start,
559 { x: w1x, y: apexY },
560 { x: w2x, y: apexY },
561 end
562 ];
563};
564
565/**
566 * Point at parameter u ∈ [0, 1] along a polyline, with a small upward
567 * bulge on each segment so the path reads as a "boogje".
568 */
569Online.pointOnPath = function (points, u)
570{
571 u = u < 0 ? 0 : (u > 1 ? 1 : u);
572 if (!points || !points.length)
573 { return { x: 0, y: 0 }; }
574 if (points.length === 1)
575 { return { x: points[0].x, y: points[0].y }; }
576 var lens = [];
577 var total = 0;
578 for (var i = 1; i < points.length; i++)
579 {
580 var dx = points[i].x - points[i - 1].x;
581 var dy = points[i].y - points[i - 1].y;
582 var L = Math.sqrt(dx * dx + dy * dy);
583 if (L < 1)
584 { L = 1; }
585 lens.push(L);
586 total += L;
587 }
588 var dist = u * total;
589 var acc = 0;
590 for (var i = 0; i < lens.length; i++)
591 {
592 if (acc + lens[i] >= dist || i === lens.length - 1)
593 {
594 var t = (dist - acc) / lens[i];
595 if (t < 0)
596 { t = 0; }
597 if (t > 1)
598 { t = 1; }
599 var a = points[i];
600 var b = points[i + 1];
601 var bump = 4 * 16 * t * (1 - t);
602 return {
603 x: a.x + (b.x - a.x) * t,
604 y: a.y + (b.y - a.y) * t - bump
605 };
606 }
607 acc += lens[i];
608 }
609 var last = points[points.length - 1];
610 return { x: last.x, y: last.y };
611};
612
613/** Sample a player↔enemy path; used by tests and the ticker. */
614Online.aroundFieldPoint = function (start, end, u, field, clearance)
615{
616 var pts = this.waypointsAroundField(start, end, field, clearance);
617 if (pts.length === 2)
618 {
619 var h = this.arcHeight(start, end);
620 return this.arcPoint(start, end, u, h);
621 }
622 return this.pointOnPath(pts, u);
623};
624
625Online.rememberLandCol = function (id, col)
626{
627 if (id == null || col == null || !isFinite(col))
628 { return; }
629 if (!this._pendingLandCol)
630 { this._pendingLandCol = Object.create(null); }
631 this._pendingLandCol[String(id)] = col | 0;
632};
633
634/** Resolve the landing column for an incoming shot (t1126). */
635Online.takeLandCol = function (incoming)
636{
637 if (!incoming)
638 { return null; }
639 if (incoming.land_col != null && isFinite(incoming.land_col))
640 { return incoming.land_col | 0; }
641 if (!this._pendingLandCol)
642 { return null; }
643 var keys = [];
644 if (incoming.id != null)
645 { keys.push(String(incoming.id)); }
646 if (incoming.client_id)
647 { keys.push(String(incoming.client_id)); }
648 for (var i = 0; i < keys.length; i++)
649 {
650 if (this._pendingLandCol[keys[i]] != null)
651 { return this._pendingLandCol[keys[i]]; }
652 }
653 return null;
654};
655
488Online._miniCellSize = function (playerId)
656Online._miniCellSize = function (playerId)
489{
657{
490 var el = this.miniElement(playerId);
658 var el = this.miniElement(playerId);
@@ -559,6 +727,21 @@ Online.spawnFlights = function (results, locals)
559 if (r.age != null && isFinite(r.age) && r.age * 1000 >= duration)
727 if (r.age != null && isFinite(r.age) && r.age * 1000 >= duration)
560 { continue; }
728 { continue; }
561
729
730 var landCol = null;
731 if (r.land_col != null && isFinite(r.land_col))
732 { landCol = r.land_col | 0; }
733 else if (meta.land_col != null && isFinite(meta.land_col))
734 { landCol = meta.land_col | 0; }
735 else if (kind === 'enemy-to-player'
736 && typeof app !== 'undefined' && app.core && app.core.pickGarbageColumn)
737 { landCol = app.core.pickGarbageColumn(); }
738 if (landCol != null)
739 {
740 this.rememberLandCol(sid, landCol);
741 if (r.client_id)
742 { this.rememberLandCol(r.client_id, landCol); }
743 }
744
562 var start;
745 var start;
563 if (meta.startX != null && isFinite(meta.startX))
746 if (meta.startX != null && isFinite(meta.startX))
564 { start = { x: meta.startX, y: meta.startY }; }
747 { start = { x: meta.startX, y: meta.startY }; }
@@ -571,9 +754,15 @@ Online.spawnFlights = function (results, locals)
571 if (miss)
754 if (miss)
572 { end = this._missEnd(start, kind === 'enemy-miss'); }
755 { end = this._missEnd(start, kind === 'enemy-miss'); }
573 else if (kind === 'enemy-to-player')
756 else if (kind === 'enemy-to-player')
574 { end = this._fieldTop(null); }
757 { end = this._fieldTop(landCol != null ? landCol : 4.5); }
575 else
758 else
576 { end = this._targetEnd(targetId, start); }
759 { end = this._targetEnd(targetId, start, landCol); }
760
761 // Hits are ingested as grey garbage; draw them grey (t1130).
762 // Misses keep the sender's colour — nothing is received.
763 var flightColor = miss
764 ? (r.color != null ? r.color : meta.color)
765 : -1;
577
766
578 var startScale;
767 var startScale;
579 var endScale;
768 var endScale;
@@ -608,7 +797,7 @@ Online.spawnFlights = function (results, locals)
608
797
609 var layer = (kind === 'enemy-to-enemy' && back) ? back : front;
798 var layer = (kind === 'enemy-to-enemy' && back) ? back : front;
610 var el = document.createElement('img');
799 var el = document.createElement('img');
611 el.src = colorSpriteUrl(r.color != null ? r.color : meta.color);
800 el.src = colorSpriteUrl(flightColor);
612 el.alt = '';
801 el.alt = '';
613 el.className = 'flight' + (kind === 'enemy-to-enemy' ? ' flight-behind' : '');
802 el.className = 'flight' + (kind === 'enemy-to-enemy' ? ' flight-behind' : '');
614 el.style.width = full + 'px';
803 el.style.width = full + 'px';
@@ -624,6 +813,9 @@ Online.spawnFlights = function (results, locals)
624 var height = miss
813 var height = miss
625 ? Math.max(40, Math.min(160, Math.abs(end.y - start.y) * 0.35))
814 ? Math.max(40, Math.min(160, Math.abs(end.y - start.y) * 0.35))
626 : this.arcHeight(start, end);
815 : this.arcHeight(start, end);
816 var field = this.playerFieldRect();
817 var around = !miss && (kind === 'enemy-to-player' || kind === 'player-to-enemy');
818 var waypoints = around ? this.waypointsAroundField(start, end, field, height * 0.45) : null;
627 this._flights.push({
819 this._flights.push({
628 el: el,
820 el: el,
629 start: start,
821 start: start,
@@ -638,7 +830,11 @@ Online.spawnFlights = function (results, locals)
638 startScale: startScale,
830 startScale: startScale,
639 endScale: endScale,
831 endScale: endScale,
640 angle: Math.random() * 360,
832 angle: Math.random() * 360,
641 id: sid
833 id: sid,
834 landCol: landCol,
835 field: field,
836 waypoints: waypoints,
837 color: flightColor
642 });
838 });
643 }
839 }
644 this._flightLocals = {};
840 this._flightLocals = {};
@@ -680,14 +876,17 @@ Online._flightStart = function (col)
680 return { x: window.innerWidth / 2, y: window.innerHeight * 0.3 };
876 return { x: window.innerWidth / 2, y: window.innerHeight * 0.3 };
681};
877};
682
878
683Online._targetEnd = function (targetId, start)
879Online._targetEnd = function (targetId, start, col)
684{
880{
685 var el = targetId && this.miniElement(targetId);
881 var el = targetId && this.miniElement(targetId);
686 if (el)
882 if (el)
687 {
883 {
688 var canvas = el.querySelector('canvas') || el;
884 var canvas = el.querySelector('canvas') || el;
689 var r = canvas.getBoundingClientRect();
885 var r = canvas.getBoundingClientRect();
690 return { x: r.left + r.width / 2, y: r.top + r.height / 2 };
886 var x = r.left + r.width / 2;
887 if (col != null && isFinite(col))
888 { x = r.left + ((col + 0.5) / 10) * r.width; }
889 return { x: x, y: r.top + 4 };
691 }
890 }
692 return { x: start.x + (Math.random() - 0.5) * 80, y: 40 };
891 return { x: start.x + (Math.random() - 0.5) * 80, y: 40 };
693};
892};
@@ -747,6 +946,18 @@ Online.tickFlights = function (now)
747 x = mt * mt * f.start.x + 2 * mt * e * f.ctrl.x + e * e * f.end.x;
946 x = mt * mt * f.start.x + 2 * mt * e * f.ctrl.x + e * e * f.end.x;
748 y = mt * mt * f.start.y + 2 * mt * e * f.ctrl.y + e * e * f.end.y;
947 y = mt * mt * f.start.y + 2 * mt * e * f.ctrl.y + e * e * f.end.y;
749 }
948 }
949 else if (f.waypoints && f.waypoints.length > 2)
950 {
951 var pt = this.pointOnPath(f.waypoints, u);
952 x = pt.x;
953 y = pt.y;
954 }
955 else if (f.waypoints && f.field)
956 {
957 var pt = this.aroundFieldPoint(f.start, f.end, u, f.field, (f.height || 80) * 0.45);
958 x = pt.x;
959 y = pt.y;
960 }
750 else
961 else
751 {
962 {
752 var pt = this.arcPoint(f.start, f.end, u, f.height || 80);
963 var pt = this.arcPoint(f.start, f.end, u, f.height || 80);
@@ -789,6 +1000,7 @@ Online.clearFlights = function ()
789 this._flights = [];
1000 this._flights = [];
790 this._flightLocals = {};
1001 this._flightLocals = {};
791 this._flightSeen = Object.create(null);
1002 this._flightSeen = Object.create(null);
1003 this._pendingLandCol = Object.create(null);
792};
1004};
793
1005
794if (typeof globalThis !== 'undefined')
1006if (typeof globalThis !== 'undefined')