BlueGit

projects-timfalken-com meteors

chore: rebuild game.js with exit-only flight starts (t1137)

timfa Grok Bot · pushed by timfa

Authored 2026-11-13 · 4 days ago

Hash
637c19a7cce255ec69e653a28dfc6193adb0b5da
Parent
4c95b8a7
1 file changed +35 −13
build/game.js +35 −13
@@ -5079,7 +5079,7 @@ Online.spawnFlights = function (results, locals)
5079 5079 else if (kind === 'player-to-enemy' || kind === 'player-miss')
5080 5080 { start = this._flightStart(startCol, startY); }
5081 5081 else if (startCol != null || startY != null)
5082 { start = this.miniCellViewport(fromId, startCol, startY != null ? startY : 12); }
5082 { start = this.miniCellViewport(fromId, startCol, startY != null ? startY : 13); }
5083 5083 else
5084 5084 { start = this._miniAnchor(fromId, 'out'); }
5085 5085
@@ -5199,7 +5199,7 @@ Online.rememberFlightLocal = function (shot, startX, startY)
5199 5199 Online._flightStart = function (col, y)
5200 5200 {
5201 5201 if (y == null || !isFinite(y))
5202 { y = 12; }
5202 { y = 13; }
5203 5203 return this.cellViewport(col == null ? 4.5 : col, y);
5204 5204 };
5205 5205
@@ -5258,16 +5258,30 @@ Online._findFlight = function (sid)
5258 5258 };
5259 5259
5260 5260 /**
5261 * Early visual takeover: a flying rocket near the top of a field
5262 * becomes a flight sprite at its exact cell, so it is seen flying
5263 * *out* rather than popping in above the canvas (t1134). When the
5264 * shot is later dispatched, `retargetFlight` picks up from the
5265 * current pose and aims at the real landing column.
5261 * True once a block has really left the field, matching cullOffTop
5262 * (y ≥ height, default 13). Used so an arc never starts for a
5263 * rocket that only peaked near the top and fell back (t1137).
5264 */
5265 Online.EXIT_Y = 13;
5266 Online.hasLeftTheField = function (y, height)
5267 {
5268 height = height == null ? this.EXIT_Y : height;
5269 return y != null && isFinite(y) && y >= height - 1e-9;
5270 };
5271
5272 /**
5273 * Start a flight only at the true exit (y ≥ 13). Callers that pass
5274 * a rocket still on the field are ignored, so a fallback never
5275 * shows a phantom arc (t1137). The start pose is the exit cell,
5276 * continuing upward; retargetFlight aims it at the real target
5277 * if a preview was used in the same frame as cull.
5266 5278 */
5267 5279 Online.previewExit = function (info)
5268 5280 {
5269 5281 if (!info || info.id == null)
5270 { return; }
5282 { return null; }
5283 if (!this.hasLeftTheField(info.y))
5284 { return null; }
5271 5285 var sid = String(info.id);
5272 5286 if (!this._flights)
5273 5287 { this._flights = []; }
@@ -6966,7 +6980,6 @@ function tickView (dt)
6966 6980 placeTile(app.cells[i], col, row);
6967 6981 }
6968 6982
6969 previewOutgoingFlights();
6970 6983 app.core.tick(dt);
6971 6984 if (app.offline && app.battle)
6972 6985 { tickOffline(dt); }
@@ -7812,12 +7825,16 @@ function updateColumnWarn (dt)
7812 7825 }
7813 7826
7814 7827 /**
7815 * Take over a rocket that is about to leave the top of a field (the
7816 * player's, or a bot's) so the flight starts at the real cell and
7817 * continues its upward motion (t1134). Shared by offline and online.
7828 * A flight starts only when a block has actually left the field
7829 * (y ≥ height, the same threshold as cullOffTop). Rockets that
7830 * peak below the top and fall back must never get an arc (t1137).
7831 * Shared by the player's field, enemy minis, offline and online.
7818 7832 */
7819 7833 function previewOutgoingFlights ()
7820 7834 {
7835 // Intentionally not called before core.tick: a block still on
7836 // the field (y < 13) is not a shot yet. Flights are spawned
7837 // from consumeOutgoingShots after cull, at the exit pose.
7821 7838 if (typeof Online === 'undefined' || !Online.previewExit)
7822 7839 { return; }
7823 7840 if (app.core)
@@ -7838,11 +7855,16 @@ function previewCoreExits (core, fromId)
7838 7855 {
7839 7856 if (!core || !core.blocks)
7840 7857 { return; }
7858 var height = core.height != null ? core.height : 13;
7841 7859 var blocks = core.blocks;
7842 7860 for (var i = 0; i < blocks.length; i++)
7843 7861 {
7844 7862 var b = blocks[i];
7845 if (b.y < 11.6)
7863 if (b.state === 'manual')
7864 { continue; }
7865 if (typeof Online.hasLeftTheField === 'function'
7866 ? !Online.hasLeftTheField(b.y, height)
7867 : !(b.y >= height - 1e-9))
7846 7868 { continue; }
7847 7869 if (!(b.vy > 0))
7848 7870 { continue; }
@@ -5079,7 +5079,7 @@ Online.spawnFlights = function (results, locals)
5079 else if (kind === 'player-to-enemy' || kind === 'player-miss')
5079 else if (kind === 'player-to-enemy' || kind === 'player-miss')
5080 { start = this._flightStart(startCol, startY); }
5080 { start = this._flightStart(startCol, startY); }
5081 else if (startCol != null || startY != null)
5081 else if (startCol != null || startY != null)
5082 { start = this.miniCellViewport(fromId, startCol, startY != null ? startY : 12); }
5082 { start = this.miniCellViewport(fromId, startCol, startY != null ? startY : 13); }
5083 else
5083 else
5084 { start = this._miniAnchor(fromId, 'out'); }
5084 { start = this._miniAnchor(fromId, 'out'); }
5085
5085
@@ -5199,7 +5199,7 @@ Online.rememberFlightLocal = function (shot, startX, startY)
5199Online._flightStart = function (col, y)
5199Online._flightStart = function (col, y)
5200{
5200{
5201 if (y == null || !isFinite(y))
5201 if (y == null || !isFinite(y))
5202 { y = 12; }
5202 { y = 13; }
5203 return this.cellViewport(col == null ? 4.5 : col, y);
5203 return this.cellViewport(col == null ? 4.5 : col, y);
5204};
5204};
5205
5205
@@ -5258,16 +5258,30 @@ Online._findFlight = function (sid)
5258};
5258};
5259
5259
5260/**
5260/**
5261 * Early visual takeover: a flying rocket near the top of a field
5261 * True once a block has really left the field, matching cullOffTop
5262 * becomes a flight sprite at its exact cell, so it is seen flying
5262 * (y ≥ height, default 13). Used so an arc never starts for a
5263 * *out* rather than popping in above the canvas (t1134). When the
5263 * rocket that only peaked near the top and fell back (t1137).
5264 * shot is later dispatched, `retargetFlight` picks up from the
5264 */
5265 * current pose and aims at the real landing column.
5265Online.EXIT_Y = 13;
5266Online.hasLeftTheField = function (y, height)
5267{
5268 height = height == null ? this.EXIT_Y : height;
5269 return y != null && isFinite(y) && y >= height - 1e-9;
5270};
5271
5272/**
5273 * Start a flight only at the true exit (y ≥ 13). Callers that pass
5274 * a rocket still on the field are ignored, so a fallback never
5275 * shows a phantom arc (t1137). The start pose is the exit cell,
5276 * continuing upward; retargetFlight aims it at the real target
5277 * if a preview was used in the same frame as cull.
5266 */
5278 */
5267Online.previewExit = function (info)
5279Online.previewExit = function (info)
5268{
5280{
5269 if (!info || info.id == null)
5281 if (!info || info.id == null)
5270 { return; }
5282 { return null; }
5283 if (!this.hasLeftTheField(info.y))
5284 { return null; }
5271 var sid = String(info.id);
5285 var sid = String(info.id);
5272 if (!this._flights)
5286 if (!this._flights)
5273 { this._flights = []; }
5287 { this._flights = []; }
@@ -6966,7 +6980,6 @@ function tickView (dt)
6966 placeTile(app.cells[i], col, row);
6980 placeTile(app.cells[i], col, row);
6967 }
6981 }
6968
6982
6969 previewOutgoingFlights();
6970 app.core.tick(dt);
6983 app.core.tick(dt);
6971 if (app.offline && app.battle)
6984 if (app.offline && app.battle)
6972 { tickOffline(dt); }
6985 { tickOffline(dt); }
@@ -7812,12 +7825,16 @@ function updateColumnWarn (dt)
7812}
7825}
7813
7826
7814/**
7827/**
7815 * Take over a rocket that is about to leave the top of a field (the
7828 * A flight starts only when a block has actually left the field
7816 * player's, or a bot's) so the flight starts at the real cell and
7829 * (y ≥ height, the same threshold as cullOffTop). Rockets that
7817 * continues its upward motion (t1134). Shared by offline and online.
7830 * peak below the top and fall back must never get an arc (t1137).
7831 * Shared by the player's field, enemy minis, offline and online.
7818 */
7832 */
7819function previewOutgoingFlights ()
7833function previewOutgoingFlights ()
7820{
7834{
7835 // Intentionally not called before core.tick: a block still on
7836 // the field (y < 13) is not a shot yet. Flights are spawned
7837 // from consumeOutgoingShots after cull, at the exit pose.
7821 if (typeof Online === 'undefined' || !Online.previewExit)
7838 if (typeof Online === 'undefined' || !Online.previewExit)
7822 { return; }
7839 { return; }
7823 if (app.core)
7840 if (app.core)
@@ -7838,11 +7855,16 @@ function previewCoreExits (core, fromId)
7838{
7855{
7839 if (!core || !core.blocks)
7856 if (!core || !core.blocks)
7840 { return; }
7857 { return; }
7858 var height = core.height != null ? core.height : 13;
7841 var blocks = core.blocks;
7859 var blocks = core.blocks;
7842 for (var i = 0; i < blocks.length; i++)
7860 for (var i = 0; i < blocks.length; i++)
7843 {
7861 {
7844 var b = blocks[i];
7862 var b = blocks[i];
7845 if (b.y < 11.6)
7863 if (b.state === 'manual')
7864 { continue; }
7865 if (typeof Online.hasLeftTheField === 'function'
7866 ? !Online.hasLeftTheField(b.y, height)
7867 : !(b.y >= height - 1e-9))
7846 { continue; }
7868 { continue; }
7847 if (!(b.vy > 0))
7869 if (!(b.vy > 0))
7848 { continue; }
7870 { continue; }