From 9d74873edb749baef1ababad1777134b186309b1 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Fri, 6 Nov 2026 07:21:52 +0100 Subject: [PATCH] NOC tab and Pie Control tidied for phones: Pie Control in the NOC top row, traceroute in Routing & DDoS, government money in the bank - NOC tab: Pie Control is a button in the top row next to "Open NOC dashboard" (only once the rocket company is unlocked) and replaces the Pie in the Sky card; a spat waiting for an answer keeps its card. The Connections button is gone (it lives in the NOC dashboard), and the traceroute moved into the Routing & DDoS modal as an entry that opens the unchanged traceroute modal. - Government money (Rural Digital Pie Fund, Pitcairn grant, Ex-Im Pie Bank) is a section of the bank, shown with a rocket company or anything of the fund's to show. pieGovOpen, the action the toasts use, opens the bank there; pieTab({t:'gov'}) does too. - Pie Control has four tabs (Traffic, Company, Launch, Dishes) in one segmented control that fits 360 px, styled like the HUD's speed buttons. The Founder's posts and the orbit books moved into the Company tab, newest three posts shown and the rest folded. A stale UI.pieTab of 'gov', 'book' or 'founder' falls back. - Agent docs for pieGovOpen, pieTab, routingOpen and connOpen; the route fuzzer drops connOpen from the NOC tab on both pages to stay in lockstep with main. - Tests: tests/noc-panel-layout.test.js, and the pie tests follow the moves. --- CHANGELOG.md | 4 +- docs/plans/pie-in-the-sky.md | 2 +- scripts/lib/fuzz-page.js | 2 + site/i18n/de.js | 9 +- site/i18n/es.js | 11 +-- site/i18n/fr.js | 11 +-- site/i18n/it.js | 9 +- site/i18n/pt.js | 11 +-- src/agent/20-commands.js | 8 +- src/game/60-features/99-pie-subsidies.js | 5 +- src/game/90-actions/97-pie.js | 8 +- src/game/93-ui/40-hud-and-panels.js | 4 +- src/game/93-ui/46-routing-modal.js | 5 +- src/game/93-ui/85-pie-control.js | 34 ++++---- src/game/94-dashboard/70-bank.js | 1 + src/i18n/en.js | 9 +- src/styles/30-toasts.css | 6 ++ src/styles/36-ops.css | 11 +++ tests/noc-panel-layout.test.js | 101 +++++++++++++++++++++++ tests/pie-gov.test.js | 16 ++-- tests/pie-in-the-sky.test.js | 6 +- tests/pie-traffic.test.js | 2 +- 22 files changed, 207 insertions(+), 68 deletions(-) create mode 100644 tests/noc-panel-layout.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b6fc40..effe6cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,11 +19,13 @@ All notable changes to this project are documented here. The project follows - The globe in Pie Control now replays your last few launches: a good one climbs and spills its pies into orbit (and a reusable booster flies home), a failed one goes up in a fireball with debris raining down. - A bad week in orbit now hurts without emptying the sky: a half-baked crust carries part of its traffic from 40% (all of it from 60%) instead of nothing until 60%, satellites wear out a few at a time near the end of their life instead of a whole launch month on one day, no storm or food fight takes more than a tenth of a crust, and orbit customers put up with about a month without service before they cancel. - A full satellite constellation now pays for itself in about seven years if you run it well, instead of practically never: pies cost half as much to build, landing rights cost less (at most $100M a year a country), orbit customers pay about a quarter more, the sky sells 40% of a crust's capacity instead of 25%, and orbit customers call twice as often. Terminal customers also land on the nearest pie dish with room for all of their traffic, instead of squeezing into a nearly full one. -- Governments now pay for space too, in a new Gov tab in Pie Control. The Rural Digital Pie Fund auctions support for remote towns only your satellites reach: ask less than the rival and you are paid every month for five years, as long as the town stays well served after a three-month deadline, or the award is taken away and half of it paid back. The Ex-Im Pie Bank lends a rocket company a lot of money at under 3%, if you launch the pies you promised by a deadline and keep a pie dish in its country; break that and the rate goes up and its government picks a fight. And the UK now pays a smaller grant for Pitcairn when the islanders are online through your satellites. +- Governments now pay for space too, in a Government money section of the bank (Cash · Bank) that appears with your rocket company. The Rural Digital Pie Fund auctions support for remote towns only your satellites reach: ask less than the rival and you are paid every month for five years, as long as the town stays well served after a three-month deadline, or the award is taken away and half of it paid back. The Ex-Im Pie Bank lends a rocket company a lot of money at under 3%, if you launch the pies you promised by a deadline and keep a pie dish in its country; break that and the rate goes up and its government picks a fight. And the UK now pays a smaller grant for Pitcairn when the islanders are online through your satellites. - Pie Control's Launch tab now says how long each crust you are filling takes to fill at your current pace. When that is more than two years, it suggests another launch pad at your coastal POP nearest the equator, with a button to build it. - Buoys, ships' mail and sensors that can live with gaps in the sky now pay a little before a crust carries anything: from 10% coverage, up to about $30M a month for the Shortcrust at 40%, as long as one pie dish works under it. Between 40% and 60% they make way for regular orbit customers, and the Traffic tab lists them. - While your crusts are under 30% covered, the Dishes tab reminds you that pie dishes earn nothing until the sky fills up, so it pays to wait. - The month a crust starts carrying traffic is its grand opening: for 30 days orbit customers call every day and up to four offers wait, so regular customers sign up while the gap-tolerant ones fade out. +- The NOC tab is tidier: Pie Control is a button in its top row next to the NOC dashboard, the traceroute moved into Routing & DDoS, and the Connections button is gone (the list is still in the NOC dashboard). +- Pie Control has four tabs in one row that fits a phone: Traffic, Company, Launch and Dishes. The Founder's posts and your orbit books moved into the Company tab. - Your own subsea cables now land right on the city's dot, also in Fujairah, Dubai, Karachi, Barcelona, Osaka and other cities the map shifts slightly so they do not overlap (#305). - Starting a new network no longer leaves the last one's "New POP!" and money pop-ups frozen all over the map until a reload. diff --git a/docs/plans/pie-in-the-sky.md b/docs/plans/pie-in-the-sky.md index a865812..997c032 100644 --- a/docs/plans/pie-in-the-sky.md +++ b/docs/plans/pie-in-the-sky.md @@ -87,7 +87,7 @@ Reuse the existing sanctions / sovereign-drill / China licence machinery where i - Not over my airspace: two countries each demand their traffic avoid the other's dishes. Each spat is a notification with 2 choices; outcomes deterministic per seed. -## Government money (`60-features/99-pie-subsidies.js`, Pie Control's Gov tab) +## Government money (`60-features/99-pie-subsidies.js`, a section of the bank) - Rural Digital Pie Fund: reverse auctions for towns only orbit reaches (a cut-off POP on backhaul, or a small town of your terminal customers). You ask 90%, 70% or 50% of the reserve; a rival asks 40-100%; the lower ask wins and is paid diff --git a/scripts/lib/fuzz-page.js b/scripts/lib/fuzz-page.js index c8feb56..dc3646d 100644 --- a/scripts/lib/fuzz-page.js +++ b/scripts/lib/fuzz-page.js @@ -64,6 +64,8 @@ // The backbone, Auto-TE and DDoS settings moved from the NOC tab into the Routing & DDoS modal: offer them here on // both pages, in one order, so main's page (settings in the tab) and this one (behind the button) stay in lockstep. if (typeof routingBody === 'function' && b.some((x) => x.act === 'routingOpen')) { const d = document.createElement('div'); d.innerHTML = routingBody(); b = b.filter((x) => x.act !== 'routingOpen').concat(btns(d)); } + // The traceroute moved into that modal too, and Connections left the tab (it is in the dashboard): drop it on both pages. + b = b.filter((x) => x.act !== 'connOpen'); return b.sort((x, y) => (sig(x) < sig(y) ? -1 : sig(x) > sig(y) ? 1 : 0)); } if (w.where === 'openLink') { if (!S.pops[w.a]) return []; openLinkModal(w.a, w.b); return modalOpen() ? btns($('modal')) : []; } diff --git a/site/i18n/de.js b/site/i18n/de.js index 814c67c..88a1481 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -3396,8 +3396,6 @@ "pie.build_pad_price":"Startrampe in {city} bauen {price}", "pie.build_price":"Bauen {price}", "pie.buy":"Kaufen", -"pie.card_live":"{n} Pies im Orbit · {q} Starts geplant", -"pie.card_pitch":"Gründe eine Raketenfirma und bring dein eigenes Internet in den Himmel. Es kostet ein Vermögen.", "pie.co_compensation_dynamics":"Compensation Dynamics", "pie.co_escape_velocity_partners":"Escape Velocity Partners", "pie.co_gravity_is_optional":"Gravity Is Optional", @@ -3420,6 +3418,7 @@ "pie.factory_pitch":"Backt {m} Pies im Monat, für {mo} im Monat.", "pie.factory_stock":"{n} Pies im Regal · {m} im Monat", "pie.feed_empty":"Der Gründer hat noch nichts gepostet. Gib ihm eine Minute.", +"pie.feed_older":{"one":"{n} älterer Post","other":"{n} ältere Posts"}, "pie.found_pitch":"Deine eigene Konstellation: Raketen, Tausende Satelliten (Pies) in Schalen (Krusten) und Schüsseln am Boden. Nichts, was du bisher gebaut hast, kostet so viel.", "pie.found_price":"Firma gründen {price} · {mo}/Monat", "pie.founder_feed":"Der Gründer postet", @@ -3497,7 +3496,6 @@ "pie.t_test":"Testflug {n} ist explodiert, wie Testflüge das so tun. Noch {left}.", "pie.tab_company":"Firma", "pie.tab_dishes":"Schüsseln", -"pie.tab_founder":"Gründer", "pie.tab_launch":"Starts", "pie.test_flight":"Testflug", "pie.unlocked_body":"Du bist Tier 1. Jetzt kannst du eine Raketenfirma gründen und dein eigenes Internet im Orbit backen. Du findest es im NOC-Tab.", @@ -3538,6 +3536,8 @@ "pie_gov.rival_coop":"Genossenschaft Kabelsalat", "pie_gov.rival_hugsnet":"HugsNet", "pie_gov.rival_viasad":"ViaSad", +"pie_gov.section":"Staatsgeld", +"pie_gov.section_note":"Fördergeld und billige Kredite für deine Raketenfirma. Keins davon ohne Haken.", "pie_gov.served":"{p} versorgt", "pie_gov.t_auction":"Förderung für {city}: bis zu {mo}/Monat für {y} Jahre. Gebote bis {d}.", "pie_gov.t_auction_title":"Auktion des Rural Digital Pie Fund", @@ -3551,7 +3551,6 @@ "pie_gov.t_revoked":"Förderung für {city} entzogen: {p} versorgt, der Fonds will {need}. Er fordert {amt} zurück.", "pie_gov.t_warn":"Der Fonds beobachtet {city}: letzten Monat {p} versorgt, er will {need}. Noch so ein Monat und die Förderung ist weg.", "pie_gov.t_won":"Du hast {city} gewonnen: {mo}/Monat. Bis {d} brauchst du {p} Versorgung.", -"pie_gov.tab":"Staat", "pie_gov.until":"Bezahlt bis {d}", "pie_gov.up_to":"bis zu {mo}/Monat", "pie_gov.warned":"noch ein schlechter Monat und sie ist weg", @@ -4220,6 +4219,8 @@ "routing.ddos_defence":"DDoS-Abwehr", "routing.how_traffic_crosses_your_backbone":"Wie Traffic über deinen Backbone läuft und was passiert, wenn eine Flut kommt.", "routing.routing_and_ddos":"Routing & DDoS", +"routing.trace_note":"Folge einem Paket Hop für Hop und sieh, warum es genau dort rausgeht.", +"routing.trace_run":"Tracen", "routing_and_routers.maintenance_window_in_city":"Wartungsfenster in {city}", "routing_and_routers.model_unlocks_at_customer_level_lv":"{model} wird ab Kundenlevel {lv} freigeschaltet.", "routing_and_routers.new_router_in_city_swapped_before":"Neuer Router in {city}
Getauscht, bevor irgendwas eingesteckt war: null Ausfallzeit, null wütende Kunden.", diff --git a/site/i18n/es.js b/site/i18n/es.js index 38db791..9182266 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -3394,8 +3394,6 @@ "pie.build_pad_price":"Construir una plataforma de lanzamiento en {city} {price}", "pie.build_price":"Construir {price}", "pie.buy":"Comprar", -"pie.card_live":"{n} tartas en órbita · {q} lanzamientos en cola", -"pie.card_pitch":"Funda una empresa de cohetes y pon tu propio internet en el cielo. Cuesta una fortuna.", "pie.co_compensation_dynamics":"Compensation Dynamics", "pie.co_escape_velocity_partners":"Escape Velocity Partners", "pie.co_gravity_is_optional":"Gravity Is Optional", @@ -3418,6 +3416,7 @@ "pie.factory_pitch":"Hornea {m} tartas al mes, por {mo} al mes.", "pie.factory_stock":"{n} tartas en el almacén · {m} al mes", "pie.feed_empty":"El Fundador aún no ha publicado nada. Dale un minuto.", +"pie.feed_older":{"one":"{n} publicación anterior","other":"{n} publicaciones anteriores"}, "pie.found_pitch":"Tu propia constelación: cohetes, miles de satélites (tartas) en capas (cortezas) y antenas en tierra. Nada de lo que has construido hasta ahora cuesta tanto.", "pie.found_price":"Fundar la empresa {price} · {mo}/mes", "pie.founder_feed":"Lo que publica el Fundador", @@ -3495,8 +3494,7 @@ "pie.t_test":"El vuelo de prueba {n} explotó, como hacen los vuelos de prueba. Quedan {left}.", "pie.tab_company":"Empresa", "pie.tab_dishes":"Antenas", -"pie.tab_founder":"Fundador", -"pie.tab_launch":"Lanzamientos", +"pie.tab_launch":"Lanzar", "pie.test_flight":"vuelo de prueba", "pie.unlocked_body":"Eres Tier 1. Ahora puedes fundar una empresa de cohetes y hornear tu propio internet en órbita. Está en la pestaña NOC.", "pie.unlocked_title":"Pie in the Sky está desbloqueado", @@ -3536,6 +3534,8 @@ "pie_gov.rival_coop":"Cooperativa La Parabólica", "pie_gov.rival_hugsnet":"HugsNet", "pie_gov.rival_viasad":"ViaSad", +"pie_gov.section":"Dinero público", +"pie_gov.section_note":"Subvenciones y préstamos baratos para tu empresa de cohetes. Todos vienen con letra pequeña.", "pie_gov.served":"{p} servido", "pie_gov.t_auction":"Ayuda para {city}: hasta {mo}/mes durante {y} años. Pujas hasta el {d}.", "pie_gov.t_auction_title":"Subasta del Rural Digital Pie Fund", @@ -3549,7 +3549,6 @@ "pie_gov.t_revoked":"Ayuda para {city} revocada: {p} servido, el fondo quiere {need}. Reclama {amt}.", "pie_gov.t_warn":"El fondo vigila {city}: {p} servido el mes pasado, quiere {need}. Otro mes así y la ayuda se revoca.", "pie_gov.t_won":"Ganaste {city}: {mo}/mes. Tenlo servido al {p} antes del {d}.", -"pie_gov.tab":"Gobierno", "pie_gov.until":"Pagado hasta el {d}", "pie_gov.up_to":"hasta {mo}/mes", "pie_gov.warned":"un mes malo más y se revoca", @@ -4218,6 +4217,8 @@ "routing.ddos_defence":"Defensa DDoS", "routing.how_traffic_crosses_your_backbone":"Cómo cruza el tráfico tu backbone y qué pasa cuando llega una inundación.", "routing.routing_and_ddos":"Routing y DDoS", +"routing.trace_note":"Sigue un paquete salto a salto y mira por qué sale por donde sale.", +"routing.trace_run":"Trazar", "routing_and_routers.maintenance_window_in_city":"Ventana de mantenimiento en {city}", "routing_and_routers.model_unlocks_at_customer_level_lv":"{model} se desbloquea en el nivel de cliente {lv}.", "routing_and_routers.new_router_in_city_swapped_before":"Router nuevo en {city}
Cambiado antes de conectar nada: cero inactividad, cero clientes enfadados.", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index 12a85e1..f91d0a3 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -3394,8 +3394,6 @@ "pie.build_pad_price":"Construire un pas de tir à {city} {price}", "pie.build_price":"Construire {price}", "pie.buy":"Acheter", -"pie.card_live":"{n} tartes en orbite · {q} lancements prévus", -"pie.card_pitch":"Fonde une société de fusées et mets ton propre internet dans le ciel. Ça coûte une fortune.", "pie.co_compensation_dynamics":"Compensation Dynamics", "pie.co_escape_velocity_partners":"Escape Velocity Partners", "pie.co_gravity_is_optional":"Gravity Is Optional", @@ -3418,6 +3416,7 @@ "pie.factory_pitch":"Cuit {m} tartes par mois, pour {mo} par mois.", "pie.factory_stock":"{n} tartes en stock · {m} par mois", "pie.feed_empty":"Le Fondateur n'a encore rien posté. Laisse-lui une minute.", +"pie.feed_older":{"one":"{n} message plus ancien","other":"{n} messages plus anciens"}, "pie.found_pitch":"Ta propre constellation : des fusées, des milliers de satellites (tartes) sur des couches (croûtes), et des antennes au sol. Rien de ce que tu as construit jusqu'ici ne coûte autant.", "pie.found_price":"Fonder la société {price} · {mo}/mois", "pie.founder_feed":"Les posts du Fondateur", @@ -3495,8 +3494,7 @@ "pie.t_test":"Le vol d'essai {n} a explosé, comme tout vol d'essai. Encore {left}.", "pie.tab_company":"Société", "pie.tab_dishes":"Antennes", -"pie.tab_founder":"Fondateur", -"pie.tab_launch":"Lancements", +"pie.tab_launch":"Lancer", "pie.test_flight":"vol d'essai", "pie.unlocked_body":"Tu es Tier 1. Tu peux maintenant fonder une société de fusées et cuire ton propre internet en orbite. C'est dans l'onglet NOC.", "pie.unlocked_title":"Pie in the Sky est débloqué", @@ -3536,6 +3534,8 @@ "pie_gov.rival_coop":"Coopérative La Parabole", "pie_gov.rival_hugsnet":"HugsNet", "pie_gov.rival_viasad":"ViaSad", +"pie_gov.section":"Argent public", +"pie_gov.section_note":"Subventions et prêts bon marché pour ta société de fusées. Aucun n'est sans conditions.", "pie_gov.served":"{p} servi", "pie_gov.t_auction":"Aide pour {city} : jusqu'à {mo}/mois pendant {y} ans. Enchères jusqu'au {d}.", "pie_gov.t_auction_title":"Enchère du Rural Digital Pie Fund", @@ -3549,7 +3549,6 @@ "pie_gov.t_revoked":"Aide pour {city} retirée : {p} servi, le fonds veut {need}. Il récupère {amt}.", "pie_gov.t_warn":"Le fonds surveille {city} : {p} servi le mois dernier, il veut {need}. Encore un mois comme ça et l'aide est retirée.", "pie_gov.t_won":"Tu as gagné {city} : {mo}/mois. Sers-la à {p} d'ici le {d}.", -"pie_gov.tab":"État", "pie_gov.until":"Payé jusqu'au {d}", "pie_gov.up_to":"jusqu'à {mo}/mois", "pie_gov.warned":"encore un mauvais mois et elle est retirée", @@ -4218,6 +4217,8 @@ "routing.ddos_defence":"Défense DDoS", "routing.how_traffic_crosses_your_backbone":"Comment le trafic traverse ton backbone, et ce qui se passe quand une attaque déferle.", "routing.routing_and_ddos":"Routage et DDoS", +"routing.trace_note":"Suis un paquet saut par saut et vois pourquoi il sort là où il sort.", +"routing.trace_run":"Tracer", "routing_and_routers.maintenance_window_in_city":"Fenêtre de maintenance à {city}", "routing_and_routers.model_unlocks_at_customer_level_lv":"Le {model} se débloque au niveau client {lv}.", "routing_and_routers.new_router_in_city_swapped_before":"Nouveau routeur à {city}
Remplacé avant que quoi que ce soit ne soit branché : zéro interruption, zéro client fâché.", diff --git a/site/i18n/it.js b/site/i18n/it.js index 9306767..be89ce2 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -3394,8 +3394,6 @@ "pie.build_pad_price":"Costruisci una rampa di lancio a {city} {price}", "pie.build_price":"Costruisci {price}", "pie.buy":"Compra", -"pie.card_live":"{n} torte in orbita · {q} lanci in coda", -"pie.card_pitch":"Fonda un'azienda di razzi e metti il tuo internet in cielo. Costa una fortuna.", "pie.co_compensation_dynamics":"Compensation Dynamics", "pie.co_escape_velocity_partners":"Escape Velocity Partners", "pie.co_gravity_is_optional":"Gravity Is Optional", @@ -3418,6 +3416,7 @@ "pie.factory_pitch":"Sforna {m} torte al mese, per {mo} al mese.", "pie.factory_stock":"{n} torte in magazzino · {m} al mese", "pie.feed_empty":"Il Fondatore non ha ancora postato. Dagli un minuto.", +"pie.feed_older":{"one":"{n} post precedente","other":"{n} post precedenti"}, "pie.found_pitch":"La tua costellazione: razzi, migliaia di satelliti (torte) su gusci (croste) e parabole a terra. Niente di quello che hai costruito finora costa così tanto.", "pie.found_price":"Fonda l'azienda {price} · {mo}/mese", "pie.founder_feed":"I post del Fondatore", @@ -3495,7 +3494,6 @@ "pie.t_test":"Il volo di prova {n} è esploso, come fanno i voli di prova. Ne mancano {left}.", "pie.tab_company":"Azienda", "pie.tab_dishes":"Parabole", -"pie.tab_founder":"Fondatore", "pie.tab_launch":"Lanci", "pie.test_flight":"volo di prova", "pie.unlocked_body":"Sei un Tier 1. Ora puoi fondare un'azienda di razzi e sfornare il tuo internet in orbita. Lo trovi nella scheda NOC.", @@ -3536,6 +3534,8 @@ "pie_gov.rival_coop":"Cooperativa La Parabola", "pie_gov.rival_hugsnet":"HugsNet", "pie_gov.rival_viasad":"ViaSad", +"pie_gov.section":"Soldi pubblici", +"pie_gov.section_note":"Sussidi e prestiti a buon mercato per la tua azienda di razzi. Nessuno è senza condizioni.", "pie_gov.served":"{p} servito", "pie_gov.t_auction":"Sostegno per {city}: fino a {mo}/mese per {y} anni. Offerte fino al {d}.", "pie_gov.t_auction_title":"Asta del Rural Digital Pie Fund", @@ -3549,7 +3549,6 @@ "pie_gov.t_revoked":"Sostegno per {city} revocato: {p} servito, il fondo vuole {need}. Si riprende {amt}.", "pie_gov.t_warn":"Il fondo tiene d'occhio {city}: {p} servito il mese scorso, vuole {need}. Un altro mese così e il sostegno viene revocato.", "pie_gov.t_won":"Hai vinto {city}: {mo}/mese. Servilo al {p} entro il {d}.", -"pie_gov.tab":"Stato", "pie_gov.until":"Pagato fino al {d}", "pie_gov.up_to":"fino a {mo}/mese", "pie_gov.warned":"ancora un mese brutto ed è revocato", @@ -4218,6 +4217,8 @@ "routing.ddos_defence":"Difesa DDoS", "routing.how_traffic_crosses_your_backbone":"Come il traffico attraversa il tuo backbone e cosa succede quando arriva un attacco.", "routing.routing_and_ddos":"Routing e DDoS", +"routing.trace_note":"Segui un pacchetto hop dopo hop e scopri perché esce proprio lì.", +"routing.trace_run":"Traccia", "routing_and_routers.maintenance_window_in_city":"Finestra di manutenzione a {city}", "routing_and_routers.model_unlocks_at_customer_level_lv":"{model} si sblocca al livello clienti {lv}.", "routing_and_routers.new_router_in_city_swapped_before":"Nuovo router a {city}
Sostituito prima che ci fosse collegato qualcosa: zero downtime, zero clienti arrabbiati.", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 2d90bdf..007658f 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -3394,8 +3394,6 @@ "pie.build_pad_price":"Construir uma plataforma de lançamento em {city} {price}", "pie.build_price":"Construir {price}", "pie.buy":"Comprar", -"pie.card_live":"{n} tortas em órbita · {q} lançamentos na fila", -"pie.card_pitch":"Funde uma empresa de foguetes e coloque sua própria internet no céu. Custa uma fortuna.", "pie.co_compensation_dynamics":"Compensation Dynamics", "pie.co_escape_velocity_partners":"Escape Velocity Partners", "pie.co_gravity_is_optional":"Gravity Is Optional", @@ -3418,6 +3416,7 @@ "pie.factory_pitch":"Assa {m} tortas por mês, por {mo} ao mês.", "pie.factory_stock":"{n} tortas no estoque · {m} por mês", "pie.feed_empty":"O Fundador ainda não postou nada. Dê um minuto.", +"pie.feed_older":{"one":"{n} post mais antigo","other":"{n} posts mais antigos"}, "pie.found_pitch":"Sua própria constelação: foguetes, milhares de satélites (tortas) em camadas (crostas) e antenas no chão. Nada do que você construiu até agora custa tanto.", "pie.found_price":"Fundar a empresa {price} · {mo}/mês", "pie.founder_feed":"Os posts do Fundador", @@ -3495,8 +3494,7 @@ "pie.t_test":"O voo de teste {n} explodiu, como voos de teste fazem. Faltam {left}.", "pie.tab_company":"Empresa", "pie.tab_dishes":"Antenas", -"pie.tab_founder":"Fundador", -"pie.tab_launch":"Lançamentos", +"pie.tab_launch":"Lançar", "pie.test_flight":"voo de teste", "pie.unlocked_body":"Você é Tier 1. Agora pode fundar uma empresa de foguetes e assar sua própria internet em órbita. Está na aba NOC.", "pie.unlocked_title":"Pie in the Sky foi desbloqueado", @@ -3536,6 +3534,8 @@ "pie_gov.rival_coop":"Cooperativa Parabólica", "pie_gov.rival_hugsnet":"HugsNet", "pie_gov.rival_viasad":"ViaSad", +"pie_gov.section":"Dinheiro público", +"pie_gov.section_note":"Subsídios e empréstimos baratos para sua empresa de foguetes. Nenhum vem sem condições.", "pie_gov.served":"{p} atendido", "pie_gov.t_auction":"Apoio para {city}: até {mo}/mês por {y} anos. Lances até {d}.", "pie_gov.t_auction_title":"Leilão do Rural Digital Pie Fund", @@ -3549,7 +3549,6 @@ "pie_gov.t_revoked":"Apoio para {city} revogado: {p} atendido, o fundo quer {need}. Ele pega de volta {amt}.", "pie_gov.t_warn":"O fundo está de olho em {city}: {p} atendido no mês passado, ele quer {need}. Mais um mês assim e o apoio é revogado.", "pie_gov.t_won":"Você ganhou {city}: {mo}/mês. Deixe {p} atendido até {d}.", -"pie_gov.tab":"Governo", "pie_gov.until":"Pago até {d}", "pie_gov.up_to":"até {mo}/mês", "pie_gov.warned":"mais um mês ruim e é revogado", @@ -4218,6 +4217,8 @@ "routing.ddos_defence":"Defesa DDoS", "routing.how_traffic_crosses_your_backbone":"Como o tráfego cruza seu backbone e o que acontece quando chega uma enxurrada.", "routing.routing_and_ddos":"Roteamento e DDoS", +"routing.trace_note":"Siga um pacote salto a salto e veja por que ele sai por onde sai.", +"routing.trace_run":"Traçar", "routing_and_routers.maintenance_window_in_city":"Janela de manutenção em {city}", "routing_and_routers.model_unlocks_at_customer_level_lv":"{model} desbloqueia no nível de cliente {lv}.", "routing_and_routers.new_router_in_city_swapped_before":"Roteador novo em {city}
Trocado antes de qualquer coisa estar conectada: zero downtime, zero clientes bravos.", diff --git a/src/agent/20-commands.js b/src/agent/20-commands.js index 0a8cff3..62cdc99 100644 --- a/src/agent/20-commands.js +++ b/src/agent/20-commands.js @@ -444,8 +444,8 @@ const API_CMD={ const API_VIEW={ pieOpen:{args:[],doc:'Open Pie Control, the rocket company\'s panel.'}, - pieGovOpen:{args:[],doc:'Open Pie Control on its Gov tab.'}, - pieTab:{args:[['t','pieTab']],doc:'Switch the Pie Control tab.'}, + pieGovOpen:{args:[],doc:'Open the bank at its Government money section: the rocket company\'s fund auctions, the Pitcairn grant and the Ex-Im Pie Bank (it used to be Pie Control\'s Gov tab).'}, + pieTab:{args:[['t','pieTab']],doc:'Switch the Pie Control tab: traffic, co (the company, its books and the Founder\'s posts), fly (launches) or dish.'}, pieCity:{args:[['v','cityId']],doc:'Pick the POP the Dishes tab works on.'}, pieHi:{args:[['id','string']],doc:'Highlight one orbit flow on the Pie Control globe.'}, pieIns:{args:[],doc:'Toggle launch insurance for the next launches.'}, @@ -488,7 +488,7 @@ const API_VIEW={ popsSort:{args:[['k','popsSortKey']],doc:'Flip the sort of the list of cities with no POP.'}, goConn:{args:[['city','cityId'],['k','connKind']],doc:'Open a city\'s connections tab.'}, goEgress:{args:[['city','cityId'],['k','egressKind']],doc:'Open a city\'s connections tab (l2 for the customer list).'}, - connOpen:{args:[],doc:'Open the connections dashboard tab.'}, + connOpen:{args:[],doc:'Open the connections tab of the NOC dashboard (also the Peering tab\'s "All connections" button).'}, connF:{args:[['f','connFilter'],['v','string',false]],doc:'Filter the connections list.'}, connCity:{args:[['v','string']],doc:'Filter the connections list by city.'}, connNet:{args:[['v','string']],doc:'Filter the connections list by network.'}, @@ -501,7 +501,7 @@ const API_VIEW={ offerStep:{args:[],doc:'Select the next open offer (soonest to expire first), centre its city and mark it under Offers here: the $ key.'}, zoomStep:{args:[['d','integer']],doc:'Zoom the map out (d<0) or in (d>0) around its middle: the - and = keys.'}, keys:{args:[],doc:'Open the list of keyboard shortcuts (the ? key).'}, - routingOpen:{args:[],doc:'Open the Routing & DDoS window: backbone, Auto-TE and DDoS settings (the button at the top of the NOC tab).'}, + routingOpen:{args:[],doc:'Open the Routing & DDoS window: the traceroute, backbone, Auto-TE and DDoS settings (the button at the top of the NOC tab).'}, opsOpen:{args:[],doc:'Open the Ops sheet: the NOC intern\'s mood, weekly shift report and standing orders.'}, salesOpen:{args:[],doc:'Open the sales desk sheet: the three kinds of salesperson, who is at the desk and what they cost.'}, opsCity:{args:[['v','cityId',false]],doc:'Show one POP\'s standing-order exceptions in the Ops sheet.'}, diff --git a/src/game/60-features/99-pie-subsidies.js b/src/game/60-features/99-pie-subsidies.js index 251a579..6cd366d 100644 --- a/src/game/60-features/99-pie-subsidies.js +++ b/src/game/60-features/99-pie-subsidies.js @@ -97,7 +97,10 @@ function pieGovFix(g,s){const o=pieGovBlank(),day=s.day,ob=x=>x&&typeof x==='obj function pieEximFix(s){const ccs=new Set(CITIES.map(c=>c.cc)),home=isCity(s.home)?CITY[s.home].cc:CITIES[0].cc; for(const l of s.loans||[]){if(l.bank!=='exim')continue;const q=l.pie&&typeof l.pie==='object'?l.pie:{}; l.pie={cc:ccs.has(q.cc)?q.cc:home,n:int(q.n,0,1e5,0),by:int(q.by,0,s.day+PIE_EXIM_BY,0),flown:int(q.flown,0,1e6,0),br:int(q.br,0,1e4,0)};l.covs=['pielaunch','piedish'];}} -/* ---- Pie Control: the Gov tab ---- */ +/* ---- The bank's Government money section (it was Pie Control's Gov tab) ---- */ +// Shown once there is a rocket company, or anything of the fund's or the Ex-Im bank's to show. +function pieGovShow(){const P=S&&S.pie;return !!(P&&pieOn()&&(P.co||P.gov.auc.length||P.gov.aw.length||P.gov.ex||pieEximLoan()));} +function pieGovBank(){return pieGovShow()?`

🏛️ ${tr('pie_gov.section')}

${tr('pie_gov.section_note')}

${pieGovHtml()}
`:'';} function pieGovHtml(){const P=S.pie,G=P.gov,can=pieCanBuild();let h=`
🏛️ ${tr('pie_gov.rdf')}

${tr('pie_gov.rdf_note',{y:PIE_RDF_TERM/360,p:pct(PIE_RDF_NEED),c:pct(PIE_RDF_CLAW)})}

`; for(const a of G.auc)h+=`
${esc(CITY[a.city].name)} · ${tr('pie_gov.up_to',{mo:fmt$(a.ask)})}${tr('pie_gov.closes',{d:dateStr(a.close)})}
${PIE_RDF_BIDS.map(f=>btn(tr('pie_gov.ask',{mo:fmt$(Math.round(a.ask*f))}),'pieBid',{id:a.id,f},a.bid===f?'pink sm':'ghost sm',!can)).join('')}
`; diff --git a/src/game/90-actions/97-pie.js b/src/game/90-actions/97-pie.js index 9805635..f954039 100644 --- a/src/game/90-actions/97-pie.js +++ b/src/game/90-actions/97-pie.js @@ -1,5 +1,5 @@ // Pie in the Sky (60-features/99-pie-in-the-sky.js): every action checks pieCanBuild() for anything new. -const pieRe=()=>{after();if(!$('modal').hidden&&$('modal').className==='pie')pieModal();}; +const pieRe=()=>{after();if(!$('modal').hidden&&$('modal').className==='pie')pieModal();if(!$('bankBox').hidden)renderBank();}; const pieNo=why=>{toast(why,'bad');sfx('err');pieRe();}; Object.assign(ACT,{ pieOpen:()=>{if(!S||pzOn()||!pieOn())return;UI.confirm=null;pieModal();}, @@ -28,13 +28,13 @@ Object.assign(ACT,{ pieSafe:()=>{const P=pieGet();if(!P||!P.co)return;P.safe=!P.safe;sfx('click');pieRe();}, pieName:()=>{const P=pieGet();if(!P||!P.co)return;const i=PIE_NAMES.indexOf(P.co.name);P.co.name=PIE_NAMES[(i+1)%PIE_NAMES.length];pieFounder(N_('pie.fp_rename'));pieRe();}, pieRename:()=>{const P=pieGet(),el=$('pieNm');if(!P||!P.co||!el)return;const v=el.value.replace(/\s+/g,' ').trim().slice(0,40);if(!v)return;P.co.name=v;pieFounder(N_('pie.fp_rename'));pieRe();}, - // Government money (60-features/99-pie-subsidies.js): Pie Control's Gov tab, a bid, the Ex-Im loan. - pieGovOpen:()=>{if(!S||pzOn()||!pieOn())return;UI.pieTab='gov';UI.confirm=null;pieModal();}, + // Government money (60-features/99-pie-subsidies.js): its section in the bank, a bid, the Ex-Im loan. It was Pie Control's Gov tab; the name stays for old toasts. + pieGovOpen:()=>{if(!S||pzOn()||!pieOn())return;if(!$('modal').hidden)closeModal();ACT.bank();const g=$('bankGov');if(g&&g.scrollIntoView)g.scrollIntoView({block:'start'});}, pieBid:({id,f})=>{const P=pieGet();f=+f;const a=P&&P.gov.auc.find(x=>x.id===id);if(!a||!PIE_RDF_BIDS.includes(f))return;if(!pieCanBuild())return pieNo(tr('pie.why_not_t1')); a.bid=f;toast(tr('pie_gov.t_bid',{city:esc(CITY[a.city].name),mo:fmt$(Math.round(a.ask*f)),d:dateStr(a.close)}),'good');sfx('click');pieRe();}, pieExim:()=>{const P=pieGet();if(!P||!P.co)return;if(!pieCanBuild())return pieNo(tr('pie.why_not_t1'));if(!pieEximTake())return pieRe(); const l=pieEximLoan();toast(`${tr('interface.amt_from_bank_has_landed',{amt:fmt$(l.amount),bank:esc(BANKS.exim.name)})}
${loanSummary(l)}`,'good');sfx('coin');pieRe();}, - pieTab:({t})=>{if(!PIE_TABS.includes(t))return;UI.pieTab=t;pieModal();}, + pieTab:({t})=>{if(t==='gov')return ACT.pieGovOpen();if(!PIE_TABS.includes(t)&&t!=='book'&&t!=='founder')return;UI.pieTab=pieTabOf(t);pieModal();}, pieHi:({id})=>{if(typeof id!=='string')return;sfx('click');pieHiSet(id);}, pieCity:({v})=>{if(!S||!S.pops[v])return;UI.pieCity=v;pieModal();}, }); diff --git a/src/game/93-ui/40-hud-and-panels.js b/src/game/93-ui/40-hud-and-panels.js index c831f79..f05d9f8 100644 --- a/src/game/93-ui/40-hud-and-panels.js +++ b/src/game/93-ui/40-hud-and-panels.js @@ -49,9 +49,9 @@ function renderLeft(){checkLayer(); h+=`
${esc(o.name)}
${esc(BIZ_T[o.type].l)} · ${CITY[o.city].name}${o.city2?' ⇄ '+CITY[o.city2].name:''} · ${bTerms(o)} · ${tr('ui.n_d_left',{n:o.exp-S.day})}${(o.reqs||[]).length?` · ${trn('hud_and_panels.n_special_requirement',o.reqs.length)}`:''}
${o.refN?`
${tr('lifecycle.referred_by',{name:esc(o.refN)})}
`:''}${spotWhy(o)}${bRisk(o)}${reqList(o)}
${has?btn(tr('common.accept'),'accept',{id:o.id},'green sm'):btn(tr('common.go_there'),'focusCity',{city:bCities(o).find(c=>!S.pops[c])},'ghost sm')}${btn(tr('common.decline'),'decline',{id:o.id},'ghost sm')}
${has?'':`
${tr('hud_and_panels.needs_a_pop_in_cities',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}
`}
`;} }else if(UI.left==='noc'){ - h+=`
${btn(tr('hud_and_panels.open_noc_dashboard'),'dash',{},'pink')}${btn(tr('common.connections'),'connOpen',{},'')}${btn(tr('common.traceroute'),'trace',{},'')}${btn(`⚙️ ${tr('routing.routing_and_ddos')}${S.te&&!coreTE()?'':''}`,'routingOpen',{},'')}
`; + h+=`
${btn(tr('hud_and_panels.open_noc_dashboard'),'dash',{},'pink')}${pieNocBtn()}${btn(`⚙️ ${tr('routing.routing_and_ddos')}${S.te&&!coreTE()?'':''}`,'routingOpen',{},'')}
`; h+=`

${tr('hud_and_panels.your_network_operations_center_every')}

`; - h+=opsCard()+pieCard()+mkCard()+ddosPanel(); + h+=opsCard()+pieSpatCard()+mkCard()+ddosPanel(); // Incidents come first, the ones you can fix with one click at the top (#63): no scrolling past hot ports to replace an optic. for(const i of S.inc.filter(i=>i.type!=='ddos').sort((a,b)=>(b.cost?1:0)-(a.cost?1:0)||(b.impact||0)-(a.impact||0))){h+=`
${incTitle(i.type)}
${esc(i.msg)}
${shipSea(i)?'🚢 '+esc(shipStatus(i)):trn('hud_and_panels.auto_fix_in_n_day',i.until-S.day)}${i.impact?` · ${tr('hud_and_panels.g_lost',{g:fmtG(i.impact)})}`:''}
${i.cost?`
${btn(`${esc(i.fix||tr('common.rush_repair'))} ${fmt$(i.cost)}`,'fixInc',{id:i.id},'red sm',S.cash`:''}
`;} h+=logSection();UI.logSeen=Date.now(); diff --git a/src/game/93-ui/46-routing-modal.js b/src/game/93-ui/46-routing-modal.js index 5d2aae1..98367ae 100644 --- a/src/game/93-ui/46-routing-modal.js +++ b/src/game/93-ui/46-routing-modal.js @@ -1,12 +1,13 @@ /* ---------- Routing & DDoS: one modal for the network-wide settings ---------- The backbone, Auto-TE and DDoS automation used to sit at the bottom of the NOC tab, below every incident and - the log, where nobody found them. A button at the top of the NOC tab opens them here. */ + the log, where nobody found them. A button at the top of the NOC tab opens them here, with the traceroute. */ // Auto-TE: paused, installed or for sale. function tePanel(){ return S.te&&!coreTE()?`
Auto-TE${tr('core.paused')}

${tr('core.auto_te_is_paused_it_needs')}

`:S.te?`
Auto-TE${S.te.on?tr('hud_and_panels.on_moving_g_onto_alternate_paths',{g:fmtG(R.teMoved||0)}):tr('common.off')}
${btn(S.te.on?tr('hud_and_panels.turn_auto_te_off'):tr('hud_and_panels.turn_auto_te_on'),'teToggle',{},'ghost sm')}${btn(S.te.script?tr('common.edit_routescript'):tr('hud_and_panels.write_a_routescript'),'teEdit',{},'pink sm')}
${S.te.script?`

RouteScript: ${teRules()?tr('hud_and_panels.n_rules_live',{n:teRules().n}):S.te.on?tr('hud_and_panels.has_errors_not_running'):tr('common.controller_off')}${R.teBlack?` · ${tr('hud_and_panels.blackholing_g',{g:fmtG(R.teBlack)})}`:''}

`:''}` :`
Auto-TE${lvl()<3?tr('hud_and_panels.unlocks_at_customer_level_3'):tr('common.not_installed')}

${tr('hud_and_panels.traffic_takes_the_shortest_path_even')}

${coreTE()?'':`

${tr('core.auto_te_needs_an_rsvp_te_or')}

`}
${btn(tr('hud_and_panels.install_auto_te_cost_mo_mo',{cost:fmt$(TE_COST),mo:fmt$(TE_MO)}),'buyTE',{},'pink sm',lvl()<3||S.cash`;} // What the modal holds, without its title (scripts/lib/fuzz-page.js reads its buttons too). -function routingBody(){return corePanel()+`

${tr('common.traffic_engineering')}

${tePanel()}` +// Traceroute opens its own modal from here: it explains the routing these settings shape. +function routingBody(){return `
🔎 ${tr('common.traceroute')}
${tr('routing.trace_note')}
${btn(tr('routing.trace_run'),'trace',{},'sm')}
`+corePanel()+`

${tr('common.traffic_engineering')}

${tePanel()}` +`

${tr('routing.ddos_defence')}

${ddosSettings()}`;} function routingModal(){if(!S)return;const card=$('modalCard'),open=!$('modal').hidden&&card.querySelector('[data-routing]'),st=open?card.scrollTop:0; let h=`
NOC

${tr('routing.routing_and_ddos')}

diff --git a/src/game/93-ui/85-pie-control.js b/src/game/93-ui/85-pie-control.js index ef881a7..604fc60 100644 --- a/src/game/93-ui/85-pie-control.js +++ b/src/game/93-ui/85-pie-control.js @@ -1,24 +1,29 @@ -// Pie Control: a plain modal (a bottom sheet on phones) for the rocket company. Reached from the NOC tab (pieCard()). +// Pie Control: a plain modal (a bottom sheet on phones) for the rocket company. Reached from the NOC tab (pieNocBtn()). let PIE_CCN=null; function pieLicCountry(cc){try{PIE_CCN=PIE_CCN&&PIE_CCN.l===LANG?PIE_CCN:{l:LANG,d:new Intl.DisplayNames([LANG],{type:'region'})};return PIE_CCN.d.of(cc)||cc;}catch(e){return cc;}} -function pieCard(){if(!pieOn())return '';const P=S.pie; - return `
🥧 ${tr('pie.pie_in_the_sky')}
${P&&P.co?esc(pieCoName())+' · '+tr('pie.card_live',{n:Object.keys(CRUSTS).reduce((a,id)=>a+pieLive(id),0),q:P.q.length}):tr('pie.card_pitch')}
- ${pieSpatCard()}
${btn(tr('pie.open_pie_control'),'pieOpen',{},P&&P.co?'sm':'pink sm')}
`;} -const PIE_TABS=['traffic','co','fly','dish','gov','book']; +// Pie Control sits in the NOC tab's top row once the rocket company is unlocked; a spat waiting for an answer keeps its own card lower down. +function pieNocBtn(){if(!pieOn())return '';return btn(`🥧 ${tr('pie.open_pie_control')}`,'pieOpen',{},'');} +const PIE_TABS=['traffic','co','fly','dish']; +// The tab UI.pieTab names, or the one that took its place: Gov moved to the bank, the Founder's feed into Company. +const pieTabOf=t=>PIE_TABS.includes(t)?t:t==='book'||t==='founder'?'co':'traffic'; +const PIE_FEED_TOP=3; const pieTag=(t,on)=>`${t}`; -function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pieCanBuild(),T=PIE_TABS.includes(UI.pieTab)?UI.pieTab:'traffic'; +function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pieCanBuild(),T=UI.pieTab=pieTabOf(UI.pieTab); let h=`
${tr('pie.pie_in_the_sky')}

${P.co?esc(pieCoName()):tr('pie.pie_control')}

`; if(!can)h+=`

${tr('pie.why_not_t1')}

`; if(pieSand())h+=`

${tr('pie.sandbox_note',{amt:fmt$(P.book.wouldHave)})}

`; if(!P.co){h+=`

${tr('pie.found_pitch')}

${btn(tr('pie.found_price',{price:fmt$(piePrice(PIE_CO)),mo:fmt$(PIE_CO_MO)}),'pieFound',{},'pink',!can)}
`;openModal(h,'pie');return;} - const tab=(k,l)=>``; + const tab=(k,l)=>``; h+=pieGlobeHtml()+pieSpatCard(); - h+=`
${tab('traffic',tr('pie_traffic.tab'))}${tab('co',tr('pie.tab_company'))}${tab('fly',tr('pie.tab_launch'))}${tab('dish',tr('pie.tab_dishes'))}${tab('gov',tr('pie_gov.tab'))}${tab('book',tr('pie.tab_founder'))}
`; + h+=`
${tab('traffic',tr('pie_traffic.tab'))}${tab('co',tr('pie.tab_company'))}${tab('fly',tr('pie.tab_launch'))}${tab('dish',tr('pie.tab_dishes'))}
`; const cities=Object.keys(S.pops).sort((a,b)=>CITY[a].name.localeCompare(CITY[b].name)),c=S.pops[UI.pieCity]?UI.pieCity:cities[0]; const sel=`
`; if(T==='traffic')h+=pieTrafficHtml(); else if(T==='co'){ h+=`
${tr('pie.running_costs')}${tr('common.price_mo',{price:fmt$(pieMo())})}
`; + h+=`
${tr('pie.spent')}${fmt$(P.book.spent)}
${tr('pie.earned')}${fmt$(P.book.earned)}
`; + if(R&&R.pie)h+=`

${tr('pie.earned_mo',{amt:fmt$(R.pie.rev),n:R.pie.isl.length})}

`; + if(pieSand())h+=`
${tr('pie.would_have')}${fmt$(P.book.wouldHave)}
`; h+=`
🏭 ${tr('pie.factory')}
${P.fac?tr('pie.factory_stock',{n:Math.floor(P.stock),m:PIE_FAC_MONTH}):tr('pie.factory_pitch',{m:PIE_FAC_MONTH,mo:fmt$(PIE_FAC_MO)})}
${P.fac?'':`
${btn(tr('pie.build_price',{price:fmt$(piePrice(PIE_FAC))}),'pieFactory',{},'pink sm',!can)}
`}
`; h+=`
🧪 ${tr('pie.rd')}
${Object.keys(PIE_RD).map(k=>`
${tr(PIE_RD[k].n)}${P.rd[k]?`✓`:btn(fmt$(piePrice(PIE_RD[k].cost)),'pieRd',{k},'ghost sm',!can)}
`).join('')} ${P.rd.heavy?`

${tr('pie.heavy_tests',{n:P.rd.heavyTests,max:PIE_HEAVY_TESTS})}

`:''}
`; @@ -27,6 +32,7 @@ function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pi h+=`
🏷️ ${tr('pie.name')}
${btn(tr('pie.next_name'),'pieName',{},'ghost sm')}
${btn(tr('slots.rename'),'pieRename',{},'ghost sm')}
`; h+=`
${btn(P.safe?tr('pie.safe_on'):tr('pie.safe_off'),'pieSafe',{},P.safe?'red sm':'ghost sm')}

${tr('pie.safe_note')}

`; + h+=pieFeedHtml(P.founder); }else if(T==='fly'){ let nudge=false; h+=Object.keys(CRUSTS).map(id=>{const C=CRUSTS[id],cv=pieCov(id);return `
${tr(C.n)} ${pieTag(pieBaked(id)?tr('pie.baked'):tr('pie.half_baked'),pieBaked(id))}
@@ -51,12 +57,10 @@ function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pi const ccs=[...new Set([...P.dishes.map(x=>CITY[x.city].cc),CITY[c].cc,...Object.keys(P.lic)])]; h+=`

${tr('pie.landing_rights')}

`+ccs.map(cc=>{const l=P.lic[cc],ok=pieLicOk(cc); return `
${esc(pieLicCountry(cc))}${ok?' · '+tr('pie.lic_until',{d:dateStr(l.until)}):l&&l.state!=='ok'&&l.until>S.day?' · '+tr('pie.lic_refused'):''}${btn((ok?tr('pie.renew'):tr('pie.buy'))+' '+fmt$(pieLicPrice(cc)),'pieLic',{cc},'ghost sm')}
`;}).join(''); - }else if(T==='gov')h+=pieGovHtml(); - else{ - const F=P.founder;h+=`
${tr('pie.promises')}${tr('pie.promises_line',{n:F.promises,b:F.broken})}
`; - h+=`
${tr('pie.spent')}${fmt$(P.book.spent)}
${tr('pie.earned')}${fmt$(P.book.earned)}
`; - if(R&&R.pie)h+=`

${tr('pie.earned_mo',{amt:fmt$(R.pie.rev),n:R.pie.isl.length})}

`; - if(pieSand())h+=`
${tr('pie.would_have')}${fmt$(P.book.wouldHave)}
`; - h+=`

${tr('pie.founder_feed')}

`+(F.posts.length?F.posts.map(p=>`
${esc(dateStr(p.d))}
${esc(pieFpText(p))}
`).join(''):`

${tr('pie.feed_empty')}

`); } openModal(h,'pie');{const cv=document.querySelector('#modal .pgcv');if(cv)pieGlobeOpen(cv,pieGlobeData);}} +// The Founder's posts are flavour: the newest few at the bottom of the Company tab, the older ones folded away. +function pieFeedHtml(F){const post=p=>`
${esc(dateStr(p.d))}
${esc(pieFpText(p))}
`,top=F.posts.slice(0,PIE_FEED_TOP),more=F.posts.slice(PIE_FEED_TOP); + return `

${tr('pie.founder_feed')}

${tr('pie.promises')}${tr('pie.promises_line',{n:F.promises,b:F.broken})}
` + +(top.length?top.map(post).join(''):`

${tr('pie.feed_empty')}

`) + +(more.length?`
${trn('pie.feed_older',more.length)}${more.map(post).join('')}
`:'')+'
';} diff --git a/src/game/94-dashboard/70-bank.js b/src/game/94-dashboard/70-bank.js index 5232ce7..9affb05 100644 --- a/src/game/94-dashboard/70-bank.js +++ b/src/game/94-dashboard/70-bank.js @@ -29,5 +29,6 @@ function renderBank(){ ${B.equity?`
${tr('bank.taking_pct_of_your_revenue_every',{pct:pct(l.share)})}
`:`
${tr('common.still_owed')}${fmt$(l.bal)}
${loanLine(l)}
`} ${covList(l)}${l.breach>=1?`
${trn('bank.condition_broken_for_n_day',l.breach)} ${l.breach<10?tr('bank.penalty_in_n_days',{n:10-l.breach}):tr('bank.penalties_are_running')}
`:''}
${btn(UI.confirm===l.id?tr('bank.really_pay_price',{price:fmt$(cost)}):B.equity?tr('bank.buy_them_out_price',{price:fmt$(cost)}):tr('bank.repay_early_price_incl_2_fee',{price:fmt$(cost)}),'repayLoan',{id:l.id},UI.confirm===l.id?'red sm':'sm',S.cash
`;} + h+=pieGovBank(); if(h!==UI._bh){UI._bh=h;$('bankCard').innerHTML=h;} } diff --git a/src/i18n/en.js b/src/i18n/en.js index 3851e58..98d9496 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -3395,8 +3395,6 @@ "pie.build_pad_price":"Build a launch pad in {city} {price}", "pie.build_price":"Build {price}", "pie.buy":"Buy", -"pie.card_live":"{n} pies in orbit · {q} launches queued", -"pie.card_pitch":"Found a rocket company and put your own internet in the sky. It costs a fortune.", "pie.co_compensation_dynamics":"Compensation Dynamics", "pie.co_escape_velocity_partners":"Escape Velocity Partners", "pie.co_gravity_is_optional":"Gravity Is Optional", @@ -3419,6 +3417,7 @@ "pie.factory_pitch":"Bakes {m} pies a month, for {mo} a month.", "pie.factory_stock":"{n} pies on the shelf · {m} a month", "pie.feed_empty":"The Founder has not posted yet. Give it a minute.", +"pie.feed_older":{"one":"{n} older post","other":"{n} older posts"}, "pie.found_pitch":"Your own constellation: rockets, thousands of satellites (pies) in shells (crusts), and dishes on the ground. Nothing you have built so far costs this much.", "pie.found_price":"Found the company {price} · {mo}/mo", "pie.founder_feed":"The Founder posts", @@ -3496,7 +3495,6 @@ "pie.t_test":"Test flight {n} exploded, as test flights do. {left} to go.", "pie.tab_company":"Company", "pie.tab_dishes":"Dishes", -"pie.tab_founder":"Founder", "pie.tab_launch":"Launch", "pie.test_flight":"test flight", "pie.unlocked_body":"You are a Tier 1. Now you can found a rocket company and bake your own internet in orbit. Find it in the NOC tab.", @@ -3537,6 +3535,8 @@ "pie_gov.rival_coop":"Co-op de Ville", "pie_gov.rival_hugsnet":"HugsNet", "pie_gov.rival_viasad":"ViaSad", +"pie_gov.section":"Government money", +"pie_gov.section_note":"Subsidies and cheap loans for your rocket company. Every one of them comes with strings.", "pie_gov.served":"{p} served", "pie_gov.t_auction":"Support for {city}: up to {mo}/mo for {y} years. Bids close {d}.", "pie_gov.t_auction_title":"Rural Digital Pie Fund auction", @@ -3550,7 +3550,6 @@ "pie_gov.t_revoked":"Award for {city} revoked: {p} served, the fund wants {need}. It claws back {amt}.", "pie_gov.t_warn":"The fund is watching {city}: {p} served last month, it wants {need}. Another month like that and the award is revoked.", "pie_gov.t_won":"You won {city}: {mo}/mo. Have it {p} served by {d}.", -"pie_gov.tab":"Gov", "pie_gov.until":"Paid until {d}", "pie_gov.up_to":"up to {mo}/mo", "pie_gov.warned":"one more bad month and it is revoked", @@ -4219,6 +4218,8 @@ "routing.ddos_defence":"DDoS defence", "routing.how_traffic_crosses_your_backbone":"How traffic crosses your backbone, and what happens when a flood arrives.", "routing.routing_and_ddos":"Routing & DDoS", +"routing.trace_note":"Follow one packet hop by hop and see why it leaves where it does.", +"routing.trace_run":"Trace", "routing_and_routers.maintenance_window_in_city":"Maintenance window in {city}", "routing_and_routers.model_unlocks_at_customer_level_lv":"{model} unlocks at customer level {lv}.", "routing_and_routers.new_router_in_city_swapped_before":"New router in {city}
Swapped before anything was plugged in: zero downtime, zero angry customers.", diff --git a/src/styles/30-toasts.css b/src/styles/30-toasts.css index 47db06f..0086d63 100644 --- a/src/styles/30-toasts.css +++ b/src/styles/30-toasts.css @@ -5,6 +5,12 @@ .toast .b{pointer-events:auto} .seg{display:flex;flex-wrap:wrap;gap:6px} .seg .b{white-space:normal;text-align:left} +/* A segmented control: one framed row of equal tabs, the active one filled like the HUD's speed buttons (Pie Control). */ +.segc{display:flex;gap:3px;padding:3px;margin:6px 0 10px;border:3px solid var(--ink);border-radius:14px;background:var(--soft);box-shadow:3px 3px 0 var(--ink)} +.segc button{flex:1 1 0;min-width:0;min-height:40px;padding:3px 2px;border:2.5px solid transparent;border-radius:10px;background:none;color:var(--ink);font-family:var(--display);font-weight:800;font-size:min(13.5px,3.6vw);line-height:1.1;cursor:pointer;overflow-wrap:anywhere;hyphens:auto} +.segc button:hover{background:var(--paper)} +.segc button.on{background:var(--sun);border-color:var(--ink)} +.segc button:focus-visible{outline:3px solid var(--me);outline-offset:1px} .toast .tx{flex:1;font-size:13px;line-height:1.35} .toast .tx b{font-family:var(--display);font-size:14.5px} @keyframes pop{from{transform:scale(.8) translateY(10px);opacity:0}} diff --git a/src/styles/36-ops.css b/src/styles/36-ops.css index 6a2cbf5..d4ebf86 100644 --- a/src/styles/36-ops.css +++ b/src/styles/36-ops.css @@ -14,3 +14,14 @@ .ops-mood{margin:6px 0 0;font-style:italic;font-size:13px;color:var(--ink2)} .ops-rep{border-left:3px solid #8E5CF7;background:#F7F2FF;border-radius:0 8px 8px 0;padding:6px 8px;margin:6px 0;font-size:13px;line-height:1.35;overflow-wrap:anywhere} .ops-rep .eyebrow{margin-bottom:2px} +/* Pie Control's Company tab ends with the Founder's feed: a quiet section, older posts folded away. */ +.pie-feed{border-top:2px solid var(--line);margin-top:12px;padding-top:4px} +.pie-feed h3{font-size:15px;margin:8px 0 4px} +.pie-feed summary{cursor:pointer;font-weight:800;font-size:13px;color:var(--ink2);padding:8px 0;min-height:24px} +/* Government money in the bank: the same boxes as the loans next to it. */ +.bank-gov>.meta{font-size:13px;color:var(--ink2);margin:2px 0 6px;line-height:1.35} +.bank-gov .ops-o{border:2.5px solid var(--ink);border-radius:14px;padding:10px 12px;margin-top:10px} +.bank-gov .ops-o .nm{font-weight:800;font-family:var(--display);font-size:16px} +.bank-gov .ops-o .meta{font-size:12.5px;color:var(--ink2);line-height:1.35} +.bank-gov .fact{display:inline-block;margin-top:2px} +.bank-gov .ops-o p.meta{margin:4px 0} diff --git a/tests/noc-panel-layout.test.js b/tests/noc-panel-layout.test.js new file mode 100644 index 0000000..5ce2157 --- /dev/null +++ b/tests/noc-panel-layout.test.js @@ -0,0 +1,101 @@ +// The NOC tab's top row (Pie Control next to the NOC dashboard), the traceroute inside Routing & DDoS, government money +// in the bank, and Pie Control's four tabs as one segmented control. Seeded; state is set directly. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); + +const sandbox = "ACT.modeSet({m:'sandbox'});ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.nextFail=1e9;S.nextEvent=1e9"; +const noc = "UI.started=true;UI.left='noc';UI.leftOpen=true;UI.sel=null;renderLeft()"; +const acts = (root) => [...root.querySelectorAll('[data-act]')].map((b) => b.dataset.act); + +test('the NOC tab: Pie Control in the top row once unlocked, no Connections or Traceroute buttons', () => { + const { dom, ev, errors } = load(); + const doc = dom.window.document; + ev("window.innerWidth=360;ACT.start({});if(UI.pendGame)ACT.pitchSkip();ACT.launchBB({city:'fra'});" + noc); + const top = () => acts(doc.querySelector('#leftBody .btns')); + assert.deepEqual(top(), ['dash', 'routingOpen'], 'no rocket company yet: no Pie Control'); + assert.ok(!acts(doc.getElementById('leftBody')).includes('connOpen'), 'Connections lives in the NOC dashboard'); + assert.ok(!acts(doc.getElementById('leftBody')).includes('trace'), 'the traceroute moved into Routing & DDoS'); + ev(sandbox + ';ACT.pieFound();' + noc); + assert.deepEqual(top(), ['dash', 'pieOpen', 'routingOpen'], 'Pie Control sits next to the NOC dashboard'); + assert.equal(doc.querySelectorAll('#leftBody [data-act=pieOpen]').length, 1, 'and the old card is gone'); + assert.equal(doc.querySelector('#leftBody .pie-card'), null); + doc.querySelector('#leftBody .btns [data-act=pieOpen]').click(); + assert.equal(ev("$('modal').className"), 'pie'); + ev('closeModal()'); + assert.deepEqual(errors, []); +}); + +test('Routing & DDoS opens the traceroute', () => { + const { dom, ev, errors } = load(); + const doc = dom.window.document; + ev("window.innerWidth=360;ACT.start({});if(UI.pendGame)ACT.pitchSkip();ACT.launchBB({city:'fra'});ACT.buyTransit({city:'fra',net:'cog',tier:1});ACT.routingOpen()"); + const b = doc.querySelector('#modalCard [data-act=trace]'); + assert.ok(b, 'a traceroute entry in the modal'); + assert.match(doc.querySelector('#modalCard .rt-trace').textContent, /Traceroute/); + b.click(); + assert.equal(doc.querySelector('#modalCard [data-routing]'), null, 'the traceroute modal took over'); + assert.ok(doc.getElementById('trFrom'), 'with its source picker'); + ev('closeModal()'); + assert.deepEqual(errors, []); +}); + +test('the bank shows Government money only with a rocket company, and pieGovOpen opens it there', () => { + const { dom, ev, errors } = load(); + const doc = dom.window.document; + ev(sandbox + ";window.innerWidth=360;ACT.bank()"); + assert.equal(doc.getElementById('bankGov'), null, 'nothing to show before the company'); + ev('ACT.bankClose();ACT.pieFound();ACT.pieOpen();ACT.pieGovOpen()'); + assert.equal(ev("$('modal').hidden"), true, 'Pie Control steps aside'); + assert.equal(ev("$('bankBox').hidden"), false); + const card = doc.getElementById('bankCard'); + assert.ok(doc.getElementById('bankGov')); + for (const re of [/Government money/, /Rural Digital Pie Fund/, /Pitcairn/, /Ex-Im Pie Bank/]) assert.match(card.textContent, re); + ev('ACT.bankClose()'); + assert.deepEqual(errors, []); +}); + +test('Pie Control: four tabs in one segmented control; old Gov and Founder tabs fall back', () => { + const { dom, ev, errors } = load(); + const doc = dom.window.document; + ev(sandbox + ";window.innerWidth=360;ACT.pieFound();UI.pieTab=null;ACT.pieOpen()"); + const seg = doc.querySelector('#modalCard .segc.pie-tabs'); + assert.ok(seg, 'one segmented control'); + assert.deepEqual([...seg.querySelectorAll('button')].map((b) => JSON.parse(b.dataset.args).t), ['traffic', 'co', 'fly', 'dish']); + assert.equal(seg.querySelectorAll('button.on').length, 1); + assert.equal(seg.querySelector('button.on').getAttribute('aria-pressed'), 'true'); + assert.deepEqual(JSON.parse(ev('JSON.stringify(PIE_TABS)')), ['traffic', 'co', 'fly', 'dish']); + // A tab name left over from before: Founder lands on Company, Gov on traffic (or the bank, when asked for by name). + ev("UI.pieTab='founder';ACT.pieOpen()"); + assert.equal(ev('UI.pieTab'), 'co'); + ev("UI.pieTab='book';ACT.pieOpen()"); + assert.equal(ev('UI.pieTab'), 'co'); + ev("UI.pieTab='gov';ACT.pieOpen()"); + assert.equal(ev('UI.pieTab'), 'traffic'); + ev("UI.pieTab='nonsense';ACT.pieOpen()"); + assert.equal(ev('UI.pieTab'), 'traffic'); + ev("ACT.pieTab({t:'gov'})"); + assert.equal(ev("$('bankBox').hidden"), false, 'the old Gov tab name opens the bank'); + ev("ACT.bankClose();ACT.pieTab({t:'book'})"); + assert.equal(ev('UI.pieTab'), 'co'); + ev('closeModal()'); // an open globe keeps its animation loop, and this process, alive + assert.deepEqual(errors, []); +}); + +test('the Company tab ends with the Founder\'s posts, the newest three and the rest folded', () => { + const { dom, ev, errors } = load(); + const doc = dom.window.document; + ev(sandbox + ";window.innerWidth=360;ACT.pieFound();for(let i=0;i<5;i++)pieFounder(N_('pie.fp_rename'));ACT.pieTab({t:'co'})"); + const feed = doc.querySelector('#modalCard .pie-feed'); + assert.ok(feed, 'the feed is on the Company tab'); + assert.equal(feed, [...doc.querySelectorAll('#modalCard > *')].pop(), 'at the bottom'); + assert.match(feed.textContent, /The Founder posts/); + assert.match(feed.textContent, /Promises/); + const n = ev('S.pie.founder.posts.length'); + assert.equal(feed.querySelectorAll(':scope > .ops-rep').length, 3); + assert.equal(feed.querySelectorAll('details .ops-rep').length, n - 3); + assert.match(feed.querySelector('summary').textContent, new RegExp(`${n - 3} older posts`)); + assert.match(doc.getElementById('modalCard').textContent, /Spent so far/, 'the books moved here too'); + ev('closeModal()'); + assert.deepEqual(errors, []); +}); diff --git a/tests/pie-gov.test.js b/tests/pie-gov.test.js index d56ec80..0a8134e 100644 --- a/tests/pie-gov.test.js +++ b/tests/pie-gov.test.js @@ -177,8 +177,9 @@ test('Ex-Im Pie Bank: a cheap loan sized to the constellation, with space covena assert.match(bank, /Launch \d+ pies by .* \(20 so far\)/); assert.match(bank, /Keep a pie dish in/); ev("$('bankBox').hidden=true;ACT.pieGovOpen()"); - assert.match(dom.window.document.querySelector('#modal').textContent, /Ex-Im Pie Bank/); - ev('closeModal()'); + assert.equal(ev("$('bankBox').hidden"), false, 'the toast button opens the bank'); + assert.match(dom.window.document.querySelector('#bankGov').parentNode.textContent, /Ex-Im Pie Bank/); + ev('ACT.bankClose()'); assert.deepEqual(errors, []); }); @@ -209,20 +210,21 @@ test('a broken space covenant: the bank penalty, tighter terms and a spat in the assert.deepEqual(errors, []); }); -test('the Gov tab fits a phone and lists the auction, the awards, Pitcairn and the bank', () => { +test('the bank\'s Government money section fits a phone and lists the auction, the awards, Pitcairn and the bank', () => { const { dom, ev, errors } = load(); pitcairn(ev); ev("window.innerWidth=360;pieRdfOpen('pcn');S.pie.gov.aw.push({id:'w1',city:'akl',mo:5e6,start:S.day,due:S.day+90,end:S.day+1800,s:0,n:0,paid:0});UI.pieTab=null;ACT.pieGovOpen()"); - const m = dom.window.document.querySelector('#modal'); - assert.equal(ev("$('modal').hidden"), false); + const m = dom.window.document.querySelector('#bankCard'); + assert.equal(ev("$('bankBox').hidden"), false); + assert.ok(m.querySelector('#bankGov'), 'opened at its section'); assert.equal(m.querySelectorAll('[data-act=pieBid]').length, 3, 'three asks'); assert.match(m.textContent, /Rural Digital Pie Fund/); assert.match(m.textContent, /Auckland/); assert.match(m.textContent, /Pitcairn/); assert.match(m.textContent, /satellite grant/); - assert.doesNotMatch(m.textContent, /pie_gov\.|banks\.|undefined|NaN/); + assert.doesNotMatch(m.querySelector('.bank-gov').textContent, /pie_gov\.|banks\.|undefined|NaN/); ev("ACT.pieBid({id:S.pie.gov.auc[0].id,f:0.7})"); - assert.ok(dom.window.document.querySelector('#modal [data-act=pieBid].pink'), 'your bid is marked'); + assert.ok(dom.window.document.querySelector('#bankCard [data-act=pieBid].pink'), 'your bid is marked, in the open bank'); ev('closeModal()'); assert.deepEqual(errors, []); }); diff --git a/tests/pie-in-the-sky.test.js b/tests/pie-in-the-sky.test.js index 9d6096b..813dd3a 100644 --- a/tests/pie-in-the-sky.test.js +++ b/tests/pie-in-the-sky.test.js @@ -30,7 +30,7 @@ test('unlocks once, on the Tier 1 win, in a save of this version', () => { assert.equal(ev('S.pie.born'), born, 'only once'); // reachable from the NOC tab ev("UI.started=true;UI.left='noc';UI.leftOpen=true;renderLeft()"); - assert.ok(ev("!!document.querySelector('[data-act=pieOpen]')"), 'the NOC tab has the Pie Control card'); + assert.ok(ev("!!document.querySelector('[data-act=pieOpen]')"), 'the NOC tab has the Pie Control button'); assert.deepEqual(errors, []); }); @@ -264,7 +264,7 @@ test('saves without a rocket company pay nothing', () => { assert.equal(ev("pieDay(S.day)"), undefined); assert.equal(ev('pieDishes().length+pieHubs().length'), 0); assert.deepEqual(JSON.parse(ev('JSON.stringify(pieGlobeData())')), { crusts: [], dishes: [], pads: [], launches: [] }); - assert.equal(ev("pieCard()"), '', 'no card while locked'); + assert.equal(ev("pieNocBtn()"), '', 'no Pie Control button while locked'); assert.deepEqual(errors, []); }); @@ -273,7 +273,7 @@ test('Pie Control renders every tab on a phone', () => { ev('window.innerWidth=360'); won(ev); company(ev); - for (const t of ['co', 'fly', 'dish', 'gov', 'book']) { + for (const t of ['traffic', 'co', 'fly', 'dish']) { ev(`ACT.pieTab({t:'${t}'})`); assert.equal(ev("$('modal').hidden"), false); assert.ok(dom.window.document.querySelectorAll('#modalCard [data-act]').length > 2, t); diff --git a/tests/pie-traffic.test.js b/tests/pie-traffic.test.js index d63c822..5faa9cd 100644 --- a/tests/pie-traffic.test.js +++ b/tests/pie-traffic.test.js @@ -72,7 +72,7 @@ test('the Traffic tab is first, fits 360 px and lists a terminal and a sky circu term(ev, 'pz', 'pcn'); ev('UI.pieTab=null;ACT.pieOpen()'); const d = doc(dom); - assert.equal(d.querySelector('#modalCard .seg [aria-pressed="true"]').textContent, ev("tr('pie_traffic.tab')"), 'Traffic is the default tab'); + assert.equal(d.querySelector('#modalCard .pie-tabs [aria-pressed="true"]').textContent, ev("tr('pie_traffic.tab')"), 'Traffic is the default tab'); const txt = d.querySelector('#modalCard').textContent; assert.match(txt, /In orbit now: .* of .* sellable · .*\/mo · 2 customers/); assert.match(txt, /Who's riding/);