Hold the lay ship through a construction delay instead of restarting the lay (#322)

A delay that hit your own subsea cable while it was being laid moved the
whole laying stretch later: the ship vanished, the laid km went back to
zero and the survey and factory could be hurried and paid for again. The
delay now holds the ship where it is (l.lay: start, share laid, resume
day), so laying picks up after the delay. Old saves without the field lay
as before; sanitize() repairs or drops it.
This commit is contained in:
Frederic Jung 2026-11-08 17:57:27 +00:00
parent 4292cd4c74
commit d971ded259
No known key found for this signature in database
6 changed files with 88 additions and 5 deletions

View file

@ -15,7 +15,7 @@ const subUpgradeReady=(l,k)=>l.kind==='df'&&l.sub&&l.own&&Number.isFinite(l['sub
const subUpgradeCost=(l,k)=>SUB_UPGRADES[k].cost+(k==='engineering'?Math.round(l.km*1000):0);
// Pending transmission work follows the construction schedule. Keep the actual
// shift (the last crew purchase can save fewer than 30 days) and completed work.
function setCableReady(l,ready,day=S.day){const shift=ready-l.ready;
function setCableReady(l,ready,day=S.day){const shift=ready-l.ready;layHold(l,shift,day);
if(l.kind==='df'&&l.own&&l.sub)for(const k of Object.keys(SUB_UPGRADES)){
const f='sub'+k;if(Number.isFinite(l[f])&&l[f]>day)l[f]=Math.max(day+1,l[f]+shift);
}l.ready=ready;