From 2dc8274f34a6bee9855b5b2f6131d54401855b58 Mon Sep 17 00:00:00 2001 From: jvanvik Date: Mon, 9 Nov 2026 22:55:24 +0100 Subject: [PATCH] The no-cable hint in the link window names the satellite (#83) Upstream 3.3's hint for a coast where no subsea cable lands (#321) said only a cable of your own could get to Iqaluit or Adamstown, and left satellites out at Pevek, though a teleport reaches all three. Once teleports are on sale (level 2) and a bird you may rent from sees the city, the 'own' case says a satellite circuit or a cable of your own can get there (a new string), and every case adds the satellite line: the city panel's 'Your teleports can reach' with a button per teleport to its order sheet (satOpen), or where to build one. Not in puzzles, and not before level 2, like the rest of the satellites. --- CHANGELOG.md | 1 + site/i18n/de.js | 1 + site/i18n/es.js | 1 + site/i18n/fr.js | 1 + site/i18n/it.js | 1 + site/i18n/pt.js | 1 + src/game/93-ui/72-teleport-panels.js | 6 ++++ src/game/95-modals/70-link-modal.js | 6 ++-- src/i18n/en.js | 1 + tests/link-modal-no-cable.test.js | 52 ++++++++++++++++++++++++++++ 10 files changed, 68 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 672976a..a57f70d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- Linking to an island or remote town where no subsea cable lands, like Iqaluit or Adamstown, now says that a satellite can get there too. Each of your teleports that reaches it gets a button to its order sheet; without one, the window says where a teleport would have to go (#83). - IPv4 notices in the NOC's notifications, like "Your IPv4 is full", now have an Open button that takes you to the bank's Address space, as the notice's own button does (#150). - In dark mode, red warning text is now a lighter red that reads well on the dark panels, and the capacity market's Hot and Cool tags take the night colours instead of staying bright pastel chips (#80). - The NOC dashboard's connections list no longer breaks when one of your fabric ports is already at 400G, the biggest a fabric port gets: it offers a LAG member instead of an upgrade. diff --git a/site/i18n/de.js b/site/i18n/de.js index b68b554..b7977c7 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -2943,6 +2943,7 @@ "link_modal.no_subsea_cable_lands_in_city":"In {city} landet kein Seekabel an. Die nächste Landestation ist {near}: Verleg zuerst Glasfaser dorthin und nimm dann von dort ein Kabel.", "link_modal.no_subsea_cable_lands_in_city_land":"In {city} landet noch kein Seekabel an. Komm über Land hin oder verleg dein eigenes Seekabel.", "link_modal.no_subsea_cable_lands_in_city_own":"In {city} landet noch kein Seekabel an, und keine Straße und keine Glasfaser führen über Land dorthin. Nur ein eigenes Seekabel kommt da hin.", +"link_modal.no_subsea_cable_lands_in_city_own_sat":"In {city} landet noch kein Seekabel an, und keine Straße und keine Glasfaser führen über Land dorthin. Nur eine Satellitenverbindung oder ein eigenes Seekabel kommt da hin.", "link_modal.nobody_sells_capacity_between_kyiv":"Niemand verkauft Kapazität zwischen Kyjiw und Moskau, und niemand wird es tun. Route stattdessen über Warschau, Bukarest oder Helsinki.", "link_modal.not_without_a_license":"Nicht ohne Lizenz", "link_modal.premium_crossing_60_3_loss":"Premium-Übergang +60 % · ~3 % Verlust", diff --git a/site/i18n/es.js b/site/i18n/es.js index 291b287..97adec6 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -2941,6 +2941,7 @@ "link_modal.no_subsea_cable_lands_in_city":"Ningún cable submarino aterriza en {city}. La estación de aterrizaje más cercana es {near}: tiende fibra hasta allí primero y luego toma un cable desde ella.", "link_modal.no_subsea_cable_lands_in_city_land":"Ningún cable submarino aterriza todavía en {city}. Llega por tierra o tiende tu propio cable submarino.", "link_modal.no_subsea_cable_lands_in_city_own":"Ningún cable submarino aterriza todavía en {city}, y ninguna carretera ni fibra llega por tierra. Solo un cable submarino propio puede llegar allí.", +"link_modal.no_subsea_cable_lands_in_city_own_sat":"Ningún cable submarino aterriza todavía en {city}, y ninguna carretera ni fibra llega por tierra. Solo un circuito satelital o un cable submarino propio puede llegar allí.", "link_modal.nobody_sells_capacity_between_kyiv":"Nadie vende capacidad entre Kiev y Moscú, y nadie va a hacerlo. Rodea por Varsovia, Bucarest o Helsinki.", "link_modal.not_without_a_license":"No sin licencia", "link_modal.premium_crossing_60_3_loss":"Cruce premium +60 % · ~3 % de pérdida", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index bd38377..fbab35a 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -2941,6 +2941,7 @@ "link_modal.no_subsea_cable_lands_in_city":"Aucun câble sous-marin n’atterrit à {city}. La station d’atterrissement la plus proche est {near} : amène d’abord la fibre jusque-là, puis prends un câble depuis là-bas.", "link_modal.no_subsea_cable_lands_in_city_land":"Aucun câble sous-marin n’atterrit encore à {city}. Arrive par voie terrestre, ou pose ton propre câble sous-marin.", "link_modal.no_subsea_cable_lands_in_city_own":"Aucun câble sous-marin n’atterrit encore à {city}, et aucune route ni fibre n’y mène par voie terrestre. Seul ton propre câble sous-marin peut y arriver.", +"link_modal.no_subsea_cable_lands_in_city_own_sat":"Aucun câble sous-marin n’atterrit encore à {city}, et aucune route ni fibre n’y mène par voie terrestre. Seul un circuit satellite ou ton propre câble sous-marin peut y arriver.", "link_modal.nobody_sells_capacity_between_kyiv":"Personne ne vend de capacité entre Kyiv et Moscow, et personne ne le fera. Passe plutôt par Warsaw, Bucharest ou Helsinki.", "link_modal.not_without_a_license":"Pas sans licence", "link_modal.premium_crossing_60_3_loss":"Passage premium +60 % · ~3 % de perte", diff --git a/site/i18n/it.js b/site/i18n/it.js index 12a0ea2..ae475e5 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -2941,6 +2941,7 @@ "link_modal.no_subsea_cable_lands_in_city":"Nessun cavo sottomarino approda a {city}. La stazione di approdo più vicina è {near}: porta prima la fibra fin lì, poi prendi un cavo da lì.", "link_modal.no_subsea_cable_lands_in_city_land":"Nessun cavo sottomarino approda ancora a {city}. Arrivaci via terra, oppure posa un cavo sottomarino tutto tuo.", "link_modal.no_subsea_cable_lands_in_city_own":"Nessun cavo sottomarino approda ancora a {city}, e nessuna strada o fibra ci arriva via terra. Solo un cavo sottomarino tutto tuo può arrivarci.", +"link_modal.no_subsea_cable_lands_in_city_own_sat":"Nessun cavo sottomarino approda ancora a {city}, e nessuna strada o fibra ci arriva via terra. Solo un circuito satellitare o un cavo sottomarino tutto tuo può arrivarci.", "link_modal.nobody_sells_capacity_between_kyiv":"Nessuno vende capacità tra Kyiv e Moscow, e nessuno lo farà mai. Passa invece da Warsaw, Bucharest o Helsinki.", "link_modal.not_without_a_license":"Non senza una licenza", "link_modal.premium_crossing_60_3_loss":"Attraversamento premium +60% · ~3% di perdita", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index c354117..9028015 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -2941,6 +2941,7 @@ "link_modal.no_subsea_cable_lands_in_city":"Nenhum cabo submarino chega a {city}. A estação de chegada mais próxima é {near}: leve fibra até lá primeiro e depois pegue um cabo de lá.", "link_modal.no_subsea_cable_lands_in_city_land":"Nenhum cabo submarino chega a {city} ainda. Chegue lá por terra ou lance seu próprio cabo submarino.", "link_modal.no_subsea_cable_lands_in_city_own":"Nenhum cabo submarino chega a {city} ainda, e nenhuma estrada ou fibra chega lá por terra. Só um cabo submarino seu pode chegar lá.", +"link_modal.no_subsea_cable_lands_in_city_own_sat":"Nenhum cabo submarino chega a {city} ainda, e nenhuma estrada ou fibra chega lá por terra. Só um circuito de satélite ou um cabo submarino seu pode chegar lá.", "link_modal.nobody_sells_capacity_between_kyiv":"Ninguém vende capacidade entre Kyiv e Moscou, e ninguém vai vender. Passe por Varsóvia, Bucareste ou Helsinque.", "link_modal.not_without_a_license":"Não sem licença", "link_modal.premium_crossing_60_3_loss":"Travessia premium +60% · ~3% de perda", diff --git a/src/game/93-ui/72-teleport-panels.js b/src/game/93-ui/72-teleport-panels.js index 1a7f3c8..0b16309 100644 --- a/src/game/93-ui/72-teleport-panels.js +++ b/src/game/93-ui/72-teleport-panels.js @@ -25,6 +25,12 @@ function teleHtml(c){if(pzOn())return '';const t=teleOf(c),from=satFrom(c),open= return h+``;} // Teleports that reach city c: a button each, to the order sheet. const satReach=(c,from)=>`

${tr('satellites.reachable_from_your_teleports',{city:CITY[c].name})}

${from.slice(0,4).map(a=>btn(tr('fiber_modals.from_city',{city:CITY[a].name}),'satOpen',{a,b:c},'ghost sm')).join('')}
`; +// Whether a satellite can get to city c: a teleport of yours reaches it, or (once teleports are on sale) a bird you may +// rent from sees it. Never in a puzzle, as the rest of the satellites. +const satCan=c=>!pzOn()&&(satFrom(c).length>0||lvl()>=SAT_ORB.geo.lv&&satRemote(c)&&teleSees(c).some(id=>lvl()>=SAT_ORB[SATS[id].orb].lv)); +// Under the link window's "no subsea cable lands here" (#321): the teleports that reach c, a button each to the order +// sheet, or where to build one. +const satNoCable=c=>{const from=satFrom(c);return from.length?satReach(c,from):`

${tr('satellites.no_teleport_reaches_city',{city:CITY[c].name})}

`;}; // A city without a POP of yours, that a teleport of yours reaches: a POP and a circuit in one go. function satNoPop(c){if(pzOn()||S.pops[c])return '';const from=satFrom(c);if(!from.length)return ''; return `

🛰️ ${tr('satellites.by_satellite')}

${tr('satellites.no_cable_needed_a_pop_here',{city:CITY[c].name})}

${satReach(c,from)}
`;} diff --git a/src/game/95-modals/70-link-modal.js b/src/game/95-modals/70-link-modal.js index 998bd77..6c3575a 100644 --- a/src/game/95-modals/70-link-modal.js +++ b/src/game/95-modals/70-link-modal.js @@ -13,9 +13,9 @@ function openLinkModal(a,b){ if(mode==='df'){openModal(head+dfModalBody(a,b,km,pop));return;} if(mode==='xp'){openModal(head+xpModalBody(a,b,xr));return;} if(sub&&!cablesOk(a,b).length){const fr=[...new Set(CABLE_PAIRS.filter(c=>c.a===a||c.b===a).map(c=>CITY[c.a===a?c.b:c.a].name))],dry=[a,b].find(c=>!landing(c)); - // a beach with no cable yet (#321): hopping cannot help, only a road in or a cable of your own - const bare=!dry&&[a,b].find(c=>!CABLE_PAIRS.some(p=>p.a===c||p.b===c)),road=bare&&CITIES.some(x=>x.id!==bare&&!isSub(bare,x.id)); - openModal(head+`

${dry?tr('link_modal.no_subsea_cable_lands_in_city',{city:CITY[dry].name,near:CITY[nearLanding(dry)].name}):bare?(road?tr('link_modal.no_subsea_cable_lands_in_city_land',{city:CITY[bare].name}):tr('link_modal.no_subsea_cable_lands_in_city_own',{city:CITY[bare].name})):tr('link_modal.no_subsea_cable_lands_in_both',{a:CITY[a].name,b:CITY[b].name,list:fr.join(', ')})}

${(cabOpen()?!ownCabWhy(a,b):bare)?ownCabTeaser(a,b):''}`);return;} + // a beach with no cable yet (#321): hopping cannot help, only a road in, a cable of your own, or a satellite (#83) + const bare=!dry&&[a,b].find(c=>!CABLE_PAIRS.some(p=>p.a===c||p.b===c)),road=bare&&CITIES.some(x=>x.id!==bare&&!isSub(bare,x.id)),far=dry||bare,sat=!!far&&satCan(far); + openModal(head+`

${dry?tr('link_modal.no_subsea_cable_lands_in_city',{city:CITY[dry].name,near:CITY[nearLanding(dry)].name}):bare?(road?tr('link_modal.no_subsea_cable_lands_in_city_land',{city:CITY[bare].name}):sat?tr('link_modal.no_subsea_cable_lands_in_city_own_sat',{city:CITY[bare].name}):tr('link_modal.no_subsea_cable_lands_in_city_own',{city:CITY[bare].name})):tr('link_modal.no_subsea_cable_lands_in_both',{a:CITY[a].name,b:CITY[b].name,list:fr.join(', ')})}

${sat?satNoCable(far):''}${(cabOpen()?!ownCabWhy(a,b):bare)?ownCabTeaser(a,b):''}`);return;} if(isSub(a,b)&&S.ev.landban&&S.ev.landban.until>S.day&&[a,b].includes(S.ev.landban.city)){openModal(head+`

${tr('link_modal.the_landing_permit_dispute_in_city',{city:CITY[S.ev.landban.city].name,n:S.ev.landban.until-S.day})}

`);return;} if(uaePair(a,b)||andesPair(a,b)||rainPair(a,b)||borderPair(a,b))route+=`

${landWhy(a,b)}

`; route+=`

📈 ${esc(marketNote(a,b,sub))}

`; diff --git a/src/i18n/en.js b/src/i18n/en.js index 8533eba..0c67da8 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -2942,6 +2942,7 @@ "link_modal.no_subsea_cable_lands_in_city":"No subsea cable lands in {city}. The nearest landing station is {near}: run fiber there first, then take a cable from it.", "link_modal.no_subsea_cable_lands_in_city_land":"No subsea cable lands in {city} yet. Reach it overland, or lay a subsea cable of your own.", "link_modal.no_subsea_cable_lands_in_city_own":"No subsea cable lands in {city} yet, and no road or fiber reaches it overland. Only a subsea cable of your own can get there.", +"link_modal.no_subsea_cable_lands_in_city_own_sat":"No subsea cable lands in {city} yet, and no road or fiber reaches it overland. Only a satellite circuit or a subsea cable of your own can get there.", "link_modal.nobody_sells_capacity_between_kyiv":"Nobody sells capacity between Kyiv and Moscow, and nobody is going to. Route through Warsaw, Bucharest or Helsinki instead.", "link_modal.not_without_a_license":"Not without a license", "link_modal.premium_crossing_60_3_loss":"Premium crossing +60% · ~3% loss", diff --git a/tests/link-modal-no-cable.test.js b/tests/link-modal-no-cable.test.js index 74f8feb..e1aca24 100644 --- a/tests/link-modal-no-cable.test.js +++ b/tests/link-modal-no-cable.test.js @@ -37,3 +37,55 @@ test('#321 a coast with no cable but a road in: reach it overland, never "hop th assert.doesNotMatch(t, /reach \./); assert.deepEqual(errors, []); }); + +// #83 in the fork: a teleport reaches small islands and remote towns, so "only a cable of your own can get there" was +// wrong for Iqaluit and Adamstown (and Pevek's hint left satellites out). Once teleports are on sale (level 2) the hint +// names the satellite too, with a button to the order sheet from each teleport of yours that reaches the city. +test('#83 no cable lands there, but a satellite does: the hint says so, with the way to order it', () => { + const { ev, dom, errors } = load(); + const doc = dom.window.document; + ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();closeModal();S.cash=1e9;S.lvl=1;for(const g of GOALS)S.done[g.id]=0;S.nextFail=S.nextEvent=1e9;UI.speed=0"); + const own = (c) => ev(`tr('link_modal.no_subsea_cable_lands_in_city_own',{city:CITY.${c}.name})`); + const ownSat = (c) => ev(`tr('link_modal.no_subsea_cable_lands_in_city_own_sat',{city:CITY.${c}.name})`); + const none = (c) => ev(`tr('satellites.no_teleport_reaches_city',{city:CITY.${c}.name})`); + const reach = (c) => ev(`tr('satellites.reachable_from_your_teleports',{city:CITY.${c}.name})`); + assert.notEqual(ownSat('yfb'), 'link_modal.no_subsea_cable_lands_in_city_own_sat', 'the new text is there'); + // Level 1: no teleport on sale yet, the hint is as before. + let t = card(ev, 'nuk', 'yfb'); + assert.ok(t.includes(own('yfb')), t); + assert.doesNotMatch(t, /satellite/i); + // Level 2: a bird sees Iqaluit and Adamstown, so the cable is not the only way; no teleport of yours reaches them yet. + ev('S.lvl=2'); + for (const [a, b] of [['nuk', 'yfb'], ['yfb', 'nuk'], ['nyc', 'pcn']]) { + const c = b === 'nuk' ? a : b; + t = card(ev, a, b); + assert.ok(t.includes(ownSat(c)) && !t.includes(own(c)), `${a}→${b}: ${t}`); + assert.ok(t.includes(none(c)), `${a}→${b} says where a teleport would have to go: ${t}`); + assert.match(t, /level 9 or Tier 1/, 'the cable of your own is still offered'); + } + // Pevek has a road in: that text stays, and the satellite comes after it. Alice Springs has no beach at all. + t = card(ev, 'nyc', 'pvs'); + assert.ok(t.includes(ev("tr('link_modal.no_subsea_cable_lands_in_city_land',{city:CITY.pvs.name})")) && t.includes(none('pvs')), t); + t = card(ev, 'nyc', 'asp'); + assert.ok(t.includes(none('asp')), t); + // Murmansk is no remote town: no satellite serves it. + t = card(ev, 'nyc', 'mmk'); + assert.doesNotMatch(t, /satellite|teleport/i, t); + // A teleport in New York sees Iqaluit over the Americas bird: a button to the order sheet, from there. + ev("ACT.buildPop({city:'nyc'});closeModal();ACT.teleBuild({city:'nyc'})"); + assert.ok(ev("teleOf('nyc')===1&&satBirds('nyc','yfb').includes('gx19')")); + ev("window.innerWidth=360;window.innerHeight=740;UI.lmode='wave';openLinkModal('nuk','yfb')"); + t = doc.getElementById('modalCard').textContent; + assert.ok(t.includes(ownSat('yfb')) && t.includes(reach('yfb')) && !t.includes(none('yfb')), t); + const go = [...doc.querySelectorAll('#modalCard [data-act="satOpen"]')]; + assert.deepEqual(go.map((b) => JSON.parse(b.dataset.args)), [{ a: 'nyc', b: 'yfb' }]); + go[0].click(); + assert.equal(doc.getElementById('modal').hidden, false); + assert.match(doc.getElementById('modalCard').textContent, /New York → Iqaluit/); + assert.ok(doc.querySelector('#modalCard [data-act="buySat"]'), 'the order sheet, with its circuits'); + ev('closeModal()'); + // Not in a puzzle, as the satellites themselves. + ev("localStorage.removeItem('sot-puzzles');pzBegin(pzDef('baltic'));closeModal()"); + assert.equal(ev("JSON.stringify([pzOn(),satCan('yfb')])"), '[true,false]'); + assert.deepEqual(errors, []); +});