feat: start a flight only after a block has left the field (t1137)
The y ≳ 11.6 preview started an arc for rockets that peaked short and fell back, so they flew out and back in. Arcs now begin only at the real shot / cullOffTop threshold (y ≥ 13), on the player's field, enemy minis, offline and online. previewExit refuses anything below that. The handoff is still the exit pose, full size, going up.
@@ -761,7 +761,6 @@ function tickView (dt)
761
761
placeTile(app.cells[i], col, row);
762
762
}
763
763
764
previewOutgoingFlights();
765
764
app.core.tick(dt);
766
765
if (app.offline && app.battle)
767
766
{ tickOffline(dt); }
@@ -1607,12 +1606,16 @@ function updateColumnWarn (dt)
1607
1606
}
1608
1607
1609
1608
/**
1610
* Take over a rocket that is about to leave the top of a field (the
1611
* player's, or a bot's) so the flight starts at the real cell and
1612
* continues its upward motion (t1134). Shared by offline and online.
1609
* A flight starts only when a block has actually left the field
1610
* (y ≥ height, the same threshold as cullOffTop). Rockets that
1611
* peak below the top and fall back must never get an arc (t1137).
1612
* Shared by the player's field, enemy minis, offline and online.
1613
1613
*/
1614
1614
function previewOutgoingFlights ()
1615
1615
{
1616
// Intentionally not called before core.tick: a block still on
1617
// the field (y < 13) is not a shot yet. Flights are spawned
1618
// from consumeOutgoingShots after cull, at the exit pose.
1616
1619
if (typeof Online === 'undefined' || !Online.previewExit)
1617
1620
{ return; }
1618
1621
if (app.core)
@@ -1633,11 +1636,16 @@ function previewCoreExits (core, fromId)
1633
1636
{
1634
1637
if (!core || !core.blocks)
1635
1638
{ return; }
1639
var height = core.height != null ? core.height : 13;
1636
1640
var blocks = core.blocks;
1637
1641
for (var i = 0; i < blocks.length; i++)
1638
1642
{
1639
1643
var b = blocks[i];
1640
if (b.y < 11.6)
1644
if (b.state === 'manual')
1645
{ continue; }
1646
if (typeof Online.hasLeftTheField === 'function'
1647
? !Online.hasLeftTheField(b.y, height)
1648
: !(b.y >= height - 1e-9))
1641
1649
{ continue; }
1642
1650
if (!(b.vy > 0))
1643
1651
{ continue; }
@@ -761,7 +761,6 @@ function tickView (dt)761
placeTile(app.cells[i], col, row);761
placeTile(app.cells[i], col, row);762
}762
}763
763
764
previewOutgoingFlights();765
app.core.tick(dt);764
app.core.tick(dt);766
if (app.offline && app.battle)765
if (app.offline && app.battle)767
{ tickOffline(dt); }766
{ tickOffline(dt); }@@ -1607,12 +1606,16 @@ function updateColumnWarn (dt)1607
}1606
}1608
1607
1609
/**1608
/**1610
* Take over a rocket that is about to leave the top of a field (the1609
* A flight starts only when a block has actually left the field1611
* player's, or a bot's) so the flight starts at the real cell and1610
* (y ≥ height, the same threshold as cullOffTop). Rockets that1612
* continues its upward motion (t1134). Shared by offline and online.1611
* peak below the top and fall back must never get an arc (t1137).1612
* Shared by the player's field, enemy minis, offline and online.1613
*/1613
*/1614
function previewOutgoingFlights ()1614
function previewOutgoingFlights ()1615
{1615
{1616
// Intentionally not called before core.tick: a block still on1617
// the field (y < 13) is not a shot yet. Flights are spawned1618
// from consumeOutgoingShots after cull, at the exit pose.1616
if (typeof Online === 'undefined' || !Online.previewExit)1619
if (typeof Online === 'undefined' || !Online.previewExit)1617
{ return; }1620
{ return; }1618
if (app.core)1621
if (app.core)@@ -1633,11 +1636,16 @@ function previewCoreExits (core, fromId)1633
{1636
{1634
if (!core || !core.blocks)1637
if (!core || !core.blocks)1635
{ return; }1638
{ return; }1639
var height = core.height != null ? core.height : 13;1636
var blocks = core.blocks;1640
var blocks = core.blocks;1637
for (var i = 0; i < blocks.length; i++)1641
for (var i = 0; i < blocks.length; i++)1638
{1642
{1639
var b = blocks[i];1643
var b = blocks[i];1640
if (b.y < 11.6)1644
if (b.state === 'manual')1645
{ continue; }1646
if (typeof Online.hasLeftTheField === 'function'1647
? !Online.hasLeftTheField(b.y, height)1648
: !(b.y >= height - 1e-9))1641
{ continue; }1649
{ continue; }1642
if (!(b.vy > 0))1650
if (!(b.vy > 0))1643
{ continue; }1651
{ continue; }@@ -1019,7 +1019,7 @@ Online.spawnFlights = function (results, locals)
1019
1019
else if (kind === 'player-to-enemy' || kind === 'player-miss')
1020
1020
{ start = this._flightStart(startCol, startY); }
1021
1021
else if (startCol != null || startY != null)
1022
{ start = this.miniCellViewport(fromId, startCol, startY != null ? startY : 12); }
1022
{ start = this.miniCellViewport(fromId, startCol, startY != null ? startY : 13); }
1023
1023
else
1024
1024
{ start = this._miniAnchor(fromId, 'out'); }
1025
1025
@@ -1139,7 +1139,7 @@ Online.rememberFlightLocal = function (shot, startX, startY)
1139
1139
Online._flightStart = function (col, y)
1140
1140
{
1141
1141
if (y == null || !isFinite(y))
1142
{ y = 12; }
1142
{ y = 13; }
1143
1143
return this.cellViewport(col == null ? 4.5 : col, y);
1144
1144
};
1145
1145
@@ -1198,16 +1198,30 @@ Online._findFlight = function (sid)
1198
1198
};
1199
1199
1200
1200
/**
1201
* Early visual takeover: a flying rocket near the top of a field
1202
* becomes a flight sprite at its exact cell, so it is seen flying
1203
* *out* rather than popping in above the canvas (t1134). When the
1204
* shot is later dispatched, `retargetFlight` picks up from the
1205
* current pose and aims at the real landing column.
1201
* True once a block has really left the field, matching cullOffTop
1202
* (y ≥ height, default 13). Used so an arc never starts for a
1203
* rocket that only peaked near the top and fell back (t1137).
1204
*/
1205
Online.EXIT_Y = 13;
1206
Online.hasLeftTheField = function (y, height)
1207
{
1208
height = height == null ? this.EXIT_Y : height;
1209
return y != null && isFinite(y) && y >= height - 1e-9;
1210
};
1211
1212
/**
1213
* Start a flight only at the true exit (y ≥ 13). Callers that pass
1214
* a rocket still on the field are ignored, so a fallback never
1215
* shows a phantom arc (t1137). The start pose is the exit cell,
1216
* continuing upward; retargetFlight aims it at the real target
1217
* if a preview was used in the same frame as cull.
1206
1218
*/
1207
1219
Online.previewExit = function (info)
1208
1220
{
1209
1221
if (!info || info.id == null)
1210
{ return; }
1222
{ return null; }
1223
if (!this.hasLeftTheField(info.y))
1224
{ return null; }
1211
1225
var sid = String(info.id);
1212
1226
if (!this._flights)
1213
1227
{ this._flights = []; }
@@ -1019,7 +1019,7 @@ Online.spawnFlights = function (results, locals)1019
else if (kind === 'player-to-enemy' || kind === 'player-miss')1019
else if (kind === 'player-to-enemy' || kind === 'player-miss')1020
{ start = this._flightStart(startCol, startY); }1020
{ start = this._flightStart(startCol, startY); }1021
else if (startCol != null || startY != null)1021
else if (startCol != null || startY != null)1022
{ start = this.miniCellViewport(fromId, startCol, startY != null ? startY : 12); }1022
{ start = this.miniCellViewport(fromId, startCol, startY != null ? startY : 13); }1023
else1023
else1024
{ start = this._miniAnchor(fromId, 'out'); }1024
{ start = this._miniAnchor(fromId, 'out'); }1025
1025
@@ -1139,7 +1139,7 @@ Online.rememberFlightLocal = function (shot, startX, startY)1139
Online._flightStart = function (col, y)1139
Online._flightStart = function (col, y)1140
{1140
{1141
if (y == null || !isFinite(y))1141
if (y == null || !isFinite(y))1142
{ y = 12; }1142
{ y = 13; }1143
return this.cellViewport(col == null ? 4.5 : col, y);1143
return this.cellViewport(col == null ? 4.5 : col, y);1144
};1144
};1145
1145
@@ -1198,16 +1198,30 @@ Online._findFlight = function (sid)1198
};1198
};1199
1199
1200
/**1200
/**1201
* Early visual takeover: a flying rocket near the top of a field1201
* True once a block has really left the field, matching cullOffTop1202
* becomes a flight sprite at its exact cell, so it is seen flying1202
* (y ≥ height, default 13). Used so an arc never starts for a1203
* *out* rather than popping in above the canvas (t1134). When the1203
* rocket that only peaked near the top and fell back (t1137).1204
* shot is later dispatched, `retargetFlight` picks up from the1204
*/1205
* current pose and aims at the real landing column.1205
Online.EXIT_Y = 13;1206
Online.hasLeftTheField = function (y, height)1207
{1208
height = height == null ? this.EXIT_Y : height;1209
return y != null && isFinite(y) && y >= height - 1e-9;1210
};1211
1212
/**1213
* Start a flight only at the true exit (y ≥ 13). Callers that pass1214
* a rocket still on the field are ignored, so a fallback never1215
* shows a phantom arc (t1137). The start pose is the exit cell,1216
* continuing upward; retargetFlight aims it at the real target1217
* if a preview was used in the same frame as cull.1206
*/1218
*/1207
Online.previewExit = function (info)1219
Online.previewExit = function (info)1208
{1220
{1209
if (!info || info.id == null)1221
if (!info || info.id == null)1210
{ return; }1222
{ return null; }1223
if (!this.hasLeftTheField(info.y))1224
{ return null; }1211
var sid = String(info.id);1225
var sid = String(info.id);1212
if (!this._flights)1226
if (!this._flights)1213
{ this._flights = []; }1227
{ this._flights = []; }