diff --git a/CHANGELOG.md b/CHANGELOG.md index 134efb7..e4b54ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ All notable changes to this project are documented here. The project follows - No circuit of any kind can be built between North and South Korea, and nothing leaves South Korea over land: every way out is a subsea cable. - The map zooms in twice as far, for crowded regions like New England or around Washington. - Cable ships at anchor sit a little further out from their port, and a tap on a city picks the city even with a ship close by. +- Agents playing through the Agent API can no longer start a link in a city where you have no POP, just as on the map. Before, an agent could sign a dark fiber IRU, lease a wave or lay a cable from such a city; now it is told why, and so is its dry run. +- Build POP in a small city that is off the map now says why it can't, and names a city nearby to build in instead. Founding your own exchange where you can't (mainland China, a city that already has one, a city with no POP) says why too. Before, both did nothing without a word, and an agent's dry run quoted a price. ## [2.8.0] — 2026-11-04 diff --git a/scripts/lib/fuzz-page.js b/scripts/lib/fuzz-page.js index d2a6f35..71d5ca5 100644 --- a/scripts/lib/fuzz-page.js +++ b/scripts/lib/fuzz-page.js @@ -130,7 +130,7 @@ for (const x of ixIdsIn(c)) if (S.ixp[x] === undefined) add('buyIx', { city: x, tier: S.day % 3 }); for (const n of NETS) if (n.pops.includes(c)) { if (S.day % 2 === 0 || n.cache) add('pni', { city: c, net: n.id, tier: n.id.length % 3 }); if (n.cache) add('cache', { city: c, net: n.id }); } for (const n of NETS) if (sellsAt(n, c) && (n.id.length + S.day) % 4 === 0) add('buyTransit', { city: c, net: n.id, tier: (S.day >> 2) % 3 }); - add('addRouter', { city: c }); add('upRouter', { city: c, g: 1 + (S.day % 4) }); add('foundIx', { city: c }); add('launchBB', { city: c }); add('addSite', { city: c }); + add('addRouter', { city: c }); add('upRouter', { city: c, g: 1 + (S.day % 4) }); if (!ixName(c) && !CITY[c].cn) add('foundIx', { city: c }); add('launchBB', { city: c }); add('addSite', { city: c }); } for (const c of S.caches) add('rmCache', { id: c.id }); for (const l of S.links) { add('setStandby', { id: l.id, on: !l.standby }); add('setMetric', { id: l.id, v: ['backup', 'avoid', 'prefer', 'normal'][(l.id.length + S.day) % 4] }); add('upLink', { id: l.id, tier: (S.day % 4) }); add('rmLink', { id: l.id }); add('addParallel', { id: l.id }); } diff --git a/site/i18n/de.js b/site/i18n/de.js index 7892575..194a959 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -3,6 +3,8 @@ // Style: informal "du"; networking terms stay English (Peering, Transit, Dark Fiber, Wave, Port, POP, IX…), but // plain "fiber" is "Glasfaser" and "fiber pair" is "Faserpaar". The add-strings skill has the full style notes. (window.I18N=window.I18N||{}).de={ +"action_helpers.city_already_has_an_exchange_ix":"{city} hat schon einen Exchange, {ix}.
Nimm dort einen Port, statt einen eigenen zu gründen.", +"action_helpers.city_is_off_the_map_small":"{city} ist nicht mehr auf der Karte.
Kleine Städte so nah an einer größeren gibt es in neuen Spielen nicht mehr. Bau stattdessen in {near}.", "action_helpers.light_fiber_pair_n_price":"Faserpaar {n} beleuchten {price}", "action_helpers.light_fiber_pair_n_price_mo":"Faserpaar {n} beleuchten {price} + {mo}/Monat", "action_helpers.n_fiber_pairs_lit_the_trench":"{n} Faserpaare beleuchtet, der Graben ist voll", @@ -14,6 +16,9 @@ "action_helpers.too_far_even_at_its_slowest":"Zu weit, selbst in der langsamsten Einstellung: Ein optischer Abschnitt ist hier {span} km lang, die Reichweite beträgt {max} km. Füge einen Regenerator-Standort hinzu (Line System).", "action_helpers.unlocks_at_customer_level_n":"Wird ab Kundenlevel {n} freigeschaltet.", "action_helpers.upgrades_cannot_stretch_this_optic":"Dieser Kanal reicht auf diesem Kabel {max} km weit; die Strecke ist {span} km lang. Unterwasser-Terminals und optisches Engineering verlängern diese Optik nicht. Diese reichen so weit: {optics}.", +"action_helpers.you_already_run_ix_in_city":"Du betreibst schon {ix} in {city}.", +"action_helpers.you_have_no_pop_in_city":"Du hast keinen POP in {city}.
Ein Link beginnt an einem deiner POPs und eröffnet am anderen Ende einen POP, wenn dort keiner ist.", +"action_helpers.you_have_no_pop_in_city_build":"Du hast keinen POP in {city}.
Bau dort zuerst einen und gründe dann den Exchange.", "actions.your_router_can_t_take_a":"Dein Router kann keinen {port}-Port aufnehmen.
Rüste ihn im Tab Infra auf.", "architect.anchor":"🐒 Platsch!", "architect.architect_runs":"Architekt-Runs", diff --git a/site/i18n/es.js b/site/i18n/es.js index af4378c..2f84cc6 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -1,6 +1,8 @@ // Spanish: the translation of every label in src/i18n/en.js. One entry per line, sorted by label; plurals are // {"one":…,"other":…}. Add or change entries with scripts/i18n-add.js, check with npm run i18n:check. (window.I18N=window.I18N||{}).es={ +"action_helpers.city_already_has_an_exchange_ix":"{city} ya tiene un intercambio, {ix}.
Contrata un puerto en él en lugar de fundar el tuyo.", +"action_helpers.city_is_off_the_map_small":"{city} ya no está en el mapa.
Las ciudades pequeñas tan cerca de una más grande ya no aparecen en partidas nuevas. Construye en {near}.", "action_helpers.light_fiber_pair_n_price":"Iluminar el par de fibra {n} {price}", "action_helpers.light_fiber_pair_n_price_mo":"Iluminar el par de fibra {n} {price} + {mo}/mes", "action_helpers.n_fiber_pairs_lit_the_trench":"{n} pares de fibra iluminados, la zanja está llena", @@ -12,6 +14,9 @@ "action_helpers.too_far_even_at_its_slowest":"Demasiado lejos incluso en su ajuste más lento: aquí un tramo óptico mide {span} km y el alcance es de {max} km. Añade un sitio regenerador (Sistema de línea).", "action_helpers.unlocks_at_customer_level_n":"Se desbloquea en el nivel de cliente {n}.", "action_helpers.upgrades_cannot_stretch_this_optic":"Este canal llega a {max} km en este cable; la ruta mide {span} km. Las terminales submarinas y la ingeniería óptica no alargan esta óptica. Estas sí llegan: {optics}.", +"action_helpers.you_already_run_ix_in_city":"Ya gestionas {ix} en {city}.", +"action_helpers.you_have_no_pop_in_city":"No tienes ningún POP en {city}.
Un enlace empieza en uno de tus POP y abre un POP en el otro extremo si hace falta.", +"action_helpers.you_have_no_pop_in_city_build":"No tienes ningún POP en {city}.
Construye uno allí primero y luego funda el intercambio.", "actions.your_router_can_t_take_a":"Tu router no admite un puerto de {port}.
Mejóralo en la pestaña Infra.", "architect.anchor":"🐒 ¡Chof!", "architect.architect_runs":"Partidas de arquitecto", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index 9a95c6b..fd33fd6 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -1,6 +1,8 @@ // French: the translation of every label in src/i18n/en.js. One entry per line, sorted by label; plurals are // {"one":…,"other":…}. Add or change entries with scripts/i18n-add.js, check with npm run i18n:check. (window.I18N=window.I18N||{}).fr={ +"action_helpers.city_already_has_an_exchange_ix":"{city} a déjà un IX, {ix}.
Prends-y un port au lieu de fonder le tien.", +"action_helpers.city_is_off_the_map_small":"{city} n’est plus sur la carte.
Les petites villes aussi proches d’une plus grande ne figurent plus dans les nouvelles parties. Construis plutôt à {near}.", "action_helpers.light_fiber_pair_n_price":"Allumer la paire {n} {price}", "action_helpers.light_fiber_pair_n_price_mo":"Allumer la paire {n} {price} + {mo}/mois", "action_helpers.n_fiber_pairs_lit_the_trench":"{n} paires de fibres allumées, la tranchée est pleine", @@ -12,6 +14,9 @@ "action_helpers.too_far_even_at_its_slowest":"Trop loin, même au débit le plus lent : ici une portée optique fait {span} km et l’optique va jusqu’à {max} km. Ajoute un site de régénération (Système de ligne).", "action_helpers.unlocks_at_customer_level_n":"Se débloque au niveau client {n}.", "action_helpers.upgrades_cannot_stretch_this_optic":"Ce canal porte à {max} km sur ce câble ; le tracé fait {span} km. Les terminaux sous-marins et l’ingénierie optique n’allongent pas cette optique. Celles-ci y arrivent : {optics}.", +"action_helpers.you_already_run_ix_in_city":"Tu gères déjà {ix} à {city}.", +"action_helpers.you_have_no_pop_in_city":"Tu n’as pas de POP à {city}.
Un lien part d’un de tes POP, et ouvre un POP à l’autre bout s’il en faut un.", +"action_helpers.you_have_no_pop_in_city_build":"Tu n’as pas de POP à {city}.
Construis-en d’abord un là-bas, puis fonde l’IX.", "actions.your_router_can_t_take_a":"Ton routeur ne supporte pas de port {port}.
Mets-le à niveau dans l’onglet Infra.", "architect.anchor":"🐒 Plouf !", "architect.architect_runs":"Parties d’architecte", diff --git a/site/i18n/it.js b/site/i18n/it.js index b0f53da..3c2dff6 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -1,6 +1,8 @@ // Italian: the translation of every label in src/i18n/en.js. One entry per line, sorted by label; plurals are // {"one":…,"other":…}. Add or change entries with scripts/i18n-add.js, check with npm run i18n:check. (window.I18N=window.I18N||{}).it={ +"action_helpers.city_already_has_an_exchange_ix":"{city} ha già un exchange, {ix}.
Prendi una porta lì invece di fondarne uno tuo.", +"action_helpers.city_is_off_the_map_small":"{city} non è più sulla mappa.
Le città piccole così vicine a una più grande non ci sono più nelle nuove partite. Costruisci invece a {near}.", "action_helpers.light_fiber_pair_n_price":"Accendi la coppia {n} {price}", "action_helpers.light_fiber_pair_n_price_mo":"Accendi la coppia {n} {price} + {mo}/mese", "action_helpers.n_fiber_pairs_lit_the_trench":"{n} coppie di fibre accese, il cavidotto è pieno", @@ -12,6 +14,9 @@ "action_helpers.too_far_even_at_its_slowest":"Troppo lontano anche alla velocità più bassa: qui una tratta ottica è di {span} km e l’ottica arriva a {max} km. Aggiungi un sito di rigenerazione (Sistema di linea).", "action_helpers.unlocks_at_customer_level_n":"Si sblocca al livello cliente {n}.", "action_helpers.upgrades_cannot_stretch_this_optic":"Questo canale raggiunge {max} km su questo cavo; il percorso è di {span} km. Terminali sottomarini e ingegneria ottica non allungano quest’ottica. Ci arrivano: {optics}.", +"action_helpers.you_already_run_ix_in_city":"Gestisci già {ix} a {city}.", +"action_helpers.you_have_no_pop_in_city":"Non hai nessun POP a {city}.
Un link parte da uno dei tuoi POP e, se serve, apre un POP all’altro capo.", +"action_helpers.you_have_no_pop_in_city_build":"Non hai nessun POP a {city}.
Costruiscine prima uno lì, poi fonda l’exchange.", "actions.your_router_can_t_take_a":"Il tuo router non regge una porta {port}.
Aggiornalo nella scheda Infra.", "architect.anchor":"🐒 Splash!", "architect.architect_runs":"Partite da architetto", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 7e35854..0d73e12 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -1,6 +1,8 @@ // Portuguese (Brazil). Keys are the English text exactly as passed to tr()/trn()/N_() in src/ (or as it stands // in its data-i18n markup, aria-label or title); sorted; check with: npm run i18n:check, add with scripts/i18n-add.js (window.I18N=window.I18N||{}).pt={ +"action_helpers.city_already_has_an_exchange_ix":"{city} já tem um exchange, {ix}.
Pegue uma porta nele em vez de fundar o seu.", +"action_helpers.city_is_off_the_map_small":"{city} saiu do mapa.
Cidades pequenas tão perto de uma maior não entram mais em jogos novos. Construa em {near}.", "action_helpers.light_fiber_pair_n_price":"Acender par {n} {price}", "action_helpers.light_fiber_pair_n_price_mo":"Acender par {n} {price} + {mo}/mês", "action_helpers.n_fiber_pairs_lit_the_trench":"{n} pares de fibras acesos, a vala está cheia", @@ -12,6 +14,9 @@ "action_helpers.too_far_even_at_its_slowest":"Longe demais até na configuração mais lenta: um span óptico aqui tem {span} km e ela alcança {max} km. Adicione um site de regeneração (Line system).", "action_helpers.unlocks_at_customer_level_n":"Desbloqueia no nível de cliente {n}.", "action_helpers.upgrades_cannot_stretch_this_optic":"Este canal alcança {max} km neste cabo; a rota tem {span} km. Terminais submarinos e engenharia óptica não esticam esta óptica. Estas chegam lá: {optics}.", +"action_helpers.you_already_run_ix_in_city":"Você já opera o {ix} em {city}.", +"action_helpers.you_have_no_pop_in_city":"Você não tem POP em {city}.
Um link começa em um dos seus POPs e abre um POP na outra ponta, se precisar.", +"action_helpers.you_have_no_pop_in_city_build":"Você não tem POP em {city}.
Construa um lá primeiro e depois funde o exchange.", "actions.your_router_can_t_take_a":"Seu router não aguenta uma porta {port}.
Faça upgrade na aba Infra.", "architect.anchor":"🐒 Tchibum!", "architect.architect_runs":"Partidas de arquiteto", diff --git a/src/agent/20-commands.js b/src/agent/20-commands.js index d7d1856..128cf37 100644 --- a/src/agent/20-commands.js +++ b/src/agent/20-commands.js @@ -14,8 +14,8 @@ const API_CMD={ downP:{args:[['id','entityId']],watch:['pni.#id'],doc:'Step a PNI down one size. Not while an augment is on order.'}, /* ---------- footprint: buildings, routers, POPs ---------- */ buildPop:{args:[['city','cityId']], - quote:a=>({setup:popCost(a.city),blocked:cnCity(a.city)&&!cnOk()?[tr('pops_transit_ix.you_need_a_license_first_foreign')]:[]}), - doc:'Open a POP in a city you do not have one in. Costs popCost(city).'}, + quote:a=>({setup:popCost(a.city),blocked:[cityOn(a.city)?'':popOffWhy(a.city),cnCity(a.city)&&!cnOk()?tr('pops_transit_ix.you_need_a_license_first_foreign'):''].filter(Boolean)}), + doc:'Open a POP in a city you do not have one in. Costs popCost(city). Not in a retired small city (off the map in new games).'}, launchBB:{args:[['city','cityId']],watch:['pops.#city'], quote:a=>({setup:bbCost(a.city)}), doc:'Launch broadband to the eyeballs of a city you have a POP in. The core revenue source; one per POP.'}, @@ -64,8 +64,8 @@ const API_CMD={ doc:'Leave an exchange; drops every peering session there. De-Kicks may answer with a retention offer.'}, rs:{args:[['city','ixId']],watch:['rs'], doc:'Toggle the route-server session, which peers you with everyone on the server at once.'}, - foundIx:{args:[['city','cityId']],watch:['myIx.#city'],quote:a=>({setup:MYIX_COST,monthly:MYIX_MO}), - doc:'Found your own exchange in a city with no IX. Networks join over the following days.'}, + foundIx:{args:[['city','cityId']],watch:['myIx.#city'],quote:a=>({setup:MYIX_COST,monthly:MYIX_MO,blocked:[foundIxWhy(a.city)].filter(Boolean)}), + doc:'Found your own exchange in a city with no IX where you have a POP. Not in mainland China. Networks join over the following days.'}, myIxUp:{args:[['city','cityId']],watch:['myIx.#city'], quote:a=>{const m=S.myIx[a.city];const f=m?(m.fab|0)+1:0,N=f{UI.pending={a:a.a,b:a.b};UI.route=a.route||'';UI.via=a.cable||'';UI.cnPrem=!!a.premiumCrossing;}, pass:a=>({tier:a.tier}), quote:a=>{const A=a.a,B=a.b,tier=a.tier; + if(!S.pops[A])return {blocked:[linkFromWhy(A)]}; if(!waveOk(A,B,tier))return {blocked:[tr('links.a_wave_wave_needs_need_at',{wave:LT[tier].n,need:waveNeed(tier)})]}; const sib=pairLinks(A,B).filter(l=>l.kind!=='vxc'),jn=sib.length?routeJoin(A,B):null,border=cnCity(A)!==cnCity(B); const mult=(sib.length&&!(jn&&jn.k===(landTrenches(A,B)[0]||{}).k)?DIVERSE:1)*(border?3*((a.premiumCrossing&&(A==='hkg'||B==='hkg'))?1.6:1):1); @@ -115,7 +116,7 @@ const API_CMD={ if(so)blocked.push(tr('links.no_wave_capacity_on_this_route',{wave:LT[tier].n,why:tr(so.why),n:Math.max(1,so.until-S.day)})); const w=subWaveWhy(tier,wr.km,wr.sub);if(w)blocked.push(tr('links.no_wave_waves_on_this_cable',{wave:LT[tier].n,why:w})); return {setup:Math.round(waveMo(wr.km,wr.sub,tier)*wr.wm)+(S.pops[B]?0:popCost(B)),monthly:Math.round(waveMo(wr.km,wr.sub,tier)*wr.wm),blocked};}, - doc:'Lease a wave between two cities; opens a POP in b if there is none. A second wave on a pair costs 1.4x unless it joins an existing trench; cross-border into mainland China costs 3x. premiumCrossing applies only via Hong Kong.'}, + doc:'Lease a wave from one of your POPs (a) to any city; opens a POP in b if there is none. A second wave on a pair costs 1.4x unless it joins an existing trench; cross-border into mainland China costs 3x. premiumCrossing applies only via Hong Kong.'}, upLink:{args:[['id','entityId'],['tier','linkTier']],watch:['links.#id'], quote:a=>{const l=S.links.find(x=>x.id===a.id);if(!l)return {}; const blocked=[waveOk(l.a,l.b,a.tier)?'':tr('links.a_wave_wave_needs_need_at',{wave:LT[a.tier].n,need:waveNeed(a.tier)})]; @@ -155,6 +156,7 @@ const API_CMD={ quote:a=>{const A=a.a,B=a.b,sc=isSub(A,B)?subDfCable(A,B):null,km=sc?sc.km:kmBetween(A,B); const building=a.source==='build'&&lvl()>=3&&!sc,sys=DF_SYS[a.system]&&DF_SYS[a.system].lvl<=lvl()?a.system:'lite'; const amps=ampCount(km),blocked=[]; + if(!S.pops[A])blocked.push(linkFromWhy(A)); if(isSub(A,B)&&!sc)blocked.push(tr('fiber_modals.nobody_sells_dark_fiber_on_a')); else if(uaePair(A,B))blocked.push(tr('fiber_modals.no_dark_fiber_inside_the_uae')); else if(landX(A,B)&&cnCity(A)===cnCity(B))blocked.push(tr('fiber_modals.nobody_sells_one_fiber_pair_across')); @@ -162,11 +164,11 @@ const API_CMD={ if(lvl()<2)blocked.push(tr('fiber_modals.dark_fiber_unlocks_at_customer_level')); return {setup:(building?dfBuildCost(km):0)+DF_SYS[sys].cost+amps*AMP_COST+(S.pops[B]?0:popCost(B)), monthly:(building?Math.round(km*0.15):dfLeaseMo(km))+amps*AMP_MO,days:building?dfBuildDays(km):30,blocked};}, - doc:'Get dark fiber: lease an IRU, dig your own (level 3+), or take a pair on a subsea cable. Then light it with a line system.'}, + doc:'Get dark fiber from one of your POPs (a): lease an IRU, dig your own (level 3+), or take a pair on a subsea cable; opens a POP in b if there is none. Then light it with a line system.'}, orderCable:{args:[['a','cityId'],['b','cityId'],['design','designId',false],['terminal','boolean',false],['engineering','boolean',false]], bindsUI:['pending','seaDesign','seaterminal','seaengineering'], bind:a=>{UI.pending={a:a.a,b:a.b};UI.seaDesign=a.design||'standard';UI.seaterminal=!!a.terminal;UI.seaengineering=!!a.engineering;}, - quote:a=>{const why=ownCabWhy(a.a,a.b);if(why)return {blocked:[why]}; + quote:a=>{const why=linkFromWhy(a.a)||ownCabWhy(a.a,a.b);if(why)return {blocked:[why]}; const design=own(SEA_DESIGNS,a.design)?a.design:'standard',up={terminal:!!a.terminal,engineering:!!a.engineering}; const q=seaQuote(a.a,a.b,design,up),lack=seaLack(q.km,up); return {setup:q.cost+(S.pops[a.b]?0:popCost(a.b)),monthly:ownCabMo(q.km),days:q.days, diff --git a/src/game/90-actions/20-pops-transit-ix.js b/src/game/90-actions/20-pops-transit-ix.js index 32ff2f1..5a74050 100644 --- a/src/game/90-actions/20-pops-transit-ix.js +++ b/src/game/90-actions/20-pops-transit-ix.js @@ -1,5 +1,5 @@ Object.assign(ACT,{ - buildPop:({city})=>{if(S.pops[city]||!cityOn(city))return;const flipNote=CITY[city]&&CITY[city].au;if(cnCity(city)&&!cnOk()){toast(tr('pops_transit_ix.you_need_a_license_first_foreign'),'bad');sfx('err');return;}if(!spend(popCost(city)))return;S.pops[city]={day:S.day,bb:null,boost:0,down:0,routers:1,gen:false};popStdApply(city);floater(CITY[city].x,CITY[city].y-30,tr('common.new_pop'),'#FF4F9A');if(flipNote)toast(pick([tr('pops_transit_ix.router_installed_in_city_upside_down',{city:CITY[city].name}),tr('pops_transit_ix.router_installed_in_city_the_vendor',{city:CITY[city].name})]),'good',[],{a:'city',v:city});UI.tab='cust';after();}, + buildPop:({city})=>{if(S.pops[city]||!CITY[city])return;if(!cityOn(city)){toast(popOffWhy(city),'bad');sfx('err');return;}const flipNote=CITY[city]&&CITY[city].au;if(cnCity(city)&&!cnOk()){toast(tr('pops_transit_ix.you_need_a_license_first_foreign'),'bad');sfx('err');return;}if(!spend(popCost(city)))return;S.pops[city]={day:S.day,bb:null,boost:0,down:0,routers:1,gen:false};popStdApply(city);floater(CITY[city].x,CITY[city].y-30,tr('common.new_pop'),'#FF4F9A');if(flipNote)toast(pick([tr('pops_transit_ix.router_installed_in_city_upside_down',{city:CITY[city].name}),tr('pops_transit_ix.router_installed_in_city_the_vendor',{city:CITY[city].name})]),'good',[],{a:'city',v:city});UI.tab='cust';after();}, launchBB:({city})=>{const p=S.pops[city];if(!p||p.bb)return;const C=CITY[city];if(!spend(bbCost(city)))return;p.bb={d:bbStart(city)};floater(C.x,C.y-30,tr('common.eyeballs_online'),'#16A866');after();}, ad:({city})=>{const p=S.pops[city];if(!p||!p.bb)return;if(!spend(8000))return;p.boost=S.day+30;floater(CITY[city].x,CITY[city].y-30,tr('common.ad_campaign'),'#FF8A3D');after();}, buyTransit:({city,net,tier})=>{tier=+tier;if(scnRule('noTransit')){toast(tr('pops_transit_ix.no_transit_in_this_scenario_peering'),'bad');sfx('err');return;}if(!S.pops[city]||!NET[net]||!sellsAt(NET[net],city)||!PORT[tier])return;if(!portOk(city,tier)){toast(tr('actions.your_router_can_t_take_a',{port:PORT[tier].n}),'bad');sfx('err');return;}const ex=S.transit.find(t=>t.city===city&&t.net===net);if(ex&&tier<=ex.tier)return;if(!portGate(city,ex?(PORT_SLOT(tier)-PORT_SLOT(ex.tier))*(ex.n||1):PORT_SLOT(tier)))return;if(!spend(PORT[tier].setup*(ex&&ex.n||1)))return;if(ex)ex.tier=tier;else S.transit.push({id:uid(),city,net,tier,down:0,...(premOnlyAt(NET[net],city)?{premium:true}:{})});toast(tr('pops_transit_ix.net_transit_is_live_in_city',{net:esc(NET[net].name),city:CITY[city].name}),'good');after();}, diff --git a/src/game/90-actions/60-links.js b/src/game/90-actions/60-links.js index 308be44..6864da7 100644 --- a/src/game/90-actions/60-links.js +++ b/src/game/90-actions/60-links.js @@ -12,10 +12,10 @@ Object.assign(ACT,{ if(shipSea(i)){if(shipRush(i)){const s=SHIP[i.ship];toast(tr('cable_ships.ship_chartered',{ship:esc(s.n),home:esc(CITY[s.home].name),n:Math.max(1,i.until-S.day)}),'good');sfx('coin');after();}return;}if(i.slow&&i.rushed)return;if(!spend(i.cost))return; if(i.slow&&i.until>S.day+1){i.rushed=true;i.cost=0;i.until=S.day+1;const p=S.pops[i.ref];if(p)p.down=Math.min(p.down,S.day+1);toast(tr('links.power_cycled_the_router_in_city',{city:esc(CITY[i.ref].name),chip:esc(RG[(p&&p.rgen)||0].chip)}),'good');after();return;}clearInc(i);toast(tr('links.fixed_what_resolved_early',{what:incTitle(i.type)}),'good');after();}, myIxUp:({city})=>{const m=S.myIx[city];if(!m)return;const f=(m.fab|0)+1,N=MYIX_FAB[f];if(!N)return;if(N.lvl>lvl()){toast(tr('links.a_fab_fabric_unlocks_at_customer',{fab:N.n,lv:N.lvl}),'bad');sfx('err');return;}if(!spend(N.cost))return;m.fab=f;toast(tr('links.ix_now_runs_a_fab_fabric',{ix:esc(m.name),fab:N.n,max:N.max}),'good');m.next=Math.min(m.next,S.day+3);after();}, - foundIx:({city})=>{if(!S.pops[city]||S.myIx[city]||CITY[city].ix||CITY[city].cn)return;if(!spend(MYIX_COST))return;const nm=(S.name.split(' ')[0]||'My').replace(/[^A-Za-z0-9]/g,'').slice(0,10)+'-IX '+CITY[city].name; + foundIx:({city})=>{if(!isCity(city))return;const why=foundIxWhy(city);if(why){toast(why,'bad');sfx('err');return;}if(!spend(MYIX_COST))return;const nm=(S.name.split(' ')[0]||'My').replace(/[^A-Za-z0-9]/g,'').slice(0,10)+'-IX '+CITY[city].name; S.myIx[city]={name:nm,members:[],next:S.day+4};S.ixp[city]=2;toast(tr('links.you_founded_ix_networks_will_join',{ix:esc(nm)}),'goal');after();}, buildLink:({tier})=>{tier=+tier;const p=UI.pending;if(!p||noTalk(p.a,p.b))return;const {a,b}=p;const km=kmBetween(a,b),sub=isSub(a,b),sib=pairLinks(a,b).filter(l=>l.kind!=='vxc'),jn=sib.length?routeJoin(a,b):null,same=!!jn,border=cnCity(a)!==cnCity(b),mult=(sib.length&&!(jn&&jn.k===(landTrenches(a,b)[0]||{}).k)?DIVERSE:1)*(border?3*(UI.cnPrem&&(a==='hkg'||b==='hkg')?1.6:1):1); - if((cnCity(a)||cnCity(b))&&!cnOk())return; + if(!linkFromOk(a)||((cnCity(a)||cnCity(b))&&!cnOk()))return; if(!waveOk(a,b,tier)){toast(tr('links.a_wave_wave_needs_need_at',{wave:LT[tier].n,need:esc(waveNeed(tier))}),'bad');sfx('err');return;} const wr=waveRoute(a,b,mult,border);if(!wr){toast(tr('links.no_cable_available_for_that_route'),'bad');sfx('err');return;} {const so=soldOut(a,b,tier,wr.cab);if(so){toast(tr('links.no_wave_capacity_on_this_route',{wave:LT[tier].n,why:tr(so.why),n:Math.max(1,so.until-S.day)}),'bad');sfx('err');return;}}{const w=subWaveWhy(tier,wr.km,wr.sub);if(w){toast(tr('links.no_wave_waves_on_this_cable',{wave:LT[tier].n,why:esc(w)}),'bad');sfx('err');return;}}const base=Math.round(waveMo(wr.km,wr.sub,tier)*wr.wm),cost=base+(S.pops[b]?0:popCost(b)); diff --git a/src/game/90-actions/87-fiber-and-hardware.js b/src/game/90-actions/87-fiber-and-hardware.js index f4cccd6..39c333d 100644 --- a/src/game/90-actions/87-fiber-and-hardware.js +++ b/src/game/90-actions/87-fiber-and-hardware.js @@ -7,14 +7,14 @@ Object.assign(ACT,{ ownCab:()=>{UI.lmode='df';UI.dfSrc='cable';UI.seaDesign='standard';UI.seaterminal=UI.seaengineering=false;if(UI.pending)openLinkModal(UI.pending.a,UI.pending.b);}, dfSrc:({v})=>{UI.dfSrc=v;if(UI.pending)openLinkModal(UI.pending.a,UI.pending.b);}, dfSys:({v})=>{UI.dfSys=v;if(UI.pending)openLinkModal(UI.pending.a,UI.pending.b);}, - orderCable:()=>{const p=UI.pending;if(!p||noTalk(p.a,p.b))return;const {a,b}=p;if(ownCabWhy(a,b))return;const design=own(SEA_DESIGNS,UI.seaDesign)?UI.seaDesign:'standard',up=seaUps(seaQuote(a,b,design).km),q=seaQuote(a,b,design,up),km=q.km,cost=q.cost+(S.pops[b]?0:popCost(b));if(seaLack(km,up).length||!spend(cost))return; + orderCable:()=>{const p=UI.pending;if(!p||noTalk(p.a,p.b))return;const {a,b}=p;if(ownCabWhy(a,b)||!linkFromOk(a))return;const design=own(SEA_DESIGNS,UI.seaDesign)?UI.seaDesign:'standard',up=seaUps(seaQuote(a,b,design).km),q=seaQuote(a,b,design,up),km=q.km,cost=q.cost+(S.pops[b]?0:popCost(b));if(seaLack(km,up).length||!spend(cost))return; if(!S.pops[b]){S.pops[b]={day:S.day,bb:null,boost:0,down:0,routers:1,gen:false,rgen:0};popStdApply(b);} const used=new Set(S.links.map(l=>l.cname).filter(Boolean)),cname=OWNCAB_NAMES.find(n=>!used.has(n))||`${pick(OWNCAB_NAMES)} ${used.size+1}`,id=uid(),ship=layName({id}),days=q.days; S.links.push({id,a,b,kind:'df',own:true,sub:true,seaDesign:design,seaPath:q.pts.map(p=>p.slice()),sys:'roadm',ch:[],km,cable:null,cname,mo:Math.round(km*OWNCAB_OM),trench:'own:'+id,cut:0,day:S.day,ready:S.day+days,spares:false,pairs:1}); const laid=S.links[S.links.length-1];laid.paid=q.cost;for(const k of Object.keys(SUB_UPGRADES))if(up[k])laid['sub'+k]=laid.ready;UI.seaDesign='standard';UI.seaterminal=UI.seaengineering=false; S.stats.ownCab=(S.stats.ownCab||0)+1;UI.dfSrc='lease';closeModal();UI.sel={type:'link',id}; toast(tr('fiber_and_hardware.the_ship_sets_sail_name_your',{ship,name:cname,km:km.toLocaleString(),a:CITY[a].name,b:CITY[b].name,n:days}),'goal');sfx('build');after();}, - orderDf:()=>{const p=UI.pending;if(!p||noTalk(p.a,p.b))return;const {a,b}=p;if(!dfAllowed(a,b))return;const sc=isSub(a,b)?subDfCable(a,b):null,km=sc?sc.km:kmBetween(a,b); + orderDf:()=>{const p=UI.pending;if(!p||noTalk(p.a,p.b))return;const {a,b}=p;if(!dfAllowed(a,b)||!linkFromOk(a))return;const sc=isSub(a,b)?subDfCable(a,b):null,km=sc?sc.km:kmBetween(a,b); const own=UI.dfSrc==='build'&&!sc,sys=DF_SYS[UI.dfSys]&&techOk('sys',UI.dfSys,DF_SYS[UI.dfSys].lvl)?UI.dfSys:'lite';if(lvl()<2)return; const up=(own?digCost(km):0)+sysCost(sys)+ampCount(km)*AMP_COST+(S.pops[b]?0:popCost(b));if(!spend(up))return; if(!S.pops[b]){S.pops[b]={day:S.day,bb:null,boost:0,down:0,routers:1,gen:false,rgen:0};popStdApply(b);} diff --git a/src/game/90-actions/90-action-helpers.js b/src/game/90-actions/90-action-helpers.js index cea932e..bfc3517 100644 --- a/src/game/90-actions/90-action-helpers.js +++ b/src/game/90-actions/90-action-helpers.js @@ -9,6 +9,17 @@ function prunePairMet(){const m=S.pairMet;if(!m)return;const k=new Set(S.links.m // Short, busy subsea routes (London–Amsterdam, London–Paris) sell dark fiber pairs too. function subDfCable(a,b){return cablesOk(a,b).filter(c=>CAB[c.cid].df).sort((x,y)=>x.km-y.km)[0]||null;} function dfAllowed(a,b){if(noTalk(a,b))return false;if(isSub(a,b))return !!subDfCable(a,b);return cnCity(a)===cnCity(b)&&!uaePair(a,b)&&!landX(a,b);} +// A link starts at one of your POPs. The map only drags one from a POP, but a typed order (the agent API) names both ends. +function linkFromWhy(a){return S.pops[a]?'':tr('action_helpers.you_have_no_pop_in_city',{city:CITY[a].name});} +function linkFromOk(a){const w=linkFromWhy(a);if(w){toast(w,'bad');sfx('err');}return !w;} +// A retired small city (off: true) takes no new POP; the nearest open city in its country stands in for it. +function popOffWhy(c){const C=CITY[c],near=CITIES.filter(o=>!o.off&&o.cc===C.cc).sort((x,y)=>kmBetween(c,x.id)-kmBetween(c,y.id))[0]; + return tr('action_helpers.city_is_off_the_map_small',{city:C.name,near:near?near.name:''});} +// Why a city takes no exchange of your own. The reasons a POP would not fix come first. +function foundIxWhy(c){const C=CITY[c];if(C.cn)return tr('link_panels.running_an_exchange_in_mainland'); + if(S.myIx[c])return tr('action_helpers.you_already_run_ix_in_city',{ix:esc(S.myIx[c].name),city:C.name}); + if(C.ix)return tr('action_helpers.city_already_has_an_exchange_ix',{city:C.name,ix:esc(C.ix)}); + return S.pops[c]?'':tr('action_helpers.you_have_no_pop_in_city_build',{city:C.name});} /* Optics you unplug go on a spares shelf instead of in the bin (#45): the next channel of that type uses a spare for free (only the regen sites' transponders are new), or you sell it on eBuy for part of the price. */ const SPARE_RESALE=0.4,spareN=o=>(S&&S.spares&&S.spares[o])|0,spareValue=o=>Math.round(optCost(o)*SPARE_RESALE); diff --git a/src/i18n/en.js b/src/i18n/en.js index 33977d7..5f09488 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -2,6 +2,8 @@ // Inlined into the page at build. One entry per line, sorted by label; plurals are {"one":…,"other":…}. // Add or change text with scripts/i18n-add.js, check with npm run i18n:check. (window.I18N=window.I18N||{}).en={ +"action_helpers.city_already_has_an_exchange_ix":"{city} already has an exchange, {ix}.
Take a port on it instead of founding your own.", +"action_helpers.city_is_off_the_map_small":"{city} is off the map.
Small cities this close to a bigger one are retired from new games. Build in {near} instead.", "action_helpers.light_fiber_pair_n_price":"Light fiber pair {n} {price}", "action_helpers.light_fiber_pair_n_price_mo":"Light fiber pair {n} {price} + {mo}/mo", "action_helpers.n_fiber_pairs_lit_the_trench":"{n} fiber pairs lit, the trench is full", @@ -13,6 +15,9 @@ "action_helpers.too_far_even_at_its_slowest":"Too far even at its slowest setting: an optical span here is {span} km and it reaches {max} km. Add a regen site (Line system).", "action_helpers.unlocks_at_customer_level_n":"Unlocks at customer level {n}.", "action_helpers.upgrades_cannot_stretch_this_optic":"This channel reaches {max} km on this cable; the route is {span} km. Submarine terminals and optical engineering do not stretch this optic. These reach it: {optics}.", +"action_helpers.you_already_run_ix_in_city":"You already run {ix} in {city}.", +"action_helpers.you_have_no_pop_in_city":"You have no POP in {city}.
A link starts at one of your POPs, and opens a POP at the far end if it needs one.", +"action_helpers.you_have_no_pop_in_city_build":"You have no POP in {city}.
Build one there first, then found the exchange.", "actions.your_router_can_t_take_a":"Your router can't take a {port} port.
Upgrade it in the Infra tab.", "architect.anchor":"🐒 Splash!", "architect.architect_runs":"Architect runs", diff --git a/tests/badge-cape-horn.test.js b/tests/badge-cape-horn.test.js index 4ae1793..ca899f8 100644 --- a/tests/badge-cape-horn.test.js +++ b/tests/badge-cape-horn.test.js @@ -5,7 +5,7 @@ const assert = require('node:assert/strict'); const { load } = require('./harness'); const horn = (ev) => ev("BADGES.find(b=>b.id==='horn').ok()"); -const start = (ev) => ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=5e9;S.lvl=4;S.won=true;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'bue'})"); +const start = (ev) => ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=5e9;S.lvl=4;S.won=true;for(const g of GOALS)S.done[g.id]=0;ACT.buildPop({city:'bue'});ACT.launchBB({city:'bue'})"); test('#272 your own subsea cable from Buenos Aires to Santiago earns The Long Way Round', () => { const { ev, errors } = load(); diff --git a/tests/issues.test.js b/tests/issues.test.js index 39057ba..09271f2 100644 --- a/tests/issues.test.js +++ b/tests/issues.test.js @@ -1285,7 +1285,7 @@ test('#51 a dark fiber shows what is rented out, and spare capacity can be liste test('#126 you can zoom in far enough, and pick a short link between two close cities', () => { const { ev, errors } = load(); - ev("ACT.start({city:'sao'});S.cash=1e9;for(const g of GOALS)S.done[g.id]=0;for(const c of ['cpq'])ACT.buildPop({city:c});UI.pending=null;UI.via=null;UI.lmode='wave';UI.route='main';openLinkModal('sao','cpq');ACT.buildLink({tier:1});closeModal()"); + ev("ACT.start({city:'sao'});S.cash=1e9;for(const g of GOALS)S.done[g.id]=0;for(const c of ['sao','cpq'])ACT.buildPop({city:c});UI.pending=null;UI.via=null;UI.lmode='wave';UI.route='main';openLinkModal('sao','cpq');ACT.buildLink({tier:1});closeModal()"); assert.ok(ev('ZMAX') >= 16); const id = ev("S.links.find(l=>l.a==='sao'||l.b==='sao').id"); // the middle of the drawn link, on screen, fully zoomed in on it diff --git a/tests/link-preconditions.test.js b/tests/link-preconditions.test.js new file mode 100644 index 0000000..d7c3953 --- /dev/null +++ b/tests/link-preconditions.test.js @@ -0,0 +1,121 @@ +// Typed orders (the MCP act tool) name both ends of a link and any city for a POP or an exchange, where the map only +// offers what a player can reach: a link dragged from one of your POPs, a POP in a city that is on the map, Found your +// own IX where the panel shows it. These hold the same lines: what the game refuses, it refuses with a toast that says +// why and a dry run that reports it as blocked. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { createSession, TOOLS } = require('../scripts/lib/mcp-game'); + +function sandbox() { + const s = createSession(), T = (name, args = {}) => TOOLS.find((t) => t.name === name).run(s, args), ev = (x) => s.game.ev(x); + T('new_game', { city: 'sao', preset: 'sandbox', seed: 7, name: 'Probe' }); + const act = (action, args, dryRun) => T('act', { action, args, dryRun }); + return { s, ev, act, pops: () => JSON.parse(ev('JSON.stringify(Object.keys(S.pops).sort())')), links: () => ev('S.links.length') }; +} + +test('a dark fiber IRU, a wave or a cable from a city with no POP is refused, and its dry run says why', () => { + const { s, act, pops, links } = sandbox(); + for (const [action, args, city] of [ + ['orderDf', { a: 'aju', b: 'rec', source: 'lease', system: 'roadm' }, 'Aracaju'], + ['orderDf', { a: 'rio', b: 'sao', source: 'build', system: 'lite' }, 'Rio de Janeiro'], + ['buildLink', { a: 'bsb', b: 'for', tier: 1 }, 'Brasília'], + ['orderCable', { a: 'for', b: 'lis' }, 'Fortaleza'], + ]) { + const why = new RegExp(`You have no POP in ${city}`); + const q = act(action, args, true); + assert.equal(q.outcome, 'quote', action); + assert.ok(q.quote.blocked.some((b) => why.test(b)), `${action} ${args.a}→${args.b}: ${JSON.stringify(q.quote.blocked)}`); + const r = act(action, args); + assert.equal(r.outcome, 'rejected', `${action} ${args.a}→${args.b}`); + assert.ok(r.toasts.some((t) => why.test(t)), JSON.stringify(r.toasts)); + assert.equal(r.charged, 0); + assert.equal(r.cashChange, 0); + } + // nothing was built, and no POP opened at either end + assert.deepEqual(pops(), ['sao']); + assert.equal(links(), 0); + assert.deepEqual(s.errors(), []); +}); + +test('from one of your POPs the same orders still go through and open a POP at the far end', () => { + const { s, act, pops, links } = sandbox(); + for (const [action, args] of [ + ['orderDf', { a: 'sao', b: 'rio', source: 'lease', system: 'roadm' }], + ['buildLink', { a: 'sao', b: 'bsb', tier: 1 }], + ['orderCable', { a: 'rio', b: 'lis' }], + ]) { + assert.deepEqual(act(action, args, true).quote.blocked, [], action); + assert.equal(act(action, args).outcome, 'applied', action); + } + assert.deepEqual(pops(), ['bsb', 'lis', 'rio', 'sao']); + assert.equal(links(), 3); + // the game's own click path is unchanged: the link window from a POP signs the IRU + const { ev } = sandbox(); + ev("openLinkModal('sao','cwb');UI.lmode='df';UI.dfSrc='lease';UI.dfSys='lite';ACT.orderDf()"); + assert.equal(ev("S.links.filter(l=>l.kind==='df'&&l.a==='sao'&&l.b==='cwb').length"), 1); + assert.ok(ev('!!S.pops.cwb')); + assert.deepEqual(s.errors(), []); +}); + +test('a POP in a retired small city is refused with a toast naming an open city nearby, and its dry run is blocked', () => { + const { s, ev, act, pops } = sandbox(); + const q = act('buildPop', { city: 'aju' }, true); + assert.deepEqual(q.quote.blocked, [ev("apiText(popOffWhy('aju'))")]); + assert.match(q.quote.blocked[0], /Aracaju is off the map/); + const r = act('buildPop', { city: 'aju' }); + assert.equal(r.outcome, 'rejected'); + assert.ok(r.toasts.some((t) => /Aracaju is off the map.*\n.*Build in Salvador instead/s.test(t)), JSON.stringify(r.toasts)); + assert.equal(r.charged, 0); + // every retired city names an open city in its own country to build in instead + const near = JSON.parse(ev(`JSON.stringify(CITIES.filter(c=>c.off).map(c=>{const m=popOffWhy(c.id).match(/Build in (.+) instead/); + const o=m&&CITIES.find(x=>x.name===m[1]);return {c:c.id,ok:!!o&&!o.off&&o.cc===c.cc};}))`)); + assert.ok(near.length > 0, 'there are retired cities'); + assert.deepEqual(near.filter((x) => !x.ok), []); + // an open city still takes a POP; an unknown id does nothing and says nothing + assert.equal(act('buildPop', { city: 'ssa' }).outcome, 'applied'); + ev("ACT.buildPop({city:'nope'})"); + assert.deepEqual(pops(), ['sao', 'ssa']); + assert.deepEqual(s.errors(), []); +}); + +test('an old save that kept a POP in a retired city keeps it, and buildPop there stays quiet', () => { + const { s, ev, act } = sandbox(); + ev("S.pops.aju={day:0,bb:null,boost:0,down:0,routers:1,gen:false};S=migrate(JSON.parse(JSON.stringify(S)));compute()"); + assert.ok(ev("!!S.pops.aju&&cityOn('aju')")); + const r = act('buildPop', { city: 'aju' }); + assert.equal(r.outcome, 'no_effect'); + assert.deepEqual(r.toasts, []); + // and a link may start there, since it is one of your POPs + assert.equal(act('orderDf', { a: 'aju', b: 'rec', source: 'lease', system: 'roadm' }).outcome, 'applied'); + assert.deepEqual(s.errors(), []); +}); + +test('founding your own exchange says why it cannot: mainland China, an exchange already there, yours already there, no POP', () => { + const { s, ev, act } = sandbox(); + const name = (c) => ev(`CITY.${c}.name`); + const refused = (city, why) => { + const q = act('foundIx', { city }, true); + assert.equal(q.quote.blocked.length, 1, `${city}: ${JSON.stringify(q.quote.blocked)}`); + assert.match(q.quote.blocked[0], why, city); + const r = act('foundIx', { city }); + assert.equal(r.outcome, 'rejected', city); + assert.ok(r.toasts.some((t) => why.test(t)), `${city}: ${JSON.stringify(r.toasts)}`); + assert.equal(r.charged, 0); + }; + // mainland China comes first: a POP there would not help (Charlie's Shanghai and Beijing had POPs) + refused('pek', /Running an exchange in mainland China takes a different license/); + ev('S.pops.sha={day:0,bb:null,boost:0,down:0,routers:1,gen:false}'); + refused('sha', /Running an exchange in mainland China takes a different license/); + refused('sao', new RegExp(`${name('sao')} already has an exchange, ${ev('CITY.sao.ix')}`)); + refused('mex', new RegExp(`You have no POP in ${name('mex')}.*\\n.*found the exchange`, 's')); + act('buildPop', { city: 'mex' }); + assert.deepEqual(act('foundIx', { city: 'mex' }, true).quote.blocked, []); + assert.equal(act('foundIx', { city: 'mex' }).outcome, 'applied'); + refused('mex', new RegExp(`You already run ${ev('S.myIx.mex.name')} in ${name('mex')}`)); + assert.equal(ev('Object.keys(S.myIx).join()'), 'mex'); + // the panel's own button still founds one + ev("ACT.buildPop({city:'rek'});ACT.foundIx({city:'rek'})"); + assert.ok(ev('!!S.myIx.rek')); + ev("ACT.foundIx({city:'nope'})"); + assert.deepEqual(s.errors(), []); +}); diff --git a/tests/subsea-upgrade-timing.test.js b/tests/subsea-upgrade-timing.test.js index 963639c..77a7bde 100644 --- a/tests/subsea-upgrade-timing.test.js +++ b/tests/subsea-upgrade-timing.test.js @@ -54,7 +54,7 @@ test('packages included in the original order stay aligned with its accelerated const { ev, dom } = load(); try { setup(ev); - ev("S.won=true;UI.pending={a:'sin',b:'lax'};UI.seaterminal=UI.seaengineering=true;ACT.orderCable();S.links=[S.links.at(-1)]"); + ev("S.won=true;ACT.buildPop({city:'sin'});UI.pending={a:'sin',b:'lax'};UI.seaterminal=UI.seaengineering=true;ACT.orderCable();S.links=[S.links.at(-1)]"); assert.equal(ev('S.links[0].subterminal'), ev('S.links[0].ready')); assert.equal(ev('S.links[0].subengineering'), ev('S.links[0].ready')); const ready = ev('S.links[0].ready');