diff --git a/CHANGELOG.md b/CHANGELOG.md index db3d467..744dfae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- A link that a closed border has taken down, like Doha to Dubai or Abu Dhabi while the neighbours have fallen out, now says so in its panel, with the days until it comes back, instead of showing nothing wrong. Leasing a new wave or fiber pair across that border during the spat warns you first that it will stay dark (#329). + ## [3.3.0] — 2026-11-09 - You can now move a customer to another path between the same two POPs, with the most diverse options listed first. Waves and leased fiber pairs move to another fiber with room for them, leaving alone what you keep back for your own traffic, and circuits can be pinned to a path of your choice, falling back to normal routing while a link on it is down. diff --git a/site/i18n/de.js b/site/i18n/de.js index 3d0e0a9..5402b72 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -2780,11 +2780,13 @@ "link_modal.premium_crossings_are_only_sold_in":"Premium-Übergänge gibt es nur in Hongkong.", "link_modal.same_trench_cheaper_one_backhoe_cuts":"Gleicher Graben günstiger · ein Bagger kappt alle", "link_modal.sold_out_for_n_days":"ausverkauft für {n} Tage", +"link_modal.the_borders_around_qatar_are_closed":"Die Grenzen rund um Katar sind geschlossen: Ein Link zwischen Doha und Saudi-Arabien oder den VAE bleibt dunkel, bis sich die Nachbarn wieder vertragen.", "link_modal.the_landing_permit_dispute_in_city":"Der Streit um die Anlandegenehmigung in {city} blockiert neue Subsea-Links für weitere {n} Tage.", "link_modal.waves_are_leased_at_a_flat":"Waves werden zu einer festen Monatsrate gemietet. Größer und länger kostet mehr, und Subsea das 1,8-Fache. Der erste Monat ist jetzt fällig.", "link_modal.waves_on_the_same_route_share":"Waves auf derselben Route teilen ihr Schicksal: Ein Bagger kappt sie alle.", "link_modal.you_already_have_n_link_here":{"one":"Du hast hier schon {n} Link ({list}). Parallele Links bringen Kapazität. Wie soll dieser geroutet werden?","other":"Du hast hier schon {n} Links ({list}). Parallele Links bringen Kapazität. Wie soll dieser geroutet werden?"}, "link_panels.a_bigger_fabric_carries_more_traffic":"Eine größere Fabric trägt mehr Traffic und hat Platz für mehr Mitglieder. Dein Router hier muss trotzdem mithalten.", +"link_panels.a_diplomatic_spat_has_closed_the":"Ein diplomatischer Streit hat die Grenzen rund um Katar geschlossen, also ist jeder Link zwischen Doha und Saudi-Arabien oder den VAE down. Da gibt es nichts zu reparieren und keinen Eilauftrag für Diplomatie: nimm den langen Weg außen herum, übers Meer.", "link_panels.a_link_on_standby_carries_traffic":"Ein Link im Standby trägt nur Traffic, wenn die anderen Links zwischen diesen Städten voll oder down sind.", "link_panels.a_link_s_cost_is_its":"Die Kosten eines Links sind seine Länge in km plus 60, mal ein Faktor. Traffic nimmt den Pfad mit den niedrigsten Gesamtkosten.", "link_panels.a_regen_site_turns_the_light":"Ein Regen-Standort verwandelt das Licht auf halber Strecke zurück in Bits und schickt es frisch weiter, also müssen Optiken nur bis zum nächsten Standort reichen. Jeder braucht eine Regen-Karte für jeden beleuchteten Kanal. {price}/Monat pro Standort für die Hütte.", @@ -2799,6 +2801,7 @@ "link_panels.behind_the_great_firewall":"Hinter der Großen Firewall", "link_panels.biggest_fabric_money_can_buy":"Die größte Fabric, die man für Geld kaufen kann.", "link_panels.biggest_feeder_egress_in_city_set":"Größter Zubringer: {egress} in {city}. Stell ihn auf „Nur Backup“, gib den Kunden einen näheren Ausgang (Peering, einen Cache, lokalen Transit) oder erhöhe die Metrik dieses Links.", +"link_panels.border_closed":"Grenze geschlossen", "link_panels.build_a_pop_here_first":"Bau hier zuerst einen POP.", "link_panels.cancel_the_iru":"IRU kündigen", "link_panels.carry_here":"Hierher leiten", @@ -2896,6 +2899,7 @@ "link_panels.running_an_exchange_in_mainland":"Einen Exchange in Festlandchina zu betreiben braucht eine ganz andere Lizenz. Peere mit chinesischen Netzen über PNIs oder triff sie in Hongkong.", "link_panels.runs_at_g_per_channel_on":"Läuft auf dieser Route mit {g} pro Kanal (Langstreckenmodus).", "link_panels.runs_on_its_own_route_a":"Läuft auf eigener Route. Ein Schnitt hier trifft die anderen Links nicht.", +"link_panels.russia_has_unplugged_itself_from_the":"Russland hat sich für eine Übung zum souveränen Internet vom Rest des Internets abgekoppelt. Alles, was das Land verlässt, ist bis morgen dunkel.", "link_panels.sell_one_price":"Einen verkaufen {price}", "link_panels.selling_spare_capacity":"Freie Kapazität verkaufen", "link_panels.shares_a_trench_with_n_other":{"one":"Teilt sich einen Graben mit {n} anderen Link. Ein Schnitt legt alle lahm.","other":"Teilt sich einen Graben mit {n} anderen Links. Ein Schnitt legt alle lahm."}, diff --git a/site/i18n/es.js b/site/i18n/es.js index 4348512..feaa272 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -2778,11 +2778,13 @@ "link_modal.premium_crossings_are_only_sold_in":"Los cruces premium solo se venden en Hong Kong.", "link_modal.same_trench_cheaper_one_backhoe_cuts":"Misma zanja más barato · una retroexcavadora corta todo", "link_modal.sold_out_for_n_days":"agotado durante {n} días", +"link_modal.the_borders_around_qatar_are_closed":"Las fronteras de Catar están cerradas: un enlace entre Doha y Arabia Saudí o los EAU seguirá a oscuras hasta que los vecinos hagan las paces.", "link_modal.the_landing_permit_dispute_in_city":"La disputa por el permiso de aterrizaje en {city} bloquea los enlaces submarinos nuevos durante {n} días más.", "link_modal.waves_are_leased_at_a_flat":"Las ondas se alquilan a tarifa mensual plana. Más grande y más largo cuesta más, y lo submarino 1,8×. El primer mes vence ahora.", "link_modal.waves_on_the_same_route_share":"Las ondas de la misma ruta comparten su suerte: una retroexcavadora las corta todas.", "link_modal.you_already_have_n_link_here":{"one":"Ya tienes {n} enlace aquí ({list}). Los enlaces paralelos suman capacidad. ¿Cómo debe enrutarse este?","other":"Ya tienes {n} enlaces aquí ({list}). Los enlaces paralelos suman capacidad. ¿Cómo debe enrutarse este?"}, "link_panels.a_bigger_fabric_carries_more_traffic":"Una fabric mayor transporta más tráfico y tiene sitio para más miembros. Tu router de aquí aún tiene que aguantar el ritmo.", +"link_panels.a_diplomatic_spat_has_closed_the":"Una disputa diplomática ha cerrado las fronteras de Catar, así que todos los enlaces entre Doha y Arabia Saudí o los EAU están caídos. No hay nada que reparar ni reparación urgente para la diplomacia: da la vuelta larga, por mar.", "link_panels.a_link_on_standby_carries_traffic":"Un enlace en espera solo lleva tráfico cuando los demás enlaces entre estas ciudades están llenos o caídos.", "link_panels.a_link_s_cost_is_its":"El coste de un enlace es su longitud en km más 60, por un multiplicador. El tráfico toma la ruta con el menor coste total.", "link_panels.a_regen_site_turns_the_light":"Un sitio regenerador convierte la luz de nuevo en bits a mitad de camino y la envía renovada, así que las ópticas solo tienen que llegar al siguiente sitio. Cada uno necesita una tarjeta regeneradora por cada canal iluminado. {price}/mes por sitio por la caseta.", @@ -2797,6 +2799,7 @@ "link_panels.behind_the_great_firewall":"Tras el Gran Cortafuegos", "link_panels.biggest_fabric_money_can_buy":"La fabric más grande que el dinero puede comprar.", "link_panels.biggest_feeder_egress_in_city_set":"Mayor alimentador: {egress} en {city}. Ponlo en «Solo respaldo», dale a los clientes una salida más cercana (peering, una caché, tránsito local) o sube la métrica de este enlace.", +"link_panels.border_closed":"Frontera cerrada", "link_panels.build_a_pop_here_first":"Construye primero un POP aquí.", "link_panels.cancel_the_iru":"Cancelar la IRU", "link_panels.carry_here":"Llevar aquí", @@ -2894,6 +2897,7 @@ "link_panels.running_an_exchange_in_mainland":"Gestionar un intercambio en China continental requiere una licencia totalmente distinta. Haz peering con redes chinas por PNIs, o encuéntrate con ellas en Hong Kong.", "link_panels.runs_at_g_per_channel_on":"Funciona a {g} por canal en esta ruta (modo de larga distancia).", "link_panels.runs_on_its_own_route_a":"Va por su propia ruta. Un corte aquí deja en pie los otros enlaces.", +"link_panels.russia_has_unplugged_itself_from_the":"Rusia se ha desconectado del resto de internet para un simulacro de internet soberano. Todo lo que sale del país está a oscuras hasta mañana.", "link_panels.sell_one_price":"Vender uno {price}", "link_panels.selling_spare_capacity":"Vendiendo capacidad sobrante", "link_panels.shares_a_trench_with_n_other":{"one":"Comparte zanja con {n} enlace más. Un corte los tumba a todos.","other":"Comparte zanja con {n} enlaces más. Un corte los tumba a todos."}, diff --git a/site/i18n/fr.js b/site/i18n/fr.js index a3c7813..f971279 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -2778,11 +2778,13 @@ "link_modal.premium_crossings_are_only_sold_in":"Les passages premium ne sont vendus qu’à Hong Kong.", "link_modal.same_trench_cheaper_one_backhoe_cuts":"Même tranchée moins cher · une pelleteuse coupe tout", "link_modal.sold_out_for_n_days":"épuisé pour {n} jours", +"link_modal.the_borders_around_qatar_are_closed":"Les frontières autour du Qatar sont fermées : un lien entre Doha et l'Arabie saoudite ou les Émirats restera éteint jusqu'à ce que les voisins se réconcilient.", "link_modal.the_landing_permit_dispute_in_city":"Le litige sur le permis d’atterrissement à {city} bloque les nouveaux liens sous-marins pendant encore {n} jours.", "link_modal.waves_are_leased_at_a_flat":"Les longueurs d’onde se louent à tarif mensuel fixe. Plus c’est gros et long, plus c’est cher, et le sous-marin coûte 1,8×. Le premier mois est à payer tout de suite.", "link_modal.waves_on_the_same_route_share":"Les longueurs d’onde d’un même parcours partagent son sort : une pelleteuse les coupe toutes.", "link_modal.you_already_have_n_link_here":{"one":"Tu as déjà {n} lien ici ({list}). Les liens parallèles ajoutent de la capacité. Par où faire passer celui-ci ?","other":"Tu as déjà {n} liens ici ({list}). Les liens parallèles ajoutent de la capacité. Par où faire passer celui-ci ?"}, "link_panels.a_bigger_fabric_carries_more_traffic":"Un fabric plus gros transporte plus de trafic et accueille plus de membres. Ton routeur ici doit quand même suivre.", +"link_panels.a_diplomatic_spat_has_closed_the":"Une brouille diplomatique a fermé les frontières autour du Qatar : tous les liens entre Doha et l'Arabie saoudite ou les Émirats sont coupés. Rien à réparer, et pas de réparation express pour la diplomatie : passez par le long chemin, par la mer.", "link_panels.a_link_on_standby_carries_traffic":"Un lien en attente ne porte du trafic que lorsque les autres liens entre ces villes sont pleins ou coupés.", "link_panels.a_link_s_cost_is_its":"Le coût d’un lien, c’est sa longueur en km plus 60, fois un multiplicateur. Le trafic prend le chemin au coût total le plus bas.", "link_panels.a_regen_site_turns_the_light":"Un site de régénération reconvertit la lumière en bits à mi-chemin et la renvoie toute fraîche, donc les optiques n’ont qu’à atteindre le site suivant. Chacun demande une carte de régénération par canal allumé. {price}/mois par site pour l’abri.", @@ -2797,6 +2799,7 @@ "link_panels.behind_the_great_firewall":"Derrière le Grand Pare-feu", "link_panels.biggest_fabric_money_can_buy":"Le plus gros fabric que l’argent puisse acheter.", "link_panels.biggest_feeder_egress_in_city_set":"Plus gros contributeur : {egress} à {city}. Passe-le en « Secours seul », donne aux clients une sortie plus proche (peering, cache, transit local) ou augmente la métrique de ce lien.", +"link_panels.border_closed":"Frontière fermée", "link_panels.build_a_pop_here_first":"Construis d’abord un POP ici.", "link_panels.cancel_the_iru":"Résilier l’IRU", "link_panels.carry_here":"Acheminer ici", @@ -2894,6 +2897,7 @@ "link_panels.running_an_exchange_in_mainland":"Exploiter un IX en Chine continentale exige une tout autre licence. Fais du peering avec les réseaux chinois via des PNI, ou retrouve-les à Hong Kong.", "link_panels.runs_at_g_per_channel_on":"Tourne à {g} par canal sur cette route (mode longue distance).", "link_panels.runs_on_its_own_route_a":"Suit sa propre route. Une coupure ici laisse les autres liens debout.", +"link_panels.russia_has_unplugged_itself_from_the":"La Russie s'est débranchée du reste d'internet pour un exercice d'internet souverain. Tout ce qui sort du pays reste éteint jusqu'à demain.", "link_panels.sell_one_price":"En vendre une {price}", "link_panels.selling_spare_capacity":"Vendre la capacité libre", "link_panels.shares_a_trench_with_n_other":{"one":"Partage une tranchée avec {n} autre lien. Une coupure et ils tombent tous.","other":"Partage une tranchée avec {n} autres liens. Une coupure et ils tombent tous."}, diff --git a/site/i18n/it.js b/site/i18n/it.js index 0c57513..9034753 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -2778,11 +2778,13 @@ "link_modal.premium_crossings_are_only_sold_in":"Gli attraversamenti premium si vendono solo a Hong Kong.", "link_modal.same_trench_cheaper_one_backhoe_cuts":"Stesso scavo più economico · una ruspa li taglia tutti", "link_modal.sold_out_for_n_days":"esaurito per {n} giorni", +"link_modal.the_borders_around_qatar_are_closed":"I confini intorno al Qatar sono chiusi: un link tra Doha e l'Arabia Saudita o gli Emirati resterà spento finché i vicini non fanno pace.", "link_modal.the_landing_permit_dispute_in_city":"La disputa sui permessi di approdo a {city} blocca i nuovi link sottomarini per altri {n} giorni.", "link_modal.waves_are_leased_at_a_flat":"Le wave si affittano a canone mensile fisso. Più grandi e più lunghe costano di più, e il sottomarino costa 1,8×. Il primo mese si paga subito.", "link_modal.waves_on_the_same_route_share":"Le wave sullo stesso percorso ne condividono la sorte: una ruspa le taglia tutte.", "link_modal.you_already_have_n_link_here":{"one":"Hai già {n} link qui ({list}). I link paralleli aggiungono capacità. Che percorso deve fare questo?","other":"Hai già {n} link qui ({list}). I link paralleli aggiungono capacità. Che percorso deve fare questo?"}, "link_panels.a_bigger_fabric_carries_more_traffic":"Un fabric più grande porta più traffico e ha posto per più membri. Il tuo router qui deve comunque starci dietro.", +"link_panels.a_diplomatic_spat_has_closed_the":"Una lite diplomatica ha chiuso i confini intorno al Qatar, quindi ogni link tra Doha e l'Arabia Saudita o gli Emirati è giù. Non c'è niente da riparare e la diplomazia non ha riparazioni urgenti: fai il giro lungo, via mare.", "link_panels.a_link_on_standby_carries_traffic":"Un link in standby porta traffico solo quando gli altri link tra queste città sono pieni o giù.", "link_panels.a_link_s_cost_is_its":"Il costo di un link è la sua lunghezza in km più 60, per un moltiplicatore. Il traffico prende il percorso col costo totale più basso.", "link_panels.a_regen_site_turns_the_light":"Un sito di rigenerazione riconverte la luce in bit a metà strada e la rimanda fresca, così le ottiche devono arrivare solo al sito successivo. Ognuno richiede una scheda di rigenerazione per ogni canale acceso. {price}/mese a sito per la casupola.", @@ -2797,6 +2799,7 @@ "link_panels.behind_the_great_firewall":"Dietro il Great Firewall", "link_panels.biggest_fabric_money_can_buy":"Il fabric più grosso che si possa comprare.", "link_panels.biggest_feeder_egress_in_city_set":"Fonte principale: {egress} a {city}. Impostala su “Solo backup”, dai ai clienti un’uscita più vicina (peering, una cache, transit locale) o alza la metrica di questo link.", +"link_panels.border_closed":"Confine chiuso", "link_panels.build_a_pop_here_first":"Prima costruisci un POP qui.", "link_panels.cancel_the_iru":"Disdici l’IRU", "link_panels.carry_here":"Instrada qui", @@ -2894,6 +2897,7 @@ "link_panels.running_an_exchange_in_mainland":"Gestire un exchange nella Cina continentale richiede tutt’altra licenza. Fai peering con le reti cinesi tramite PNI, oppure incontrale a Hong Kong.", "link_panels.runs_at_g_per_channel_on":"Su questa tratta va a {g} per canale (modalità long-haul).", "link_panels.runs_on_its_own_route_a":"Segue un percorso tutto suo. Un taglio qui lascia in piedi gli altri link.", +"link_panels.russia_has_unplugged_itself_from_the":"La Russia si è staccata dal resto di internet per un'esercitazione di internet sovrano. Tutto ciò che esce dal paese resta spento fino a domani.", "link_panels.sell_one_price":"Vendine uno {price}", "link_panels.selling_spare_capacity":"Vendere la capacità libera", "link_panels.shares_a_trench_with_n_other":{"one":"Condivide lo scavo con {n} altro link. Un taglio li butta giù tutti.","other":"Condivide lo scavo con altri {n} link. Un taglio li butta giù tutti."}, diff --git a/site/i18n/pt.js b/site/i18n/pt.js index f915c74..0657f8f 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -2778,11 +2778,13 @@ "link_modal.premium_crossings_are_only_sold_in":"Travessias premium só são vendidas em Hong Kong.", "link_modal.same_trench_cheaper_one_backhoe_cuts":"Mesma vala mais barato · uma retro corta tudo", "link_modal.sold_out_for_n_days":"esgotado por {n} dias", +"link_modal.the_borders_around_qatar_are_closed":"As fronteiras em volta do Catar estão fechadas: um link entre Doha e a Arábia Saudita ou os Emirados vai ficar apagado até os vizinhos fazerem as pazes.", "link_modal.the_landing_permit_dispute_in_city":"A disputa de licença de desembarque em {city} bloqueia novos links subsea por mais {n} dias.", "link_modal.waves_are_leased_at_a_flat":"Waves são alugadas a uma mensalidade fixa. Maior e mais longa custa mais, e subsea é 1,8×. O primeiro mês vence agora.", "link_modal.waves_on_the_same_route_share":"Waves na mesma rota compartilham o destino: uma retroescavadeira corta todas.", "link_modal.you_already_have_n_link_here":{"one":"Você já tem {n} link aqui ({list}). Links paralelos somam capacidade. Como este deve ser roteado?","other":"Você já tem {n} links aqui ({list}). Links paralelos somam capacidade. Como este deve ser roteado?"}, "link_panels.a_bigger_fabric_carries_more_traffic":"Um fabric maior carrega mais tráfego e tem espaço para mais membros. Seu router aqui ainda precisa dar conta.", +"link_panels.a_diplomatic_spat_has_closed_the":"Uma briga diplomática fechou as fronteiras em volta do Catar, então todos os links entre Doha e a Arábia Saudita ou os Emirados estão fora do ar. Não há nada para reparar nem reparo urgente para diplomacia: faça a volta longa, pelo mar.", "link_panels.a_link_on_standby_carries_traffic":"Um link de reserva só leva tráfego quando os outros links entre estas cidades estão cheios ou fora do ar.", "link_panels.a_link_s_cost_is_its":"O custo de um link é seu comprimento em km mais 60, vezes um multiplicador. O tráfego segue o caminho de menor custo total.", "link_panels.a_regen_site_turns_the_light":"Um site de regeneração transforma a luz de volta em bits no meio do caminho e a reenvia novinha, então as ópticas só precisam alcançar o próximo site. Cada um precisa de uma placa de regeneração para cada canal aceso. {price}/mês por site pelo abrigo.", @@ -2797,6 +2799,7 @@ "link_panels.behind_the_great_firewall":"Atrás do Great Firewall", "link_panels.biggest_fabric_money_can_buy":"O maior fabric que o dinheiro pode comprar.", "link_panels.biggest_feeder_egress_in_city_set":"Maior fonte: {egress} em {city}. Coloque em “Só backup”, dê aos clientes uma saída mais próxima (peering, um cache, transit local) ou aumente a métrica deste link.", +"link_panels.border_closed":"Fronteira fechada", "link_panels.build_a_pop_here_first":"Construa um POP aqui primeiro.", "link_panels.cancel_the_iru":"Cancelar o IRU", "link_panels.carry_here":"Trazer para cá", @@ -2894,6 +2897,7 @@ "link_panels.running_an_exchange_in_mainland":"Operar um exchange na China continental exige uma licença totalmente diferente. Faça peering com redes chinesas via PNI ou encontre-as em Hong Kong.", "link_panels.runs_at_g_per_channel_on":"Nesta rota roda a {g} por canal (modo long-haul).", "link_panels.runs_on_its_own_route_a":"Segue uma rota própria. Um corte aqui deixa os outros links de pé.", +"link_panels.russia_has_unplugged_itself_from_the":"A Rússia se desligou do resto da internet para um exercício de internet soberana. Tudo o que sai do país fica apagado até amanhã.", "link_panels.sell_one_price":"Vender um {price}", "link_panels.selling_spare_capacity":"Vender capacidade ociosa", "link_panels.shares_a_trench_with_n_other":{"one":"Divide a vala com {n} outro link. Um corte derruba todos.","other":"Divide a vala com outros {n} links. Um corte derruba todos."}, diff --git a/src/game/80-simulation/40-billing.js b/src/game/80-simulation/40-billing.js index ddf1633..39f3e15 100644 --- a/src/game/80-simulation/40-billing.js +++ b/src/game/80-simulation/40-billing.js @@ -2,7 +2,10 @@ // sample is today's own: leave it out, or every recompute later that day counts today twice and drops a day. const histToday=()=>{const H=S.hist,l=H&&H[H.length-1];return !!l&&l.d===S.day;}; function p95(t,cur,today=histToday()){const a=t.hist||[],n=Math.max(0,a.length-(today&&a.length?1:0)),h=a.slice(Math.max(0,n-29),n).concat([cur]).sort((a,b)=>a-b);return h[Math.max(0,Math.ceil(.95*h.length)-1)];} -function linkDown(l){return l.cut>S.day||(S.ev.runet>S.day&&ruCity(l.a)!==ruCity(l.b))||(S.ev.gulf>S.day&&((CITY[l.a].qa&&(CITY[l.b].gcc||CITY[l.b].uae))||(CITY[l.b].qa&&(CITY[l.a].gcc||CITY[l.a].uae))))||(l.kind==='vxc'&&!!S.ev.fab&&S.ev.fab[l.prov]>S.day)||(l.kind==='df'&&!dfOn(l));} +const gulfPair=(a,b)=>!!((CITY[a].qa&&(CITY[b].gcc||CITY[b].uae))||(CITY[b].qa&&(CITY[a].gcc||CITY[a].uae))); +// A link a closed border has taken dark ('runet', 'gulf' or ''): no repair for it, so the panels name it instead (#329). +const borderShut=l=>S.ev.runet>S.day&&ruCity(l.a)!==ruCity(l.b)?'runet':S.ev.gulf>S.day&&gulfPair(l.a,l.b)?'gulf':''; +function linkDown(l){return l.cut>S.day||!!borderShut(l)||(l.kind==='vxc'&&!!S.ev.fab&&S.ev.fab[l.prov]>S.day)||(l.kind==='df'&&!dfOn(l));} function remoteCities(){return [...new Set(S.links.filter(l=>l.kind==='vxc').flatMap(l=>[l.a,l.b]))].filter(c=>!S.pops[c]);} function nniUsed(c,prov){return S.links.filter(l=>l.kind==='vxc'&&l.prov===prov&&(l.a===c||l.b===c)).reduce((a,l)=>a+VXC[l.vt].g,0)+S.biz.filter(b=>BIZ_T[b.type].nni&&b.prov===prov&&b.city===c).reduce((a,b)=>a+b.bw,0);} // Monthly price of one connection; compute() sums these, the connections overview lists them. diff --git a/src/game/93-ui/70-link-panels.js b/src/game/93-ui/70-link-panels.js index 705313a..39c6541 100644 --- a/src/game/93-ui/70-link-panels.js +++ b/src/game/93-ui/70-link-panels.js @@ -22,10 +22,11 @@ function ixBlock(c,multi){const city=ixCity(c),C=CITY[city],ix=ixName(c),X=XIXM[ h+=``;} h+=``;return h; } +function borderSection(l){const w=borderShut(l);return w?`

${tr('link_panels.border_closed')}

${w==='gulf'?tr('link_panels.a_diplomatic_spat_has_closed_the')+' '+tr('link_panels.back_in_n_days',{n:S.ev.gulf-S.day}):tr('link_panels.russia_has_unplugged_itself_from_the')}

`:'';} function vxcPanel(l){ const load=R.load[l.id]||0,cap=VXC[l.vt].g,u=load/cap,down=linkDown(l),f=FAB[l.prov]; let h=`
${tr('link_panels.virtual_circuit_name_km_km',{name:esc(f.name),km:l.km.toLocaleString()})}

${CITY[l.a].name} ⇄ ${CITY[l.b].name}

`; - if(down)h+=`

${tr('common.fabric_outage')}

${tr('link_panels.name_is_down_nothing_you_can',{name:esc(f.name)})}

`; + h+=borderSection(l);if(down&&!borderShut(l))h+=`

${tr('common.fabric_outage')}

${tr('link_panels.name_is_down_nothing_you_can',{name:esc(f.name)})}

`; h+=`

${tr('common.capacity')}

${tr('link_panels.name_circuit',{name:VXC[l.vt].n})}${fmtG(load)} / ${fmtG(cap)}
${tr('common.monthly')}${tr('common.price_mo',{price:fmt$(l.mo)})}
${!S.pops[l.b]?`

${tr('link_panels.remote_peering_leg_into_ix',{ix:esc(CITY[l.b].ix)})}

`:''}
${VXC.map((V,t)=>t>l.vt?btn(`${V.n} ${tr('common.price_mo',{price:fmt$(vxcMo(l.km,l.sub,t))})}`,'upVxc',{id:l.id,t},'sm'):'').join('')}
@@ -117,6 +118,7 @@ function dfPanel(l){ if(bld){const tot=Math.max(1,l.ready-l.day),done=clamp((S.day-l.day)/tot,0,1); h+=`

${l.own?tr('common.under_construction'):tr('common.being_spliced')}

${l.own?tr('link_panels.permits_trenching_splicing'):tr('common.iru_handover')}${tr('common.n_days_left',{n:l.ready-S.day})}
${l.own&&l.sub?layPanel(l):l.own?`
${btn(tr('link_panels.hire_extra_crews_price_30_days',{price:fmt$(crewCost(l))}),'crews',{id:l.id},'sm',!crewSteps(l)||S.cash${!crewSteps(l)&&l.ready>S.day+1?`

${tr('link_panels.crews_can_halve_a_build_at_most')}

`:''}`:''}

${tr('link_panels.you_can_pre_install_optics_now')}

`;} else if(inc&&linkDown(l))h+=`

${tr('common.dark_6bf5')}

${esc(inc.msg)}

${shipNote(inc)}${inc.cost?btn(`${esc(inc.fix||tr('common.rush_repair'))} ${fmt$(inc.cost)}`,'fixInc',{id:inc.id},'red',S.cash`; + h+=borderSection(l); h+=`

${tr('common.capacity')}

${tr('link_panels.n_of_max_channels_lit',{n:(l.ch||[]).length,max:chMax(l)})}${soldSlots(l)?` · ${tr('link_panels.n_sold_as_alien_waves',{n:soldSlots(l)})}`:''}${mwG(l)?` · ${tr('market.g_sold_as_managed',{g:fmtCap(mwG(l))})}`:''}${fmtG(load)} / ${fmtG(cap)}
${seatPanel(l)}${l.own&&l.sub?`
${tr('common.cable_design')}${tr((SEA_DESIGNS[l.seaDesign]||SEA_DESIGNS.standard).n)}
`:''}
${tr('common.latency')}${tr('common.ms_ms_one_way',{ms:linkLat(l).toFixed(1)})}
${l.own?tr('link_panels.right_of_way_upkeep'):tr('common.iru_lease')}${tr('common.price_mo',{price:fmt$(l.mo)})}
${tr('link_panels.n_amp_huts',{n:amps})}${tr('common.price_mo',{price:fmt$(amps*AMP_MO)})}
${!bld&&!(l.ch||[]).length?`

${tr('link_panels.this_fiber_is_dark_add_optics')}

`:''}
`; @@ -149,6 +151,7 @@ function linkPanel(id){ const load=R.load[l.id]||0,cap=LT[l.tier].g,u=load/cap,cut=l.cut>S.day,trk=l.trench||l.id,inc=S.inc.find(i=>(LINKCUT_TR.includes(i.type)&&i.ref===trk)||((i.type==='fatwave'||i.type==='label'||i.type==='mtu')&&i.ref===l.id)),sib=pairLinks(l.a,l.b).filter(x=>x!==l&&x.kind!=='vxc'),mates=sib.filter(x=>(x.trench||x.id)===trk); let h=`
${l.cable?esc(CAB[l.cable].name):l.sub?tr('common.subsea_cable'):tr('common.terrestrial_fiber')} · ${l.km.toLocaleString()} km

${CITY[l.a].name} ⇄ ${CITY[l.b].name}

`; if(cut)h+=`

${tr('common.cut_2e50')}

${inc?esc(inc.msg):''} ${inc&&shipSea(inc)?'':tr('link_panels.back_in_n_days',{n:l.cut-S.day})}

${shipNote(inc)}${inc&&inc.cost?btn(`${esc(inc.fix||tr('common.rush_repair'))} ${fmt$(inc.cost)}`,'fixInc',{id:inc.id},'red',S.cash`; + h+=borderSection(l); h+=`

${tr('common.capacity')}

${tr('link_panels.name_wave',{name:LT[l.tier].n})}${fmtG(load)} / ${fmtG(cap)}
${tr('common.latency')}${tr('common.ms_ms_one_way',{ms:linkLat(l).toFixed(1)})}
${l.cable?`
${tr('common.cable_system')}${esc(CAB[l.cable].name)}
`:''}
${tr('common.wave_lease')}${tr('common.price_mo',{price:fmt$(l.mo)})}
${u>=0.9?`

${tr('link_panels.congested_upgrade_it_or_add_a')}

`:''} diff --git a/src/game/95-modals/70-link-modal.js b/src/game/95-modals/70-link-modal.js index 5041ab6..4fcce96 100644 --- a/src/game/95-modals/70-link-modal.js +++ b/src/game/95-modals/70-link-modal.js @@ -15,6 +15,7 @@ function openLinkModal(a,b){ 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;} 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)}

`; + if(S.ev.gulf>S.day&&gulfPair(a,b))route+=`

${tr('link_modal.the_borders_around_qatar_are_closed')} ${tr('link_panels.back_in_n_days',{n:S.ev.gulf-S.day})}

`; route+=`

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

`; const wr=waveRoute(a,b,mult,border); openModal(`${head} diff --git a/src/game/95-modals/90-fiber-modals.js b/src/game/95-modals/90-fiber-modals.js index bc968bd..2cba83d 100644 --- a/src/game/95-modals/90-fiber-modals.js +++ b/src/game/95-modals/90-fiber-modals.js @@ -10,7 +10,7 @@ function dfModalBody(a,b,km,pop){ const src=UI.dfSrc==='build'&&!sc?'build':'lease',sys=DF_SYS[UI.dfSys]&&techOk('sys',UI.dfSys,DF_SYS[UI.dfSys].lvl)?UI.dfSys:'lite',amps=ampCount(km); const up=(src==='build'?digCost(km):0)+sysCost(sys)+amps*AMP_COST+pop,mo=(src==='build'?Math.round(km*0.15):dfLeaseMo(km))+amps*AMP_MO; const w=Math.round(waveMo(km,false,4)); - return `

${tr('fiber_modals.a_fiber_pair_of_your_own',{km:AMP_EVERY})}

+ return `${S.ev.gulf>S.day&&gulfPair(a,b)?`

${tr('link_modal.the_borders_around_qatar_are_closed')} ${tr('link_panels.back_in_n_days',{n:S.ev.gulf-S.day})}

`:''}

${tr('fiber_modals.a_fiber_pair_of_your_own',{km:AMP_EVERY})}

${tr('common.the_glass')}

${btn(tr('fiber_modals.lease_an_iru_price_mo_ready_n',{price:fmt$(dfLeaseMo(km)),n:leadDays(IRU_DAYS)}),'dfSrc',{v:'lease'},src==='lease'?'pink':'ghost')}${sc?btn(cabOpen()?tr('modals.lay_your_own_subsea_cable'):tr('modals.your_own_subsea_cable_level_n',{n:CAB_LV}),'ownCab',{},'ghost',!!ownCabWhy(a,b)):btn(glassLvl()>=3?tr('fiber_modals.build_your_own_price_n_days',{price:fmt$(dfBuildCost(km)),n:dfBuildDays(km)}):tr('specialist.dig_your_own_as_a_pioneer',{price:fmt$(digCost(km)),n:dfBuildDays(km),p:Math.round((PIONEER-1)*100)}),'dfSrc',{v:'build'},src==='build'?'pink':'ghost')}${sea?btn(cabOpen()?tr('modals.lay_your_own_subsea_cable'):tr('modals.your_own_subsea_cable_level_n',{n:CAB_LV}),'ownCab',{},'ghost',!!ownCabWhy(a,b)):''}
${sc?`

${tr('fiber_modals.a_fiber_pair_on_cable_km',{cable:esc(CAB[sc.cid].name),km:sc.km.toLocaleString()})}

`:''} ${src==='build'?`

${tr('fiber_modals.your_own_trench_almost_no_rent')}

`:''}

${tr('common.line_system')}

${Object.keys(DF_SYS).map(k=>btn(`${DF_SYS[k].n} ${!techOk('sys',k,DF_SYS[k].lvl)?tr('fiber_modals.level_n',{n:DF_SYS[k].lvl}):fmt$(sysCost(k))}`,'dfSys',{v:k},sys===k?'pink':'ghost',!techOk('sys',k,DF_SYS[k].lvl))).join('')}
${Object.keys(DF_SYS).filter(k=>!techOk('sys',k,DF_SYS[k].lvl)&&demoCan(DF_SYS[k].lvl)).map(k=>`
${demoBtn('sys',k,DF_SYS[k].lvl,'','ghost sm')} ${DF_SYS[k].n}
`).join('')} diff --git a/src/i18n/en.js b/src/i18n/en.js index 89e662f..bb7bbc3 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -2779,11 +2779,13 @@ "link_modal.premium_crossings_are_only_sold_in":"Premium crossings are only sold in Hong Kong.", "link_modal.same_trench_cheaper_one_backhoe_cuts":"Same trench cheaper · one backhoe cuts all", "link_modal.sold_out_for_n_days":"sold out for {n} days", +"link_modal.the_borders_around_qatar_are_closed":"The borders around Qatar are closed: a link between Doha and Saudi Arabia or the UAE will stay dark until the neighbours make up.", "link_modal.the_landing_permit_dispute_in_city":"The landing permit dispute in {city} blocks new subsea links for {n} more days.", "link_modal.waves_are_leased_at_a_flat":"Waves are leased at a flat monthly rate. Bigger and longer costs more, and subsea is 1.8×. First month is due now.", "link_modal.waves_on_the_same_route_share":"Waves on the same route share its fate: one backhoe cuts them all.", "link_modal.you_already_have_n_link_here":{"one":"You already have {n} link here ({list}). Parallel links add capacity. How should this one be routed?","other":"You already have {n} links here ({list}). Parallel links add capacity. How should this one be routed?"}, "link_panels.a_bigger_fabric_carries_more_traffic":"A bigger fabric carries more traffic and has room for more members. Your router here still has to keep up.", +"link_panels.a_diplomatic_spat_has_closed_the":"A diplomatic spat has closed the borders around Qatar, so every link between Doha and Saudi Arabia or the UAE is down. Nothing to repair and no rush job for diplomacy: route the long way round, by sea.", "link_panels.a_link_on_standby_carries_traffic":"A link on standby carries traffic only when the other links between these cities are full or down.", "link_panels.a_link_s_cost_is_its":"A link’s cost is its length in km plus 60, times a multiplier. Traffic takes the path with the lowest total cost.", "link_panels.a_regen_site_turns_the_light":"A regen site turns the light back into bits halfway and sends it on fresh, so optics only have to reach the next site. Each needs a regen card for every lit channel. {price}/mo per site for the hut.", @@ -2798,6 +2800,7 @@ "link_panels.behind_the_great_firewall":"Behind the Great Firewall", "link_panels.biggest_fabric_money_can_buy":"Biggest fabric money can buy.", "link_panels.biggest_feeder_egress_in_city_set":"Biggest feeder: {egress} in {city}. Set it to “Backup only”, give the customers a closer egress (peering, a cache, local transit), or raise this link's metric.", +"link_panels.border_closed":"Border closed", "link_panels.build_a_pop_here_first":"Build a POP here first.", "link_panels.cancel_the_iru":"Cancel the IRU", "link_panels.carry_here":"Carry here", @@ -2895,6 +2898,7 @@ "link_panels.running_an_exchange_in_mainland":"Running an exchange in mainland China takes a different license entirely. Peer with Chinese networks over PNIs, or meet them in Hong Kong.", "link_panels.runs_at_g_per_channel_on":"Runs at {g} per channel on this route (long-haul mode).", "link_panels.runs_on_its_own_route_a":"Runs on its own route. A cut here leaves the other links up.", +"link_panels.russia_has_unplugged_itself_from_the":"Russia has unplugged itself from the rest of the internet for a sovereign internet drill. Everything leaving the country is dark until tomorrow.", "link_panels.sell_one_price":"Sell one {price}", "link_panels.selling_spare_capacity":"Selling spare capacity", "link_panels.shares_a_trench_with_n_other":{"one":"Shares a trench with {n} other link. One cut takes them all down.","other":"Shares a trench with {n} other links. One cut takes them all down."}, diff --git a/tests/border-closed-links.test.js b/tests/border-closed-links.test.js new file mode 100644 index 0000000..f084d0a --- /dev/null +++ b/tests/border-closed-links.test.js @@ -0,0 +1,53 @@ +// #329: a link a political event takes down (the Gulf spat, Russia's sovereign internet drill) is drawn broken on +// the map, so its panel must say why and for how long, and the link modal must warn before you lease one. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); + +const start = "ACT.start({});S.cash=1e9;S.lvl=13;S.nextFail=S.nextEvent=1e9;for(const g of GOALS)S.done[g.id]=0;"; +const panel = ev => ev("document.getElementById('panel').textContent"); + +test('#329 a link down for the Gulf spat says so in its panel, with the days left', () => { + const { ev, errors } = load(); + ev(start + "ACT.launchBB({city:'doh'});S.pops.auh={day:0,bb:null,boost:0,down:0,routers:1,gen:false,rgen:3};compute()"); + ev("S.links.push({id:'w1',a:'doh',b:'auh',kind:'wave',tier:0,km:300,sub:false,mo:1,cut:0,day:0})"); + const id = 'w1'; + ev('S.ev.gulf=S.day+40;compute()'); + assert.equal(ev(`linkDown(S.links.find(l=>l.id==='${id}'))`), true, 'the spat takes it down'); + ev(`selectLink('${id}')`); + assert.match(panel(ev), /Border closed/); + assert.match(panel(ev), /Qatar/); + assert.match(panel(ev), /Back in 40 days/); + // Leasing another one now warns that it stays dark. + ev("openLinkModal('doh','auh')"); + assert.match(ev("document.getElementById('modalCard').textContent"), /stay dark/); + assert.match(ev("dfModalBody('doh','auh',300,0)"), /stay dark/, 'dark fiber warns too'); + // On a phone the panel is a bottom sheet with the same note. + ev(`closeModal();window.innerWidth=390;selectLink('${id}')`); + assert.match(panel(ev), /Border closed/); + ev('window.innerWidth=1280'); + // After the spat, nothing about it. + ev('S.ev.gulf=0;compute();closeModal()'); + ev(`selectLink('${id}')`); + assert.doesNotMatch(panel(ev), /Border closed/); + ev("openLinkModal('doh','auh')"); + assert.doesNotMatch(ev("document.getElementById('modalCard').textContent"), /stay dark/); + assert.deepEqual(errors, []); +}); + +test('#329 dark fiber and virtual circuits into Qatar explain the spat too, and Russia\'s drill is named', () => { + const { ev, errors } = load(); + ev(start + "ACT.launchBB({city:'doh'});S.pops.auh={day:0,bb:null,boost:0,down:0,routers:1,gen:false,rgen:3};compute()"); + ev("S.links.push({id:'dfx',a:'doh',b:'auh',kind:'df',own:false,sys:'lite',ch:[],km:300,sub:false,mo:1,ready:0,cut:0,day:0});S.ev.gulf=S.day+10"); + ev("selectLink('dfx')"); + assert.match(panel(ev), /Border closed/); + ev("S.links.push({id:'vx1',a:'doh',b:'auh',kind:'vxc',prov:Object.keys(FAB)[0],vt:0,km:300,sub:false,mo:1,cut:0,day:0})"); + ev("selectLink('vx1')"); + assert.match(panel(ev), /Border closed/); + assert.match(panel(ev), /Qatar/); + ev("S.links.push({id:'ru1',a:'mos',b:'hel',kind:'wave',tier:0,km:900,sub:false,mo:1,cut:0,day:0});S.ev.gulf=0;S.ev.runet=S.day+1"); + ev("selectLink('ru1')"); + assert.match(panel(ev), /Border closed/); + assert.match(panel(ev), /Russia/); + assert.deepEqual(errors, []); +});