From b3153c020f2e381174c277a506ac3f811e8449f2 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Thu, 5 Nov 2026 15:36:15 +0100 Subject: [PATCH 01/10] Pie in the Sky: no government line in the books without a rocket company, so other games route exactly as on main --- src/game/80-simulation/30-compute.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/80-simulation/30-compute.js b/src/game/80-simulation/30-compute.js index cc9ce0c..6b28350 100644 --- a/src/game/80-simulation/30-compute.js +++ b/src/game/80-simulation/30-compute.js @@ -376,8 +376,8 @@ function computeMoney(R2,PX=null){ for(const c in S.myIx)V.ix+=S.myIx[c].members.length*MYIX_FEE; if(PX)pieMoney(PX,R2,V); // The UK grant for Pitcairn, its satellite tier once orbit is known; the Rural Digital Pie Fund (99-pie-subsidies.js). - {const on=grantOn(R2),sky=!on&&!!PX&&grantSky(R2);V.grant=on?GRANT_MO:sky?GRANT_SKY_MO:0;V.gov=PX?pieGovMo():0;if(PX)R2.pie.gov={rdf:V.gov,sky:sky?GRANT_SKY_MO:0};} + {const on=grantOn(R2),sky=!on&&!!PX&&grantSky(R2);V.grant=on?GRANT_MO:sky?GRANT_SKY_MO:0;if(PX)V.gov=pieGovMo();if(PX)R2.pie.gov={rdf:V.gov||0,sky:sky?GRANT_SKY_MO:0};} C.revshare=(S.loans||[]).reduce((a,l)=>a+(BANKS[l.bank].equity||l.bal>0?l.share||0:0),0)*(V.eyeballs+V.business+V.ix+(V.orbit||0)); R2.costMo=Object.values(C).reduce((a,b)=>a+b,0); - R2.revMo=V.eyeballs+V.business+V.ix+V.grant+V.gov+(V.orbit||0); + R2.revMo=V.eyeballs+V.business+V.ix+V.grant+(V.gov||0)+(V.orbit||0); } From 267f9efc72505bdd91ff2cd6bf8e5ec23a60ae58 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Thu, 5 Nov 2026 15:50:05 +0100 Subject: [PATCH 02/10] Pie in the Sky for agents: every Pie action classified and typed, its state and results documented --- src/agent/10-domains.js | 9 +++++++++ src/agent/20-commands.js | 24 ++++++++++++++++++++++++ src/agent/30-docs.js | 3 +++ src/agent/40-read.js | 2 +- tests/mcp-commands.test.js | 1 + 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/agent/10-domains.js b/src/agent/10-domains.js index a0005c9..f1b8a8f 100644 --- a/src/agent/10-domains.js +++ b/src/agent/10-domains.js @@ -75,6 +75,15 @@ const API_DOMAINS={ // Entity ids (uid()) cannot be validated against a table: shape only. A wrong id is the game's // to answer, honestly, with no_effect — never a refusal invented on this side of the wall. entityId:{kind:'string'}, + // Pie in the Sky (the rocket company, unlocked by a Tier 1 win in a new game or from day 0 in a sandbox). + rocketId:{table:'ROCKETS',kind:'key'}, + crustId:{table:'CRUSTS',kind:'key'}, + pieRdId:{table:'PIE_RD',kind:'key'}, + pieTab:{kind:'enum',values:()=>PIE_TABS.slice()}, + pieBidShare:{kind:'enum',values:()=>PIE_RDF_BIDS.slice()}, + pieSpatId:{table:'PIE_SPAT_DEF',kind:'key'}, + pieSpatChoice:{kind:'enum',values:[0,1]}, + countryCode:{kind:'enum',values:()=>[...new Set(CITIES.map(c=>c.cc))].sort()}, scnId:{table:'SCN',kind:'id'}, // A traceroute target in the modal's own terms. }; diff --git a/src/agent/20-commands.js b/src/agent/20-commands.js index 8742811..0a8cff3 100644 --- a/src/agent/20-commands.js +++ b/src/agent/20-commands.js @@ -9,6 +9,20 @@ (may end in a question); reads 'modal' (the window's text is the report); watch (extra fingerprint paths, #name filled from args); quote (the dry run, priced with the game's own helpers); doc. */ const API_CMD={ +/* ---------- Pie in the Sky: the rocket company (Tier 1 in a new game, or a sandbox) ---------- */ + pieFound:{args:[],watch:['pie'],quote:a=>({setup:piePrice(PIE_CO),monthly:PIE_CO_MO}),doc:'Found the rocket company. Needs Tier 1 (or a sandbox).'}, + pieFactory:{args:[],watch:['pie'],quote:a=>({setup:piePrice(PIE_FAC)}),doc:'Build the pie factory: it bakes the satellites ("pies") that rockets carry.'}, + piePad:{args:[['city','cityId']],watch:['pie'],doc:'Build a launch pad in a city. Pads near the equator lift more.'}, + pieRd:{args:[['k','pieRdId']],watch:['pie'],quote:a=>({setup:piePrice(PIE_RD[a.k].cost)}),doc:'Fund rocket R&D: reuse (reusable boosters, cheaper launches) or heavy (a bigger rocket, after test flights).'}, + pieLaunch:{args:[['rk','rocketId'],['cr','crustId']],watch:['pie'],doc:'Queue a launch of a rocket into a crust (an orbital shell). Insurance and lasers follow the Launch tab toggles (pieIns, pieLas).'}, + pieDish:{args:[['city','cityId']],watch:['pie'],doc:'Build a pie dish (ground station) at one of your POPs. Needs landing rights in its country.'}, + pieAnt:{args:[['id','entityId']],watch:['pie'],quote:a=>({setup:piePrice(PIE_ANT)}),doc:'Add an antenna to a pie dish (20 Gbps each, 16 at most).'}, + pieLic:{args:[['cc','countryCode']],watch:['pie'],doc:'Buy or renew landing rights in a country, for its dishes and orbit customers.'}, + pieSafe:{args:[],watch:['pie'],doc:'Toggle safe mode: pies ride out solar storms, carrying nothing meanwhile.'}, + pieName:{args:[],watch:['pie'],doc:'Rename the rocket company to the next name on the list.'}, + pieBid:{args:[['id','entityId'],['f','pieBidShare']],watch:['pie'],doc:'Bid in a Rural Digital Pie Fund auction, asking this share of the reserve. The lower ask wins.'}, + pieExim:{args:[],watch:['pie','loans'],doc:'Take the Export-Import Pie Bank loan, with its space covenants.'}, + pieSpatPick:{args:[['id','pieSpatId'],['c','pieSpatChoice']],watch:['pie'],doc:'Answer a geopolitical spat over orbit: choice 0 or 1, as its sheet offers.'}, downIx:{args:[['city','ixId']],watch:['ixp'],doc:'Step an exchange port down one size.'}, downT:{args:[['id','entityId']],watch:['transit.#id'],doc:'Step a transit port down one size (a LAG steps down together).'}, downP:{args:[['id','entityId']],watch:['pni.#id'],doc:'Step a PNI down one size. Not while an augment is on order.'}, @@ -429,6 +443,15 @@ 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.'}, + 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.'}, + pieLas:{args:[],doc:'Toggle lasers (inter-satellite links) for the next launches.'}, + pieGlobeNight:{args:[],doc:'Flip the Pie Control globe between day and night.'}, + pieSpatOpen:{args:[['id','pieSpatId']],doc:'Open the sheet of a geopolitical spat over orbit.'}, traceMode:{args:[['m','string']],doc:'Redo the open traceroute in a routing mode: normal, fast or scenic.'}, chartToggle:{args:[['c','string'],['k','string']],doc:'Hide or show one series of a dashboard chart (a legend click); hiding every series shows them all again.'}, help:{args:[],doc:'Open the how-to-play modal.'}, @@ -507,6 +530,7 @@ const API_VIEW={ }; const API_BOUND={ + pieRename:{command:'pieName',note:'the typed company name'}, leaseSwap:{command:'orderDf',note:'presets the dark-fiber modal on a leased pair'}, teOpt:{command:'teDeploy',arg:'script',note:'the optimiser drafts a script'}, teSlop:{command:'teDeploy',arg:'script',note:'the AI drafts a script'}, diff --git a/src/agent/30-docs.js b/src/agent/30-docs.js index ccc5fe0..8da7fa2 100644 --- a/src/agent/30-docs.js +++ b/src/agent/30-docs.js @@ -52,6 +52,8 @@ const API_STATE_DOC={ scrubs:{type:'array',doc:'Scrubbing centres: city and tier.'}, scrubMode:{type:'string',doc:'always | ondemand.'}, cnLic:{type:'map',doc:'Mainland China licence: none | pending (with ready day) | ok.'}, + pieV:{type:'number',doc:'Pie in the Sky version stamp: 1 in games started since it shipped (only those unlock it, on a Tier 1 win).'}, + pie:{type:'map',doc:'The rocket company (Pie in the Sky), or null: company, factory, stock, pads, crusts (cohorts of pies by launch day), dishes, landing rights (lic), launch queue (q), R&D, spats, founder posts, books, and government money (gov: auctions, awards, Ex-Im).'}, ppol:{type:'string',doc:'Your published peering policy: open | selective | closed.'}, pdesk:{type:'map',doc:'This week\'s peering desk summary: sessions accepted and declined at which exchanges.'}, pdeskRep:{type:'map',doc:'Last week\'s peering desk summary, as the NOC log reported it.'}, @@ -93,6 +95,7 @@ const API_STATE_DOC={ }; const API_RESULTS_DOC={ + pie:{type:'map',doc:'Orbit this compute (only with a rocket company): revenue, service per orbit customer, landing dishes, flows through the sky, backhaul for cut-off POPs (bh), crust and dish load, government money (gov).'}, nt:{type:'map',doc:'Traffic per network through transit, by net id.'}, tNet:{type:'map',doc:'Traffic per network you hand to each upstream, by "net@upstream".'}, reachNT:{type:'number',doc:'Networks reachable without transit.'}, diff --git a/src/agent/40-read.js b/src/agent/40-read.js index 11aaf4d..e767e2d 100644 --- a/src/agent/40-read.js +++ b/src/agent/40-read.js @@ -26,7 +26,7 @@ function apiJson(v){ carries the keys confGo/confSponsor need, which exist in no field of S; TE_RECIPES renders each recipe's script, because the source is a function and some read the live network. The recipes' relevance score is not exposed: judging which one fits is the agent's job. */ -const API_TABLES={SALES,CITIES,NETS,CABLES,XIX,PORT,LT,NNI,VXC,RG,OPT,DF_SYS,FAB,SCRUB_TIERS,BIZ_T,LEVELS,GOALS,BROKER_GOALS,SCN,BANKS,REQS,NSH,MET,PREF,RT,PPOL,CONFS,LAG_MAX,RMAX,REGEN_MAX,START_CASH,CONF_COST,CONF_SP,CAP_COST,CAP_LV,CONF_DAYS,SUB_UPGRADES,SEA_DESIGNS,TE_COST,TE_MO,MYIX_COST,CN_LIC,SITE2_COST,MYIX_FAB,INTERNS,OPSK,CHARTERS,SEAT_N,CORE_LV,CORE_COST,CORE_REQ,CORE_LAB,INTERN_MO,PZ_TIERS,AR_TIERS,PZ_RG}; +const API_TABLES={ROCKETS,CRUSTS,PIE_RD,PIE_SPAT_DEF,SALES,CITIES,NETS,CABLES,XIX,PORT,LT,NNI,VXC,RG,OPT,DF_SYS,FAB,SCRUB_TIERS,BIZ_T,LEVELS,GOALS,BROKER_GOALS,SCN,BANKS,REQS,NSH,MET,PREF,RT,PPOL,CONFS,LAG_MAX,RMAX,REGEN_MAX,START_CASH,CONF_COST,CONF_SP,CAP_COST,CAP_LV,CONF_DAYS,SUB_UPGRADES,SEA_DESIGNS,TE_COST,TE_MO,MYIX_COST,CN_LIC,SITE2_COST,MYIX_FAB,INTERNS,OPSK,CHARTERS,SEAT_N,CORE_LV,CORE_COST,CORE_REQ,CORE_LAB,INTERN_MO,PZ_TIERS,AR_TIERS,PZ_RG}; const API_MADE={ BADGES:()=>!S?[]:BADGES.map(b=>{const on=S.ach&&S.ach[b.id]!==undefined,ever=!!hof()[b.id]; return b.secret&&!on&&!ever?{id:b.id,i:'❔',t:'???',d:tr('badges.a_secret_badge'),r:b.r,secret:true}:{...b,ever};}), diff --git a/tests/mcp-commands.test.js b/tests/mcp-commands.test.js index f88e4ae..9101521 100644 --- a/tests/mcp-commands.test.js +++ b/tests/mcp-commands.test.js @@ -227,6 +227,7 @@ test('a dry run prices every command that has a price, and changes nothing', () fixInc: { id: 'none' }, confGo: { key: T('catalog', { name: 'conferences' })[0].key }, confSponsor: { key: T('catalog', { name: 'conferences' })[0].key }, opsHire: { id: ev('Object.keys(INTERNS)[0]') }, opsNewPop: { city: 'nyc' }, pniAll: { net: 'cog', tier: 1 }, seatBuy: { n: 2 }, layShip: { id: df }, seaRush: { id: df }, utilityKit: { city: 'fra' }, utilityCaches: { city: 'fra' }, teDeploy: { script: 'spill at 85%' }, upLinkX: {}, + pieRd: { k: 'reuse' }, pieAnt: { id: 'none' }, }; const missing = quoted.filter((n) => !sample[n] && T('schema', { section: 'commands' })[n].args.some((a) => a.required)); assert.deepEqual(missing, [], 'every priced command with arguments has a sample here'); From 7001174d7928357847327a2de36fb052b451716d Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Thu, 5 Nov 2026 16:27:13 +0100 Subject: [PATCH 03/10] Pie in the Sky, the early game: a pace forecast on the Launch tab, patchy-sky customers before 40%, a hint to wait on dishes - Launch tab: each crust being filled says when it is full at today's pace (piePace: the pads that reach it, one launch per leadDays(gap) each with the rocket last queued or the fastest available, capped by the factory with the shelf and the queue as a buffer). Past two years and pad-bound, one nudge for another pad at the coastal POP nearest the equator, with a build button (piePadTip). - Patchy-sky customers (60-features/99-pie-patchy.js): a revenue line in pieMoney, no flows, so routing is unchanged and games without a rocket company never see it. Up to $30M/mo for Shortcrust (scaled by crust size), ramping from 10% to 40% coverage with one working dish under the crust, then times (1 - pieCarry) so it hands over to regular orbit customers by 60%. Shown on the Traffic tab; booked in S.pie.book like all orbit income. - Dishes tab: under 30% coverage, a gentle note that dishes earn nothing yet and cost money every month. - Payback on the O7 run is unchanged at one decimal (seed 7: 7.2 years, seed 11: 8.2). --- CHANGELOG.md | 4 + site/i18n/de.js | 7 + site/i18n/es.js | 7 + site/i18n/fr.js | 7 + site/i18n/it.js | 7 + site/i18n/pt.js | 7 + src/agent/30-docs.js | 2 +- src/game/60-features/99-pie-in-the-sky.js | 13 ++ src/game/60-features/99-pie-patchy.js | 21 +++ src/game/80-simulation/35-pie-paths.js | 6 +- src/game/93-ui/85-pie-control.js | 13 +- src/game/93-ui/86-pie-traffic.js | 3 + src/i18n/en.js | 7 + tests/pie-pace.test.js | 169 ++++++++++++++++++++++ tests/pie-routing.test.js | 4 +- 15 files changed, 272 insertions(+), 5 deletions(-) create mode 100644 src/game/60-features/99-pie-patchy.js create mode 100644 tests/pie-pace.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index bb12e9c..6642fd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,10 @@ All notable changes to this project are documented here. The project follows - 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. +- 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. + - 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/site/i18n/de.js b/site/i18n/de.js index 6ff8660..814c67c 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -3413,6 +3413,7 @@ "pie.cr_upper":"Oberkruste (1.100 km)", "pie.crust_line":"{alt} km · {n} von {full} Pies · {q} unterwegs · {p} abgedeckt", "pie.dish_note":"Eine Pie-Schüssel spricht mit den Pies über ihr. Sie braucht einen POP in ihrer Stadt und Landerechte in ihrem Land.", +"pie.dish_wait":"Schüsseln verdienen nichts, bis eine Kruste zu {min} abgedeckt ist, und deine vollste steht bei {p}. Jede kostet {mo} im Monat, Warten lohnt sich also. Nur Bojen, Schiffe und Sensoren zahlen früher, ab {lo}, und ihnen reicht eine Schüssel.", "pie.earned":"Aus dem Orbit verdient", "pie.earned_mo":"Der Orbit bringt {amt}/Monat · {n} Schüsseln abseits vom Backbone tragen keinen Transit", "pie.factory":"Pie-Fabrik", @@ -3454,6 +3455,10 @@ "pie.no_pads":"Noch keine Startrampen. Eine Rampe braucht einen POP in einer Stadt an der Küste.", "pie.no_rights":"keine Landerechte", "pie.open_pie_control":"Pie Control", +"pie.pace_months":{"one":"In diesem Tempo ({mo} Pies im Monat) ist diese Kruste in etwa {n} Monat voll.","other":"In diesem Tempo ({mo} Pies im Monat) ist diese Kruste in etwa {n} Monaten voll."}, +"pie.pace_pad":"Eine weitere Startrampe füllt sie schneller. Dein Küsten-POP am nächsten am Äquator ist {city}, dort kostet ein Start {p} weniger.", +"pie.pace_pad_none":"Eine weitere Startrampe füllt sie schneller: Eröffne einen POP an einer Küste, am besten nahe am Äquator, wo Starts weniger kosten.", +"pie.pace_years":{"one":"In diesem Tempo ({mo} Pies im Monat) ist diese Kruste in etwa {n} Jahr voll.","other":"In diesem Tempo ({mo} Pies im Monat) ist diese Kruste in etwa {n} Jahren voll."}, "pie.pad_busy":"belegt bis {d}", "pie.pad_free":"bereit", "pie.pads":"Startrampen", @@ -3694,6 +3699,8 @@ "pie_traffic.no_landing":"{city} · keine Schüssel kann es landen", "pie_traffic.orbit_no_fiber":"Orbit {o} ms, kein Glasfaserweg", "pie_traffic.orbit_vs_fiber":"Orbit {o} ms statt Glasfaser {f} ms", +"pie_traffic.patchy":"Kunden mit Lückenhimmel", +"pie_traffic.patchy_hint":"Bojen, Schiffspost und Sensoren, die auf den nächsten Pie warten können. Sie zahlen ab {lo} Abdeckung und gehen zwischen {min} und {max} an die normalen Orbit-Kunden über.", "pie_traffic.riding":"Wer mitfliegt", "pie_traffic.route_ab":"{a} → {b}", "pie_traffic.tab":"Traffic", diff --git a/site/i18n/es.js b/site/i18n/es.js index 8651ef4..38db791 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -3411,6 +3411,7 @@ "pie.cr_upper":"Corteza de arriba (1.100 km)", "pie.crust_line":"{alt} km · {n} de {full} tartas · {q} en camino · {p} de cobertura", "pie.dish_note":"Una antena-tarta habla con las tartas que pasan por encima. Necesita un POP en su ciudad y derechos de aterrizaje en su país.", +"pie.dish_wait":"Las antenas no ganan nada hasta que una corteza tenga {min} de cobertura, y la tuya más llena está en {p}. Cada una cuesta {mo} al mes, así que compensa esperar. Solo boyas, barcos y sensores pagan antes, desde {lo}, y les basta una antena.", "pie.earned":"Ganado desde la órbita", "pie.earned_mo":"La órbita gana {amt}/mes · {n} antenas fuera del backbone no llevan tránsito", "pie.factory":"Fábrica de tartas", @@ -3452,6 +3453,10 @@ "pie.no_pads":"Aún no hay plataformas de lanzamiento. Una plataforma necesita un POP en una ciudad costera.", "pie.no_rights":"sin derechos de aterrizaje", "pie.open_pie_control":"Pie Control", +"pie.pace_months":{"one":"A este ritmo ({mo} tartas al mes), esta corteza estará llena en {n} mes, más o menos.","other":"A este ritmo ({mo} tartas al mes), esta corteza estará llena en unos {n} meses."}, +"pie.pace_pad":"Otra plataforma la llenaría más rápido. Tu POP costero más cerca del ecuador es {city}, donde un lanzamiento cuesta {p} menos.", +"pie.pace_pad_none":"Otra plataforma la llenaría más rápido: abre un POP en la costa, mejor cerca del ecuador, donde los lanzamientos cuestan menos.", +"pie.pace_years":{"one":"A este ritmo ({mo} tartas al mes), esta corteza estará llena en {n} año, más o menos.","other":"A este ritmo ({mo} tartas al mes), esta corteza estará llena en unos {n} años."}, "pie.pad_busy":"ocupada hasta el {d}", "pie.pad_free":"lista", "pie.pads":"Plataformas de lanzamiento", @@ -3692,6 +3697,8 @@ "pie_traffic.no_landing":"{city} · ninguna antena puede aterrizarlo", "pie_traffic.orbit_no_fiber":"órbita {o} ms, sin camino por fibra", "pie_traffic.orbit_vs_fiber":"órbita {o} ms frente a fibra {f} ms", +"pie_traffic.patchy":"Clientes de cielo a ratos", +"pie_traffic.patchy_hint":"Boyas, correo de barcos y sensores que pueden esperar a la próxima tarta. Pagan desde {lo} de cobertura y pasan a los clientes orbitales normales entre {min} y {max}.", "pie_traffic.riding":"Quién viaja", "pie_traffic.route_ab":"{a} → {b}", "pie_traffic.tab":"Tráfico", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index ae27cdd..12a85e1 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -3411,6 +3411,7 @@ "pie.cr_upper":"Croûte du dessus (1 100 km)", "pie.crust_line":"{alt} km · {n} sur {full} tartes · {q} en route · {p} couvert", "pie.dish_note":"Une antenne-tarte parle aux tartes au-dessus d'elle. Il lui faut un POP dans sa ville et des droits d'atterrissage dans son pays.", +"pie.dish_wait":"Les antennes ne rapportent rien tant qu'une croûte n'est pas couverte à {min}, et ta plus remplie est à {p}. Chacune coûte {mo} par mois, alors mieux vaut attendre. Seuls les bouées, les navires et les capteurs paient plus tôt, dès {lo}, et une antenne leur suffit.", "pie.earned":"Gagné depuis l'orbite", "pie.earned_mo":"L'orbite rapporte {amt}/mois · {n} paraboles hors du backbone ne portent aucun transit", "pie.factory":"Usine à tartes", @@ -3452,6 +3453,10 @@ "pie.no_pads":"Pas encore de pas de tir. Il faut un POP dans une ville côtière.", "pie.no_rights":"pas de droits d'atterrissage", "pie.open_pie_control":"Pie Control", +"pie.pace_months":{"one":"À ce rythme ({mo} tartes par mois), cette croûte sera pleine dans environ {n} mois.","other":"À ce rythme ({mo} tartes par mois), cette croûte sera pleine dans environ {n} mois."}, +"pie.pace_pad":"Un pas de tir de plus la remplirait plus vite. Ton POP côtier le plus proche de l'équateur est {city}, où un lancement coûte {p} de moins.", +"pie.pace_pad_none":"Un pas de tir de plus la remplirait plus vite : ouvre un POP sur une côte, idéalement près de l'équateur, où les lancements coûtent moins.", +"pie.pace_years":{"one":"À ce rythme ({mo} tartes par mois), cette croûte sera pleine dans environ {n} an.","other":"À ce rythme ({mo} tartes par mois), cette croûte sera pleine dans environ {n} ans."}, "pie.pad_busy":"occupé jusqu'au {d}", "pie.pad_free":"prêt", "pie.pads":"Pas de tir", @@ -3692,6 +3697,8 @@ "pie_traffic.no_landing":"{city} · aucune antenne ne peut l’atterrir", "pie_traffic.orbit_no_fiber":"orbite {o} ms, pas de chemin en fibre", "pie_traffic.orbit_vs_fiber":"orbite {o} ms contre fibre {f} ms", +"pie_traffic.patchy":"Clients du ciel à trous", +"pie_traffic.patchy_hint":"Bouées, courrier de bord et capteurs qui peuvent attendre la prochaine tarte. Ils paient dès {lo} de couverture et passent le relais aux clients orbitaux habituels entre {min} et {max}.", "pie_traffic.riding":"Qui est à bord", "pie_traffic.route_ab":"{a} → {b}", "pie_traffic.tab":"Trafic", diff --git a/site/i18n/it.js b/site/i18n/it.js index 9ccf111..9306767 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -3411,6 +3411,7 @@ "pie.cr_upper":"Crosta di sopra (1.100 km)", "pie.crust_line":"{alt} km · {n} di {full} torte · {q} in arrivo · {p} di copertura", "pie.dish_note":"Una parabola-torta parla con le torte sopra di lei. Le serve un POP nella sua città e i diritti di atterraggio nel suo paese.", +"pie.dish_wait":"Le parabole non guadagnano nulla finché una crosta non ha il {min} di copertura, e la tua più piena è al {p}. Ognuna costa {mo} al mese, quindi conviene aspettare. Solo boe, navi e sensori pagano prima, dal {lo}, e a loro basta una parabola.", "pie.earned":"Guadagnato dall'orbita", "pie.earned_mo":"L'orbita rende {amt}/mese · {n} parabole fuori dal backbone non portano transito", "pie.factory":"Fabbrica di torte", @@ -3452,6 +3453,10 @@ "pie.no_pads":"Ancora nessuna rampa di lancio. Una rampa richiede un POP in una città sulla costa.", "pie.no_rights":"senza diritti di atterraggio", "pie.open_pie_control":"Pie Control", +"pie.pace_months":{"one":"A questo ritmo ({mo} torte al mese), questa crosta è piena tra circa {n} mese.","other":"A questo ritmo ({mo} torte al mese), questa crosta è piena tra circa {n} mesi."}, +"pie.pace_pad":"Un'altra rampa la riempirebbe più in fretta. Il tuo POP costiero più vicino all'equatore è {city}, dove un lancio costa il {p} in meno.", +"pie.pace_pad_none":"Un'altra rampa la riempirebbe più in fretta: apri un POP sulla costa, meglio se vicino all'equatore, dove i lanci costano meno.", +"pie.pace_years":{"one":"A questo ritmo ({mo} torte al mese), questa crosta è piena tra circa {n} anno.","other":"A questo ritmo ({mo} torte al mese), questa crosta è piena tra circa {n} anni."}, "pie.pad_busy":"occupata fino al {d}", "pie.pad_free":"pronta", "pie.pads":"Rampe di lancio", @@ -3692,6 +3697,8 @@ "pie_traffic.no_landing":"{city} · nessuna parabola può farlo atterrare", "pie_traffic.orbit_no_fiber":"orbita {o} ms, nessun percorso in fibra", "pie_traffic.orbit_vs_fiber":"orbita {o} ms contro fibra {f} ms", +"pie_traffic.patchy":"Clienti del cielo a chiazze", +"pie_traffic.patchy_hint":"Boe, posta di bordo e sensori che possono aspettare la prossima torta. Pagano dal {lo} di copertura e passano il testimone ai normali clienti in orbita tra il {min} e il {max}.", "pie_traffic.riding":"Chi viaggia", "pie_traffic.route_ab":"{a} → {b}", "pie_traffic.tab":"Traffico", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index f346d51..2d90bdf 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -3411,6 +3411,7 @@ "pie.cr_upper":"Crosta de cima (1.100 km)", "pie.crust_line":"{alt} km · {n} de {full} tortas · {q} a caminho · {p} de cobertura", "pie.dish_note":"Uma antena-torta conversa com as tortas lá em cima. Ela precisa de um POP na cidade e de direitos de pouso no país.", +"pie.dish_wait":"As antenas não ganham nada até uma crosta ter {min} de cobertura, e a sua mais cheia está em {p}. Cada uma custa {mo} por mês, então vale a pena esperar. Só boias, navios e sensores pagam antes, a partir de {lo}, e uma antena basta para eles.", "pie.earned":"Ganho da órbita", "pie.earned_mo":"A órbita rende {amt}/mês · {n} antenas fora do backbone não levam trânsito", "pie.factory":"Fábrica de tortas", @@ -3452,6 +3453,10 @@ "pie.no_pads":"Ainda sem plataformas de lançamento. Uma plataforma precisa de um POP numa cidade no litoral.", "pie.no_rights":"sem direitos de pouso", "pie.open_pie_control":"Pie Control", +"pie.pace_months":{"one":"Neste ritmo ({mo} tortas por mês), esta crosta fica cheia em cerca de {n} mês.","other":"Neste ritmo ({mo} tortas por mês), esta crosta fica cheia em cerca de {n} meses."}, +"pie.pace_pad":"Outra plataforma a encheria mais rápido. Seu POP litorâneo mais perto do equador é {city}, onde um lançamento custa {p} a menos.", +"pie.pace_pad_none":"Outra plataforma a encheria mais rápido: abra um POP no litoral, de preferência perto do equador, onde os lançamentos custam menos.", +"pie.pace_years":{"one":"Neste ritmo ({mo} tortas por mês), esta crosta fica cheia em cerca de {n} ano.","other":"Neste ritmo ({mo} tortas por mês), esta crosta fica cheia em cerca de {n} anos."}, "pie.pad_busy":"ocupada até {d}", "pie.pad_free":"pronta", "pie.pads":"Plataformas de lançamento", @@ -3692,6 +3697,8 @@ "pie_traffic.no_landing":"{city} · nenhuma antena consegue pousá-lo", "pie_traffic.orbit_no_fiber":"órbita {o} ms, sem caminho por fibra", "pie_traffic.orbit_vs_fiber":"órbita {o} ms contra fibra {f} ms", +"pie_traffic.patchy":"Clientes de céu com falhas", +"pie_traffic.patchy_hint":"Boias, correio de navios e sensores que podem esperar a próxima torta. Pagam a partir de {lo} de cobertura e passam para os clientes orbitais normais entre {min} e {max}.", "pie_traffic.riding":"Quem está a bordo", "pie_traffic.route_ab":"{a} → {b}", "pie_traffic.tab":"Tráfego", diff --git a/src/agent/30-docs.js b/src/agent/30-docs.js index 8da7fa2..8874bf1 100644 --- a/src/agent/30-docs.js +++ b/src/agent/30-docs.js @@ -95,7 +95,7 @@ const API_STATE_DOC={ }; const API_RESULTS_DOC={ - pie:{type:'map',doc:'Orbit this compute (only with a rocket company): revenue, service per orbit customer, landing dishes, flows through the sky, backhaul for cut-off POPs (bh), crust and dish load, government money (gov).'}, + pie:{type:'map',doc:'Orbit this compute (only with a rocket company): revenue (rev, including patchy: {mo, cr} from patchy-sky customers who pay from 10% coverage, before a crust carries anything, and fade out between 40% and 60%), service per orbit customer, landing dishes, flows through the sky, backhaul for cut-off POPs (bh), crust and dish load, government money (gov).'}, nt:{type:'map',doc:'Traffic per network through transit, by net id.'}, tNet:{type:'map',doc:'Traffic per network you hand to each upstream, by "net@upstream".'}, reachNT:{type:'number',doc:'Networks reachable without transit.'}, diff --git a/src/game/60-features/99-pie-in-the-sky.js b/src/game/60-features/99-pie-in-the-sky.js index b89b2ef..0d4115c 100644 --- a/src/game/60-features/99-pie-in-the-sky.js +++ b/src/game/60-features/99-pie-in-the-sky.js @@ -73,6 +73,19 @@ function pieQuote(rk,cr,o={}){const P=S.pie;if(!P||!own(ROCKETS,rk)||!own(CRUSTS // The cheapest a crust can be filled from nothing (one-off costs only): rule O7. function pieFullCost(cr){const C=CRUSTS[cr],base=PIE_CO+PIE_FAC+PIE_PAD,pies=C.full*PIE_PIE; return base+pies+Math.min(...Object.keys(ROCKETS).map(rk=>{const R0=ROCKETS[rk],n=Math.ceil(C.full/R0.pies);return (R0.rd?PIE_RD[R0.rd].cost:0)+(n+(rk==='heavy'?PIE_HEAVY_TESTS:0))*R0.cost;}));} +/* The Launch tab's forecast: how long until crust cr is full at today's pace, or null (no factory, no pad that reaches it, + no rocket). The rocket is the one last queued for it, else the one that lifts most a day. Each pad flies one every + leadDays(gap) (pieLaunch sets pad.next), so the pads lift pies/gap a day each; the factory adds PIE_FAC_MONTH a month, + and pies on the shelf and in the queue let the pads outrun it until they are gone. Wear and failures are left out: + it says "about". pad: true when the pads, not the factory, set the pace (another pad would help). */ +function piePace(cr){const P=S.pie;if(!P||!P.fac||!own(CRUSTS,cr))return null;const need=Math.max(0,CRUSTS[cr].full-pieLive(cr)),pads=P.pads.filter(p=>piePadOk(p.city,cr)).length;if(!pads)return null; + const use=rk=>pieRkOk(rk)&&!(rk==='heavy'&&pieTests()ROCKETS[rk].pies/leadDays(ROCKETS[rk].gap); + const L=P.q.filter(x=>x.cr===cr&&!x.test).sort((a,b)=>b.day-a.day)[0],rk=L&&use(L.rk)?L.rk:Object.keys(ROCKETS).filter(use).sort((a,b)=>rate(b)-rate(a))[0];if(!rk)return null; + const rp=pads*rate(rk),rf=PIE_FAC_MONTH/30,st=P.stock+P.crusts[cr].queued;let days; + if(rp<=rf)days=need/rp;else{const t=st/(rp-rf);days=need<=rp*t?need/rp:t+(need-rp*t)/rf;} + return {days:Math.ceil(days),rk,mo:Math.round(Math.min(rp,rf)*30),pad:rp<=rf};} +// Where another pad would help crust cr most: the coastal POP nearest the equator that has none and reaches it. +function piePadTip(cr){const P=S.pie;return Object.keys(S.pops).filter(c=>!P.pads.some(p=>p.city===c)&&piePadOk(c,cr)).sort((a,b)=>Math.abs(CITY[a].lat)-Math.abs(CITY[b].lat)).find(pieCoast)||null;} function pieCohort(cr,n,las){const c=S.pie.crusts[cr],m=Math.floor(S.day/30),k=c.cohorts.find(x=>x.las===las&&Math.floor(x.day/30)===m);if(k)k.n+=n;else c.cohorts.push({n,day:S.day,las}); if(c.cohorts.length>PIE_COHORTS)c.cohorts.splice(0,c.cohorts.length-PIE_COHORTS);} // A launch: every one costs a party; a test always ends in a fireball; the rest fail by the rocket's odds and the chaos rule, diff --git a/src/game/60-features/99-pie-patchy.js b/src/game/60-features/99-pie-patchy.js new file mode 100644 index 0000000..e76b4b0 --- /dev/null +++ b/src/game/60-features/99-pie-patchy.js @@ -0,0 +1,21 @@ +/* ---------- Pie in the Sky: patchy-sky customers (docs/plans/pie-in-the-sky.md) ---------- + Before a crust carries anything (under PIE_RAW, rule O2), a few customers already pay for a sky with gaps: buoys, ships' + mail, cattle tags and weather stations that store their data and send it when a pie passes. They need no routed capacity, + so they are a revenue line in pieMoney(), never a flow: routing is unchanged, and so is every game without pies. + A crust earns PIE_PATCHY_MO (scaled by its size, Shortcrust's g as 1) x a share that grows from PIE_PATCHY_LO to PIE_RAW + coverage, with at least one working pie dish under it. From PIE_RAW they hand over to the real orbit customers: the + line shrinks as pieCarry() grows and is gone at PIE_BAKED, so the two are never paid for the same sky in full. */ +const PIE_PATCHY_MO=30e6,PIE_PATCHY_LO=0.1; +// The Dishes tab's hint shows while every crust is under PIE_DISH_WAIT; the Launch tab nudges for a pad past PIE_PACE_SLOW days. +const PIE_DISH_WAIT=0.3,PIE_PACE_SLOW=720; +// Names for the Traffic tab, shown as more of the sky fills (puns, never real companies). +const PIE_PATCHY_NAMES=['Store and Forward Thinking','Buoy Meets Girl Telemetry','Ship Happens Mail','Moo-ving Target Cattle Tags','Whale Hello There Research','Weather or Not Stations','Better Late Than Never Post','Tide Me Over Buoys']; +// The share of PIE_PATCHY_MO crust id earns today (0..1): a ramp up to PIE_RAW, then handed over to pieCarry(). +function piePatchyShare(id){return clamp((pieCov(id)-PIE_PATCHY_LO)/(PIE_RAW-PIE_PATCHY_LO),0,1)*(1-pieCarry(id));} +// $/mo from patchy-sky customers, per crust and in total: {mo, cr:{id:$}}. ds: pieDishes() of this compute. +function piePatchy(ds){const P=S.pie,o={mo:0,cr:{}};if(!P||P.safe||!ds.length)return o; + for(const id in CRUSTS){if(P.crusts[id].down>S.day)continue;const f=piePatchyShare(id);if(!(f>0)||!ds.some(d=>pieCovers(id,d.city)))continue; + const v=Math.round(PIE_PATCHY_MO*CRUSTS[id].g/CRUSTS.short.g*f);o.cr[id]=v;o.mo+=v;} + return o;} +// How many of the names to show for mo $/mo: one per few $M, at least one. +const piePatchyN=mo=>clamp(Math.ceil(mo/4e6),1,PIE_PATCHY_NAMES.length); diff --git a/src/game/80-simulation/35-pie-paths.js b/src/game/80-simulation/35-pie-paths.js index 6a5baf8..957e254 100644 --- a/src/game/80-simulation/35-pie-paths.js +++ b/src/game/80-simulation/35-pie-paths.js @@ -96,7 +96,7 @@ function pieFast(X,fastSP,A,B,b,wLat){const Ai=CIDX[A],Bi=CIDX[B],nb=X.bh.length if(w.path.some(e=>e.sky&&bad(e)))w=walkI(dijkstra(X.adj,Ai,wLat,(v,e)=>!!e.sky&&bad(e)||!!nb&&nb(e),Bi).P,Ai,Bi); if(w.path.some(e=>e.sky)){X.l2o[b.id]=1;X.l2p[b.id]={w,A,B};} return [{...w,share:1}];} -// After routing: what orbit earns (terminals, and a premium on circuits riding the sky) and what each dish carries. +// After routing: what orbit earns (terminals, a premium on circuits riding the sky, patchy-sky customers) and what each dish carries. function pieMoney(X,R2,V){let rev=0;const sf={},flows=[]; for(const b of S.biz){const T=BIZ_T[b.type]; if(T.orbit){const a=X.term[b.id]||0,s=b.bw>0?a/b.bw*(X.gs[b.id]?sfOf(R2,X.gs[b.id]):0):0,v=b.bw*b.rate*Math.min(1,s/0.95);sf[b.id]=s;rev+=v; @@ -107,7 +107,9 @@ function pieMoney(X,R2,V){let rev=0;const sf={},flows=[]; const bh=[];for(const e of X.bh){const g=e.ld||0,b=e.bh;used[e.a]+=g;used[e.b]+=g;bhG[e.a]=(bhG[e.a]||0)+g;bhG[e.b]=(bhG[e.b]||0)+g; bh.push({city:e.a,land:e.b,g,cap:e.cap,ms:e.lat,cr:b.cr,las:b.las,km:e.km});flows.push({k:'b',id:'bh:'+e.a,city:e.a,dish:e.b,g,cap:e.cap,ms:e.lat,cr:b.cr,hops:pieBhHops(e,true)});} for(const o of X.bhNo)bh.push({city:o.city,land:null,g:0,cap:0,why:o.why}); - V.orbit=rev;R2.pie={rev,sf,gs:X.gs,isl:X.isl,used,term:X.gsBw,hubs:X.hubs,sky:X.up.length,flows,bh,...pieLoads(X,flows,used,term,bhG)}; + // Patchy-sky customers (99-pie-patchy.js): a revenue line before a crust carries anything, handed over as it does. + const patchy=piePatchy(X.ds);rev+=patchy.mo; + V.orbit=rev;R2.pie={rev,patchy,sf,gs:X.gs,isl:X.isl,used,term:X.gsBw,hubs:X.hubs,sky:X.up.length,flows,bh,...pieLoads(X,flows,used,term,bhG)}; // For the lazy fiber comparison (pieFiberMs): the graph of this compute, kept out of JSON. Object.defineProperty(R2.pie,'_x',{value:{adj:X.adj,fm:{}}});} // A sky circuit for the Traffic tab and the traceroute: entry and exit, the dishes it lands at, and each hop through space. diff --git a/src/game/93-ui/85-pie-control.js b/src/game/93-ui/85-pie-control.js index c8a048a..ef881a7 100644 --- a/src/game/93-ui/85-pie-control.js +++ b/src/game/93-ui/85-pie-control.js @@ -28,14 +28,25 @@ function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pi
${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')}

`; }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))}
${tr('pie.crust_line',{alt:C.alt,n:pieLive(id),full:C.full,q:P.crusts[id].queued,p:pct(cv)})}
+ ${(()=>{const f=pieLive(id)+P.crusts[id].queued>0&&pieLive(id)${t}

`; + if(!nudge&&f.pad&&f.days>PIE_PACE_SLOW&&P.pads.length${tr('pie.pace_pad',{city:esc(CITY[c].name),p:pct(pieEq(c))})}

${btn(tr('pie.build_pad_price',{city:esc(CITY[c].name),price:fmt$(piePrice(PIE_PAD))}),'piePad',{city:c},'ghost sm',!can)}
` + :`

${tr('pie.pace_pad_none')}

`;} + return x;})()}
${Object.keys(ROCKETS).filter(pieRkOk).map(rk=>{const q=pieQuote(rk,id,{ins:!!UI.pieIns,las:!!UI.pieLas});return btn(`${tr(ROCKETS[rk].n)} ${q.ok?(q.test?tr('pie.test_flight')+' · ':'')+fmt$(q.cost):esc(q.why)}`,'pieLaunch',{rk,cr:id},'ghost sm',!q.ok);}).join('')}
`;}).join(''); h+=`
${btn(UI.pieIns?tr('pie.ins_on'):tr('pie.ins_off'),'pieIns',{},UI.pieIns?'green sm':'ghost sm')}${btn(UI.pieLas?tr('pie.las_on'):tr('pie.las_off'),'pieLas',{},UI.pieLas?'green sm':'ghost sm')}
`; h+=`

${tr('pie.stock_line',{n:Math.floor(P.stock)})}

`; if(P.q.length)h+=`

${tr('pie.queue')}

`+P.q.slice().sort((a,b)=>a.day-b.day).map(L=>`
${esc(tr(ROCKETS[L.rk].n))} → ${esc(tr(CRUSTS[L.cr].n))}${L.test?tr('pie.test_flight'):L.n} · ${esc(CITY[L.pad].name)} · ${dateStr(L.day)}
`).join(''); }else if(T==='dish'){ - h+=`

${tr('pie.dish_note')}

`+P.dishes.map(x=>{const cc=CITY[x.city].cc,ok=pieLicOk(cc);return `
📡 ${esc(CITY[x.city].name)} · ${trn('pie.n_antennas',x.ant)}${ok?'':' · '+tr('pie.no_rights')}${btn(tr('pie.add_antenna',{price:fmt$(piePrice(PIE_ANT))}),'pieAnt',{id:x.id},'ghost sm',!can||x.ant>=PIE_ANT_MAX)}
`;}).join(''); + h+=`

${tr('pie.dish_note')}

`; + // A gentle hint while the sky is nearly empty: dishes cost money every month and earn nothing yet. Building stays open. + {const top=Math.max(...Object.keys(CRUSTS).map(pieCov));if(top${tr('pie.dish_wait',{min:pct(PIE_RAW),p:pct(top),mo:fmt$(PIE_DISH_MO),lo:pct(PIE_PATCHY_LO)})}

`;} + h+=P.dishes.map(x=>{const cc=CITY[x.city].cc,ok=pieLicOk(cc);return `
📡 ${esc(CITY[x.city].name)} · ${trn('pie.n_antennas',x.ant)}${ok?'':' · '+tr('pie.no_rights')}${btn(tr('pie.add_antenna',{price:fmt$(piePrice(PIE_ANT))}),'pieAnt',{id:x.id},'ghost sm',!can||x.ant>=PIE_ANT_MAX)}
`;}).join(''); h+=sel+`
${btn(tr('pie.build_dish_price',{city:esc(CITY[c].name),price:fmt$(piePrice(PIE_DISH+PIE_ANT))}),'pieDish',{city:c},'ghost sm',!can||P.dishes.some(x=>x.city===c))}
`; 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); diff --git a/src/game/93-ui/86-pie-traffic.js b/src/game/93-ui/86-pie-traffic.js index bc57958..a2a141d 100644 --- a/src/game/93-ui/86-pie-traffic.js +++ b/src/game/93-ui/86-pie-traffic.js @@ -41,6 +41,9 @@ function pieBhRow(b){const id='bh:'+b.city,hi=UI.pieHi===id; function pieTrafficHtml(){const Q=R&&R.pie;if(!Q||!Q.flows)return `

${tr('pie_traffic.no_data')}

`; const bh=Q.bh||[],bg=bh.reduce((a,b)=>a+b.g,0),fl=Q.flows.filter(f=>f.k!=='b'&&(f.g>0||f.k==='t')).sort((a,b)=>b.g-a.g),g=fl.reduce((a,f)=>a+f.g,0),n=fl.filter(f=>f.g>0).length,B=new Map(S.biz.map(b=>[b.id,b])); let h=`

${trn('pie_traffic.headline',n,{g:fmtG(g),of:fmtG(pieMarket()),amt:fmt$(Q.rev)})}

`; + // Patchy-sky customers (99-pie-patchy.js): money, no traffic, so a line of its own. + if(Q.patchy&&Q.patchy.mo>0)h+=`
📶 ${tr('pie_traffic.patchy')}${tr('common.price_mo',{price:fmt$(Q.patchy.mo)})}
+

${esc(PIE_PATCHY_NAMES.slice(0,piePatchyN(Q.patchy.mo)).join(' · '))}

${tr('pie_traffic.patchy_hint',{lo:pct(PIE_PATCHY_LO),min:pct(PIE_RAW),max:pct(PIE_BAKED)})}

`; if(!(g>0)&&!(bg>0))h+=`
${tr('pie_traffic.empty_title')}
    ${pieChecks(Q).map(c=>`
  • ${c.l}${c.ok?'':`${c.h}`}
  • `).join('')}
`; h+=`

${tr('pie_traffic.crusts')}

`+(Q.crust.length?Q.crust.map(c=>{const why=pieCrustWhy(c); return `
${tr(CRUSTS[c.id].n)} ${pieTag(c.st==='half'||c.st==='part'?tr('pie.half_baked'):tr('pie.baked'),c.st!=='half'&&c.st!=='part')}${c.cap>0?tr('pie_traffic.used_of',{u:fmtG(c.used),cap:fmtG(c.cap)}):pct(c.cov)}
diff --git a/src/i18n/en.js b/src/i18n/en.js index c25dbdf..3851e58 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -3412,6 +3412,7 @@ "pie.cr_upper":"Upper Crust (1,100 km)", "pie.crust_line":"{alt} km · {n} of {full} pies · {q} on the way · {p} covered", "pie.dish_note":"A pie dish talks to the pies overhead. It needs a POP in its city and landing rights in its country.", +"pie.dish_wait":"Dishes earn nothing until a crust is {min} covered, and your fullest is at {p}. Each one costs {mo} a month to run, so it pays to wait. Only buoys, ships and sensors pay earlier, from {lo}, and one dish is enough for them.", "pie.earned":"Earned from orbit", "pie.earned_mo":"Orbit earns {amt}/mo · {n} dishes off the backbone carry no transit", "pie.factory":"Pie factory", @@ -3453,6 +3454,10 @@ "pie.no_pads":"No launch pads yet. A pad needs a POP in a city on the coast.", "pie.no_rights":"no landing rights", "pie.open_pie_control":"Pie Control", +"pie.pace_months":{"one":"At this pace ({mo} pies a month), this crust is full in about {n} month.","other":"At this pace ({mo} pies a month), this crust is full in about {n} months."}, +"pie.pace_pad":"Another pad would fill it faster. Your coastal POP nearest the equator is {city}, where a launch costs {p} less.", +"pie.pace_pad_none":"Another pad would fill it faster: open a POP on a coast, ideally near the equator, where launches cost less.", +"pie.pace_years":{"one":"At this pace ({mo} pies a month), this crust is full in about {n} year.","other":"At this pace ({mo} pies a month), this crust is full in about {n} years."}, "pie.pad_busy":"busy until {d}", "pie.pad_free":"ready", "pie.pads":"Launch pads", @@ -3693,6 +3698,8 @@ "pie_traffic.no_landing":"{city} · no dish can land it", "pie_traffic.orbit_no_fiber":"orbit {o} ms, no fiber path", "pie_traffic.orbit_vs_fiber":"orbit {o} ms vs fiber {f} ms", +"pie_traffic.patchy":"Patchy-sky customers", +"pie_traffic.patchy_hint":"Buoys, ships' mail and sensors that can wait for the next pie. They pay from {lo} covered and hand over to regular orbit customers between {min} and {max}.", "pie_traffic.riding":"Who's riding", "pie_traffic.route_ab":"{a} → {b}", "pie_traffic.tab":"Traffic", diff --git a/tests/pie-pace.test.js b/tests/pie-pace.test.js new file mode 100644 index 0000000..b513ef4 --- /dev/null +++ b/tests/pie-pace.test.js @@ -0,0 +1,169 @@ +// Pie in the Sky, the early game: the Launch tab's pace forecast and pad nudge (piePace, piePadTip), patchy-sky customers +// who pay before a crust carries anything (60-features/99-pie-patchy.js), and the Dishes tab's hint to wait. +// Seeded; state is set directly where luck would decide. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); + +// A sandbox rocket company (with real lead times, as on On-call) with a factory and a pad in Lisbon (39°N), 20 pies on the shelf. +const company = (ev) => { + ev("ACT.modeSet({m:'sandbox'});ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.nextFail=1e9;S.nextEvent=1e9;S.rules.lead='real'"); + ev("for(const c of ['fra','sin','lis'])if(!S.pops[c])ACT.buildPop({city:c});ACT.pieFound();ACT.pieFactory();ACT.piePad({city:'lis'});S.pie.stock=20;compute()"); +}; +const cover = (ev, cov, id = 'short') => ev(`S.pie.crusts.${id}.cohorts=[{n:Math.ceil(CRUSTS.${id}.full*${cov}),day:S.day,las:false}];compute()`); +const dish = (ev, c) => ev(`ACT.pieDish({city:'${c}'});S.pie.lic[CITY['${c}'].cc]={state:'ok',until:1e6};compute()`); +const doc = (dom) => dom.window.document; + +test('the Launch tab says when a crust is full at this pace, and nudges for a pad near the equator when it is slow', () => { + const { ev, dom, errors } = load(); + company(ev); + assert.equal(ev("S.pie.pads.length"), 1); + ev("ACT.pieLaunch({rk:'falcon',cr:'short'})"); + // One pad, a Falcon every 14 days: 20/14 pies a day, slower than the factory's 4, so the pad sets the pace. + const f = JSON.parse(ev("JSON.stringify(piePace('short'))")); + assert.equal(f.rk, 'falcon'); + assert.equal(f.pad, true); + assert.equal(f.mo, 43); + assert.equal(f.days, Math.ceil(1584 / (20 / 14)), 'the whole crust at one launch per gap'); + ev("ACT.pieTab({t:'fly'})"); + const html = () => doc(dom).getElementById('modal').innerHTML; + assert.match(html(), /At this pace \(43 pies a month\), this crust is full in about 3 years\./); + // The nudge names the coastal POP nearest the equator (Singapore, 1°N) and builds a pad there in one tap. + assert.equal(ev("piePadTip('short')"), 'sin'); + assert.match(html(), /Your coastal POP nearest the equator is Singapore, where a launch costs 15% less\./); + const b = doc(dom).querySelector('#modal .pie-nudge + .btns [data-act=piePad]'); + assert.ok(b && !b.disabled, 'a pad button under the nudge'); + assert.equal(JSON.parse(b.dataset.args).city, 'sin'); + assert.equal(doc(dom).querySelectorAll('#modal .pie-nudge').length, 1, 'one nudge, not one per crust'); + // Only started crusts get a forecast: Shortcrust is the only one with pies on the way. + assert.equal(doc(dom).querySelectorAll('#modal .pie-pace').length, 1); + b.click(); + assert.equal(ev("S.pie.pads.length"), 2); + // Two pads: twice the pace, under two years, no nudge. + const g = JSON.parse(ev("JSON.stringify(piePace('short'))")); + assert.equal(g.days, Math.ceil(1584 / (40 / 14))); + assert.match(html(), /full in about 19 months\./); + assert.equal(doc(dom).querySelectorAll('#modal .pie-nudge').length, 0); + ev('closeModal()'); + assert.deepEqual(errors, []); +}); + +test('the pace counts the factory: pads that outrun it fly from the shelf, then at its pace, and get no nudge', () => { + const { ev, errors } = load(); + company(ev); + ev("ACT.pieRd({k:'reuse'});ACT.piePad({city:'sin'});ACT.buildPop({city:'mia'});ACT.piePad({city:'mia'});S.pie.stock=200;ACT.pieLaunch({rk:'again',cr:'short'})"); + const f = JSON.parse(ev("JSON.stringify(piePace('short'))")); + // Three reusable pads lift 6 a day, the factory bakes 4: 180 pies on the shelf and 20 queued last 100 days at 6 a day. + assert.equal(f.rk, 'again'); + assert.equal(f.pad, false, 'the factory sets the pace'); + assert.equal(f.mo, 120); + assert.equal(f.days, Math.ceil(100 + (1584 - 600) / 4)); + // Nothing to forecast without a factory, or once the crust is full. + cover(ev, 1); + ev("ACT.pieTab({t:'fly'})"); + assert.equal(ev("document.querySelectorAll('#modal .pie-pace').length"), 0); + ev("S.pie.fac=false"); + assert.equal(ev("piePace('short')"), null); + ev('closeModal()'); + assert.deepEqual(errors, []); +}); + +test('patchy-sky customers pay a little from 10% coverage and hand over to regular orbit customers from 40% to 60%', () => { + const { ev, errors } = load(); + company(ev); + const mo = (cov) => { cover(ev, cov); return ev('R.pie.patchy.mo'); }; + assert.equal(mo(0.25), 0, 'nothing without a working dish'); + dish(ev, 'sin'); + const at = [0.05, 0.1, 0.2, 0.3, 0.4, 0.45, 0.5, 0.55, 0.6, 0.8].map((c) => [c, mo(c)]); + const v = Object.fromEntries(at); + assert.equal(v[0.05], 0); + assert.ok(v[0.1] < 0.1e6, 'from 10%'); + assert.ok(Math.abs(v[0.4] - 30e6) < 0.2e6, `the most it pays is tens of $M a month (${v[0.4]})`); + for (let i = 1; i < at.length; i++) { + const [c, x] = at[i], p = at[i - 1][1]; + if (c <= 0.4) assert.ok(x >= p, `grows up to 40% (${c}: ${x} < ${p})`); + else assert.ok(x <= p, `shrinks from 40% (${c}: ${x} > ${p})`); + } + assert.equal(v[0.6], 0, 'gone once the crust is baked'); + assert.equal(v[0.8], 0); + // No double counting: what is left of it plus the share the crust carries is the whole sky, never more. + cover(ev, 0.5); + assert.ok(Math.abs(ev("piePatchyShare('short')+pieCarry('short')") - 1) < 1e-9); + // It is orbit income: in R.pie.rev, the month's revenue and the books, and never a flow, so routing is unchanged. + cover(ev, 0.3); + const r = JSON.parse(ev("JSON.stringify({rev:R.pie.rev,p:R.pie.patchy.mo,flows:R.pie.flows.length,cr:R.pie.patchy.cr})")); + assert.ok(r.p > 15e6 && r.p < 25e6, `${r.p}`); + assert.equal(r.rev, r.p, 'no other orbit customers yet'); + assert.equal(r.flows, 0); + assert.deepEqual(Object.keys(r.cr), ['short']); + assert.ok(ev('R.revMo') >= r.p); + const e0 = ev('S.pie.book.earned'); + ev('dayTick()'); + assert.ok(Math.abs(ev('S.pie.book.earned') - e0 - r.p / 30) < r.p / 300, 'booked day by day'); + // Safe mode, a crust down for a storm: nothing. + ev("S.pie.safe=true;compute()"); + assert.equal(ev('R.pie.patchy.mo'), 0); + ev("S.pie.safe=false;S.pie.crusts.short.down=S.day+5;compute()"); + assert.equal(ev('R.pie.patchy.mo'), 0); + ev("S.pie.crusts.short.down=0;compute()"); + assert.ok(ev('R.pie.patchy.mo') > 0); + ev('closeModal()'); + assert.deepEqual(errors, []); +}); + +test('the Traffic tab shows patchy-sky customers with their names, and a game without a rocket company has none', () => { + const { ev, dom, errors } = load(); + company(ev); + dish(ev, 'sin'); + cover(ev, 0.3); + ev("ACT.pieTab({t:'traffic'})"); + const row = doc(dom).querySelector('#modal .pft-patchy'); + assert.ok(row, 'a patchy-sky row'); + assert.match(row.textContent, /Patchy-sky customers/); + assert.match(row.textContent, /Store and Forward Thinking/); + assert.match(row.textContent, /\$20(\.\d)?M\/mo/); + // Phones: the row is a plain block in the sheet, nothing wider than the screen. + assert.ok(!/width:\s*\d{3,}px/.test(row.outerHTML)); + ev('closeModal()'); + // Without pies: no orbit at all. + const g = load(); + g.ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();ACT.launchBB({city:'fra'});compute()"); + assert.equal(g.ev('R.pie'), undefined); + assert.deepEqual(errors, []); + assert.deepEqual(g.errors, []); +}); + +test('the Dishes tab says dishes earn nothing while the sky is nearly empty, and still lets you build', () => { + const { ev, dom, errors } = load(); + company(ev); + cover(ev, 0.12); + ev("UI.pieCity='sin';ACT.pieTab({t:'dish'})"); + const hint = () => doc(dom).querySelector('#modal .pie-wait'); + assert.ok(hint(), 'the hint'); + assert.match(hint().textContent, /Dishes earn nothing until a crust is 40% covered, and your fullest is at 12%\./); + assert.match(hint().textContent, /\$300k a month/); + const b = doc(dom).querySelector('#modal [data-act=pieDish]'); + assert.ok(b && !b.disabled, 'building is not blocked'); + cover(ev, 0.35); + ev("ACT.pieTab({t:'dish'})"); + assert.equal(hint(), null, 'gone from 30%'); + ev('closeModal()'); + assert.deepEqual(errors, []); +}); + +// The playtest: one pad, dishes in every city on day one, launches as fast as the pad allows. Year one now shows a +// small orbit income before the crust carries anything: tens of $M a month at most, never hundreds. +test('a hasty player sees a small orbit income in the first year', { timeout: 120000 }, () => { + const { ev, errors } = load(); + company(ev); + ev("S.pie.stock=40;for(const c of Object.keys(S.pops))dish(c);function dish(c){ACT.pieDish({city:c});S.pie.lic[CITY[c].cc]={state:'ok',until:1e6};}compute()"); + ev("window.__m=[];for(let d=0;d<360;d++){if(pieQuote('falcon','short').ok)ACT.pieLaunch({rk:'falcon',cr:'short'});S.nextFail=1e9;S.nextEvent=1e9;dayTick();if(d%30===29){compute();__m.push([pieCov('short'),R.pie.patchy.mo,R.pie.rev]);}}"); + const m = JSON.parse(ev('JSON.stringify(__m)')); + const top = Math.max(...m.map((x) => x[1])); + assert.ok(m[m.length - 1][0] < 0.4, `still under 40% after a year on one pad (${m[m.length - 1][0]})`); + assert.ok(top >= 5e6, `visible: ${top}`); + assert.ok(top <= 50e6, `small: ${top}`); + assert.ok(m.every((x) => x[2] === x[1]), 'all of it from patchy-sky customers'); + ev('closeModal()'); + assert.deepEqual(errors, []); +}); diff --git a/tests/pie-routing.test.js b/tests/pie-routing.test.js index 575bbfc..40043fe 100644 --- a/tests/pie-routing.test.js +++ b/tests/pie-routing.test.js @@ -60,7 +60,9 @@ test('O2: a crust carries nothing under 40%, a share up to 60%, and orbit never assert.deepEqual(ev('JSON.stringify(pieHubs())'), '[]'); assert.equal(skyOf(ev, 'hft1'), false); assert.equal(ev("R.pie.sf.pz"), 0, 'a home on Pitcairn gets nothing from a half-baked crust'); - assert.equal(ev('R.pie.rev'), 0); + // the only orbit money under 40% is patchy-sky customers (99-pie-patchy.js), who need no traffic carried + assert.equal(ev('R.pie.rev'), ev('R.pie.patchy.mo')); + assert.equal(ev("R.pie.flows.filter(f=>f.g>0).length"), 0); // half-baked at 50%: a quarter of the crust's Gbps (half its pies, half of those carrying) and a quarter of the market ev("S.pie.crusts.short.cohorts=[{n:CRUSTS.short.full/2,day:S.day,las:true}];compute()"); assert.deepEqual(ev('JSON.stringify(pieHubs())'), '["short"]', 'over 40% it is a hub'); From 95f385155748f02c65ab9c2b9df49063d2f1ca97 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Thu, 5 Nov 2026 17:12:50 +0100 Subject: [PATCH 04/10] Pie in the Sky: a grand opening when a crust starts carrying traffic, so regular customers sign as the patchy ones fade --- CHANGELOG.md | 2 +- src/game/60-features/99-pie-in-the-sky.js | 2 +- .../60-features/99-pie-orbit-customers.js | 6 ++++- tests/pie-pace.test.js | 25 +++++++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6642fd4..4b6fc40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ All notable changes to this project are documented here. The project follows - 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. - 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/src/game/60-features/99-pie-in-the-sky.js b/src/game/60-features/99-pie-in-the-sky.js index 0d4115c..d2253f4 100644 --- a/src/game/60-features/99-pie-in-the-sky.js +++ b/src/game/60-features/99-pie-in-the-sky.js @@ -131,7 +131,7 @@ function pieSanitize(s){s.pieV=int(s.pieV,0,1,0);pieEximFix(s);const p=s.pie,ob= .map(x=>({city:x.city,next:int(x.next,0,day+3650,day),boosters:(Array.isArray(x.boosters)?x.boosters:[]).filter(ob).slice(0,PIE_BOOSTERS).map(b=>({id:sid0(b.id),flights:n(b.flights,PIE_BOOST_MAX-1)}))})); if(ob(p.crusts))for(const id in CRUSTS){const c=p.crusts[id];if(!ob(c))continue;const C=CRUSTS[id]; o.crusts[id].cohorts=(Array.isArray(c.cohorts)?c.cohorts:[]).filter(k=>ob(k)&&num(k.n,0)>=1).map(k=>({n:n(k.n,C.full*2),day:int(k.day,0,day,day),las:!!k.las})).filter(k=>day-k.dayday)o.crusts[id].down=int(c.down,day,day+365,day);if(c.bk)o.crusts[id].bk=1;} + if(c.down!==undefined&&num(c.down,0)>day)o.crusts[id].down=int(c.down,day,day+365,day);if(c.bk)o.crusts[id].bk=1;if(c.open!==undefined)o.crusts[id].open=int(c.open,0,day,day);} const ds=new Set(); o.dishes=(Array.isArray(p.dishes)?p.dishes:[]).filter(x=>ob(x)&&isCity(x.city)&&s.pops[x.city]&&!ds.has(x.city)&&ds.add(x.city)).slice(0,PIE_DISH_MAX) .map(x=>({id:sid0(x.id),city:x.city,ant:int(x.ant,1,PIE_ANT_MAX,1),down:int(x.down,0,day+365,0)})); diff --git a/src/game/60-features/99-pie-orbit-customers.js b/src/game/60-features/99-pie-orbit-customers.js index d40b3b2..22b8f5d 100644 --- a/src/game/60-features/99-pie-orbit-customers.js +++ b/src/game/60-features/99-pie-orbit-customers.js @@ -27,5 +27,9 @@ function pieSpawn(t){const T=BIZ_T[t],min=T.opts[0],ok=pieCands(t).filter(c=>{if const left=Math.min(pieRoom(t),pieServe(city,t).left-S.offers.reduce((a,o)=>a+(BIZ_T[o.type].orbit?o.bw:0),0)),opts=T.opts.filter(g=>g<=left),bw=opts.length?pick(opts):0;if(!bw)return; const list=T.names.filter(n=>!S.usedNames.includes(n)),name=list.length?pick(list):pick(T.names);useName(name); S.offers.push({id:uid(),city,city2:null,name,type:t,bw,rate:T.rate,reqs:[],exp:S.day+40});} +// Grand opening: the first PIE_OPEN_DAYS after a crust starts carrying traffic (crust.open, the day it first did), the phone +// rings every day and up to PIE_OPEN_OFFERS wait, so regular customers sign while the patchy-sky income fades (99-pie-patchy.js). +const PIE_OPEN_DAYS=30,PIE_OPEN_OFFERS=4; +function pieOpening(){const P=S.pie;let on=false;for(const id of pieHubs()){const c=P.crusts[id];if(!c)continue;if(c.open===undefined&&pieCap(id)>0)c.open=S.day;if(c.open!==undefined&&S.day-c.open{if(S.offers.filter(o=>BIZ_T[o.type].orbit).length>=PIE_OFFERS)return;const t=pieOfferTypes();if(t.length&&Math.random(){const op=pieOpening();if(S.offers.filter(o=>BIZ_T[o.type].orbit).length>=(op?PIE_OPEN_OFFERS:PIE_OFFERS))return;const t=pieOfferTypes();if(t.length&&(op||Math.random() { + const { ev, errors } = load({ seed: 5 }); + company(ev); + dish(ev, 'sin'); + ev('S.pie.dishes[0].ant=16'); // 320 Gbps: room for every size of orbit customer + cover(ev, 0.3); + ev('dayTick()'); + assert.equal(ev("S.pie.crusts.short.open"), undefined, 'nothing opens while the crust carries nothing'); + cover(ev, 0.7); + const open = (n) => ev(`(()=>{let k=0;for(let i=0;i<${n};i++){S.offers=S.offers.filter(o=>!BIZ_T[o.type].orbit);dayTick();k+=S.offers.filter(o=>BIZ_T[o.type].orbit).length;}return k;})()`); + const d0 = ev('S.day'); + const first = open(10); + assert.ok([d0, d0 + 1].includes(ev("S.pie.crusts.short.open")), 'the opening day is kept (the day tick moves the date first)'); + assert.ok(first >= 7, 'nearly every day of the opening brings a call (a type that fits nowhere spawns nothing): ' + first); + ev(`S.day=${d0}+40`); + const later = open(30); + assert.ok(later < 20, 'after the opening, about one call in three days: ' + later); + // The opening day survives a save, and garbage is dropped. + ev(`S.pie.crusts.short.open=${d0};S=migrate(JSON.parse(JSON.stringify(S)))`); + assert.equal(ev("S.pie.crusts.short.open"), d0); + ev("S.pie.crusts.short.open='soon';S=migrate(JSON.parse(JSON.stringify(S)))"); + assert.equal(typeof ev("S.pie.crusts.short.open"), 'number'); + assert.deepEqual(errors, []); +}); From 176a6995b151c8c8ab0f5b823b78b52205d911c5 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Fri, 6 Nov 2026 06:57:23 +0100 Subject: [PATCH 05/10] Pie globe: continents clip cleanly at the rim instead of fluttering Hidden coast was pushed onto the rim, so coasts on the edge shivered while the globe turned, and from some angles Eurasia's fill ran the long way round and painted the whole globe green for a step (up to 47% of the picture flipping between two half-degree steps). Each ring is now clipped at the horizon as map libraries do: the fill follows the rim in the ring's own turning direction to the next point where coast comes back, and only real coast is outlined. --- src/game/96-map/89-pie-globe.js | 38 +++++++++++++++++++++++++++++---- tests/pie-globe.test.js | 16 ++++++++++++++ 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/game/96-map/89-pie-globe.js b/src/game/96-map/89-pie-globe.js index 20c227f..89fe3ed 100644 --- a/src/game/96-map/89-pie-globe.js +++ b/src/game/96-map/89-pie-globe.js @@ -12,12 +12,43 @@ const PG_ST={ // The whole state of the globe. cv is null whenever it is closed, and then nothing below runs. const PG={cv:null,ctx:null,get:null,raf:0,last:0,t:0,yaw:-20,tilt:18,vy:0,drag:null,night:null,anim:true,dirty:true, data:null,dAt:-1e9,sig:'',sm:[],dish:[],fl:[],hi:null,pads:[],lch:[],fly:[],on:null,g:null,frames:0,m:new Float64Array(9)}; -let PG_LAND=null,PG_GRID=null,PG_LIGHT=null,PG_STAR=null; +let PG_LAND=null,PG_LAND_DIR=null,PG_TURN=1,PG_GRID=null,PG_LIGHT=null,PG_STAR=null; const pgNightPref=()=>{if(PG.night===null){try{PG.night=localStorage.getItem('sot-globe')==='night';}catch(e){PG.night=false;}}return PG.night;}; // Unit vectors for the land rings (LANDS_LL), the graticule, city lights and stars: worked out once, on first open. function pgUnit(lo,la,a,i){const b=la*PG_D,c=Math.cos(b),o=lo*PG_D;a[i]=c*Math.cos(o);a[i+1]=c*Math.sin(o);a[i+2]=Math.sin(b);} +// One land ring, clipped to the near side (as map libraries clip). The coast runs to where it meets the horizon; from there the +// fill follows the rim, in the ring's own turning direction (PG_LAND_DIR, from its signed area), to the next point where any +// coast comes back. Only real coast goes into the outline. Pushing hidden points onto the rim made coasts on the edge shiver, +// and a ring bigger than half the rim (Eurasia) filled the whole globe from some angles. +const PG_TAU=2*Math.PI,pgAng=a=>a<0?a+PG_TAU:a; +function pgLandRing(ctx,b,n,dir,cx,cy,R,coast){let s=-1;for(let i=0;i=0){s=i;break;}if(s<0)return; + const X=(h)=>cx+R*h,Y=(v)=>cy-R*v;let all=true;for(let i=0;i{const u=px/(px-x);let eh=ph+(h-ph)*u,ev=pv+(v-pv)*u;const m=Math.hypot(eh,ev)||1;return [eh/m,ev/m];}; + for(let k=1;k<=n;k++){const j=((s+k)%n)*3,x=b[j],h=b[j+1],v=b[j+2],up=x>=0,was=px>=0; + if(was&&!up){const e=cross(x,h,v);if(cur){cur.p.push(e[0],e[1]);cur.out=Math.atan2(e[1],e[0]);runs.push(cur);cur=null;}else{head.push(e[0],e[1]);head.outA=Math.atan2(e[1],e[0]);}} + else if(!was&&up){const e=cross(x,h,v);cur={p:[e[0],e[1],h,v],in:Math.atan2(e[1],e[0])};} + else if(up){if(cur)cur.p.push(h,v);else head.push(h,v);} + px=x;ph=h;pv=v;} + // The walk started at a visible point: the run still open at the end carries on into the first points. + if(cur){cur.p.push(...pre,...head);cur.out=head.outA;runs.push(cur);} + else if(head.outA!==undefined)runs.push({p:[...pre,...head],in:NaN,out:head.outA}); + if(!runs.length)return; + for(const r of runs){coast.moveTo(X(r.p[0]),Y(r.p[1]));for(let i=2;i0);r=best;} + ctx.closePath();}} function pgVecs(){if(PG_LAND)return; PG_LAND=LANDS_LL.map(l=>{const a=new Float32Array(l.ll.length*3);l.ll.forEach((q,i)=>pgUnit(q[0],q[1],a,i*3));return a;}); + PG_LAND_DIR=PG_LAND.map(a=>{const n=a.length/3;let cx=0,cy=0,cz=0,s=0;for(let i=0;i=0?PG_TURN:-PG_TURN;}); PG_GRID=[];for(let lo=-180;lo<180;lo+=30){const a=new Float32Array(31*3);for(let j=0;j<=30;j++)pgUnit(lo,-90+j*6,a,j*3);PG_GRID.push(a);} for(let la=-60;la<=60;la+=30){const a=new Float32Array(61*3);for(let j=0;j<=60;j++)pgUnit(-180+j*6,la,a,j*3);PG_GRID.push(a);} const cs=CITIES.filter(c=>isFinite(c.lat)&&isFinite(c.lon));PG_LIGHT={v:new Float32Array(cs.length*3),r:cs.map(c=>1.1+Math.min(1.6,(c.P||0)/400))};cs.forEach((c,i)=>pgUnit(c.lon,c.lat,PG_LIGHT.v,i*3)); @@ -101,9 +132,8 @@ function pgDraw(ctx,W,H){ for(let i=0;i=0){any=true;break;}if(!any)continue; - for(let i=0;i { + const { ev, errors } = load({ seed: 1 }); + // A pretend canvas that adds up how far each fill runs along the rim. + const r = ev(`(()=>{pgVecs();const rec={arcs:[],moveTo(){},lineTo(){},closePath(){},arc(x,y,R,a,b,ccw){let s=ccw?a-b:b-a;this.arcs.push(s);}}; + const coast=new Path2D();let worst=0,where='',shapes=0; + for(let tilt=-60;tilt<=60;tilt+=15)for(let yaw=0;yaw<360;yaw+=5){PG.yaw=yaw;PG.tilt=tilt;pgCam(); + for(let li=0;lia+Math.abs(b),0);shapes++;if(lap>worst){worst=lap;where=LANDS_LL[li].id+' yaw '+yaw+' tilt '+tilt;}}} + return {worst,where,shapes,dirs:PG_LAND_DIR.length===PG_LAND.length&&PG_LAND_DIR.every(d=>d===1||d===-1)};})()`); + assert.ok(r.dirs, 'every land ring knows which way it turns'); + // A fill that runs all the way round the rim paints the whole globe green (Eurasia from the south used to). + assert.ok(r.worst < 2 * Math.PI - 0.1, 'the longest run along the rim is ' + r.worst.toFixed(2) + ' rad, at ' + r.where); + assert.ok(r.shapes > 1000); + assert.deepEqual(errors, []); +}); From 9d74873edb749baef1ababad1777134b186309b1 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Fri, 6 Nov 2026 07:21:52 +0100 Subject: [PATCH 06/10] 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/); From 2243280affb799d16a10a4977be8acb9c116d348 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Fri, 6 Nov 2026 07:51:43 +0100 Subject: [PATCH 07/10] Pie in the Sky: the Founder's antics make markets jumpy, then it wears off - Every 60 to 120 days while a rocket company exists (the first 90 days after the plan starts), the Founder does something daft: a post, a gasp toast and a temporary effect (99-pie-jitters.js). A once-a-game antic takes orbit billing down for 3 to 5 days (no orbit income, then a restore post); a 3 a.m. spree (orbit offers x0.6 and a 4-point orbit mood dip for 14 days); a fight with a regulator (a landing-rights spat via pieSpatStart in a country with a dish or rights, within the spat limit); a leaked launch date (insurance 8% -> 14% for 30 days); Mars next year (offers x1.5 for 14 days, a promise like the others whose slip cancels the unhappiest 2% of orbit customers). - Market jitters (S.pie.founder.jit, 0..1): each antic bumps it, it fades by 1/30 a day, and while high it lowers orbit offer odds (up to -30%) and holds orbit happiness under 100-25*jit (never low enough to cancel at renewal). The Company tab shows one line and a small meter next to the feed. - Rule O5: harm only with pieChaos(); with chaos off he only posts. Dice only with a company. - Saves: new founder fields in pieBlank, repaired in pieSanitize (pieAnticFix); old saves load calm. - Insurance button shows the current premium (pie.ins_on_p replaces pie.ins_on). Agent docs updated. - pie-balance: compute() also reruns when orbit billing goes down or comes back. - tests/pie-founder.test.js: each antic, decay, once-only billing outage, chaos off, saves, 360 px. --- CHANGELOG.md | 1 + docs/plans/pie-in-the-sky.md | 2 +- site/i18n/de.js | 28 +- site/i18n/es.js | 28 +- site/i18n/fr.js | 28 +- site/i18n/it.js | 28 +- site/i18n/pt.js | 28 +- src/agent/30-docs.js | 4 +- src/game/60-features/99-pie-in-the-sky.js | 12 +- src/game/60-features/99-pie-jitters.js | 68 +++++ .../60-features/99-pie-orbit-customers.js | 2 +- src/game/80-simulation/35-pie-paths.js | 4 +- src/game/93-ui/85-pie-control.js | 4 +- src/i18n/en.js | 28 +- src/styles/36-ops.css | 2 + tests/pie-balance.test.js | 4 +- tests/pie-founder.test.js | 260 ++++++++++++++++++ 17 files changed, 510 insertions(+), 21 deletions(-) create mode 100644 src/game/60-features/99-pie-jitters.js create mode 100644 tests/pie-founder.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index effe6cf..79bc4e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ All notable changes to this project are documented here. The project follows - 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 Founder of your rocket company now does something daft every few months, and the markets get jumpy every time: a sleepless posting spree that makes orbit customers nervous, a fight with a country's regulator, a launch date leaked early that makes launch insurance dearer, a promise of Mars by next year that costs a few customers when it slips, and worse. It always wears off: Pie Control's Company tab shows how jittery the market is and how soon it calms down. With no chaos in your ruleset he only posts. - 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. diff --git a/docs/plans/pie-in-the-sky.md b/docs/plans/pie-in-the-sky.md index 997c032..f516eac 100644 --- a/docs/plans/pie-in-the-sky.md +++ b/docs/plans/pie-in-the-sky.md @@ -27,7 +27,7 @@ S.pie = null | {born, co:{name}, fac:bool, rd:{reuse:bool,heavy:bool,heavyTests: pads:[{city,next,boosters:[{id,flights}]}], crusts:{short|frozen|upper|flaky:{cohorts:[{n,day,las}], queued}}, dishes:[{id,city,ant,down}], lic:{[cc]:{state,until}}, q:[launches], - founder:{posts:[...last 20], promises, broken}, book:{spent,earned,wouldHave}, + founder:{posts:[...last 20], promises, broken, due, jit, next, kid, bill, nerv, hype, leak, mars}, (antics: 60-features/99-pie-jitters.js) book:{spent,earned,wouldHave}, spat:{...active geopolitical spats}, safe:bool} ``` Pies are cohorts, never one object per satellite. `sanitize()` clamps all of it. diff --git a/site/i18n/de.js b/site/i18n/de.js index 88a1481..c39c736 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -3424,24 +3424,34 @@ "pie.founder_feed":"Der Gründer postet", "pie.fp_3am":"Poste um 3 Uhr nachts, denn Schlaf ist ein Legacy-Protokoll. Unsere Pies schmecken 40 % besser als letztes Quartal.", "pie.fp_astro":"Astronomen sagen, unsere Pies fotobomben ihre Teleskope. Haben sie mal zwischen ihnen durchgeschaut?", +"pie.fp_backup":"Die Abrechnung läuft wieder, aus dem Backup von letztem Dienstag. Der kleine {nick} hat Hausarrest, bis er Prepared Statements versteht.", "pie.fp_baked":"{crust} ist durchgebacken. Nächster Halt: Mars. Wahrscheinlich nächstes Jahr.", "pie.fp_booster":"Der Booster ist bei der Landung umgekippt. Das war ein geplantes Kippen. Wir nennen es schnelle horizontale Bergung.", "pie.fp_debris":"Eine kleine Essensschlacht in {crust}. Krümel sind ein Zeichen für eine gesunde Konstellation.", "pie.fp_dish":"Unsere erste Pie-Schüssel steht. Meine Mutter sagt, der Empfang ist super.", "pie.fp_fail":"Der heutige Start war ein voller Erfolg. Die Rakete ist jetzt an vielen Orten gleichzeitig.", "pie.fp_found":"{co} gegründet. Unsere Mission: Pies in den Himmel, damit jeder ein Stück abbekommt.", +"pie.fp_kid":"Willkommen auf der Welt, {kid}. Kurz: der kleine {nick}. Stolzer Papa.", "pie.fp_launch":"{n} weitere Pies in {crust}. Mutig. Visionär. Pünktlich (dieses Mal).", +"pie.fp_leak":"Nächster Start: Dienstag, 6:42, Rampe zwei, Foto der Nutzlast anbei. Die Rechtsabteilung sagt, ich soll das löschen. Ich lösche das nicht.", +"pie.fp_leak_kid":"Der kleine {nick} hat den nächsten Starttermin von meinem Handy gepostet. Kinder halt. (Ich war's.)", +"pie.fp_mars":"Mars nächstes Jahr. Pies auf dem Mars. Jetzt buchen.", +"pie.fp_mars_kid":"Dem kleinen {nick} eine Geburtstagsparty auf dem Mars versprochen. Nächstes Jahr. Ganz bestimmt nächstes Jahr.", +"pie.fp_mars_slip":"Mars ist jetzt Jahr {n}. Mars war immer Jahr {n}. Der rote Planet kann warten.", "pie.fp_promise":"Versprochen: volle Abdeckung bis Jahr {n}. Schreibt es auf.", +"pie.fp_reg":"Regulierer sind nur Firewalls mit Schlüsselband. Kommt doch.", "pie.fp_rename":"Wir heißen jetzt {co}. Der alte Name hat die Vision ausgebremst.", "pie.fp_slip":"Volle Abdeckung ist jetzt Jahr {n}. Es war immer Jahr {n}. Lest das Kleingedruckte.", "pie.fp_spat":"Irgendeine Regierung hat Fragen. Wir lieben Fragen. Wir beantworten alle, irgendwann, in einem Thread.", +"pie.fp_spree":"Thread 1/{n}: warum Schlaf ein Legacy-Protokoll ist, warum Pies ein Lebensgefühl sind und warum meine Kritiker Bots sind.", +"pie.fp_spree_kid":"Schon wieder 3 Uhr nachts. Der kleine {nick} zahnt, also hab ich einen Thread geschrieben. 1/{n}.", "pie.fp_storm":"Die Sonne ist neidisch auf {crust}. Völlig normal. Weltraumwetter ist einfach Wetter, nur mehr.", "pie.fp_test":"Testflug {n} endete in einem Feuerball, genau wie erhofft. Wir haben so viel gelernt.", "pie.fp_tour":"Ich trete als Tier 1 kurz zurück und gehe auf Zuhörtour. Reden werde hauptsächlich ich.", "pie.half_baked":"Halbgar", "pie.heavy_tests":"Testflüge geflogen: {n} von {max}. Die ersten explodieren immer.", "pie.ins_off":"Versicherung: aus", -"pie.ins_on":"Versicherung: an (8 %)", +"pie.ins_on_p":"Versicherung: an ({p})", "pie.landing_rights":"Landerechte", "pie.las_off":"Laser: aus", "pie.las_on":"Laser: an (+$0.5M pro Pie)", @@ -3514,6 +3524,22 @@ "pie.why_queue_full":"Der Startplan ist voll.", "pie.why_stock":"Braucht {n} Pies; die Fabrik hat {have}.", "pie.would_have":"Hätte gekostet", +"pie_ant.backup":"Die Orbit-Abrechnung ist aus dem Backup wiederhergestellt. Die Rechnungen gehen wieder raus.", +"pie_ant.bill_paused":"Die Orbit-Abrechnung steht bis {d}: Die Datenbank verschluckt sich noch an {kid}.", +"pie_ant.gasp":"Ooooh. Uuuuuh.", +"pie_ant.jit_calm":"Nervosität am Markt: 😌 ruhig", +"pie_ant.jit_high":"😬 hoch", +"pie_ant.jit_line":{"one":"Nervosität am Markt: {lvl}, beruhigt sich in ~{n} Tag","other":"Nervosität am Markt: {lvl}, beruhigt sich in ~{n} Tagen"}, +"pie_ant.jit_low":"🙂 gering", +"pie_ant.jit_mid":"😟 nervös", +"pie_ant.kid":"Der Gründer hat seinen Sohn {kid} genannt. Die Abrechnungsdatenbank hat die Geburtsanzeige gelesen und sich verschluckt: {n} Tage lang gehen keine Orbit-Rechnungen raus.", +"pie_ant.leak":"Der Gründer hat den nächsten Starttermin gepostet, die Rampe und ein Foto der Nutzlast. Die Startversicherer finden das nicht lustig: Die Versicherung kostet {n} Tage lang {p}.", +"pie_ant.mars":"Der Gründer hat den Mars bis nächstes Jahr versprochen. Der Orbit-Vertrieb ist {n} Tage lang aus dem Häuschen; niemand fragt, was nächstes Jahr passiert.", +"pie_ant.mars_slip":{"one":"Der Mars ist wieder ein Jahr nach hinten gerutscht. {n} Orbit-Kunde hat leise gekündigt.","other":"Der Mars ist wieder ein Jahr nach hinten gerutscht. {n} Orbit-Kunden haben leise gekündigt."}, +"pie_ant.mars_slip_none":"Der Mars ist wieder ein Jahr nach hinten gerutscht. Die Orbit-Kunden verdrehen die Augen.", +"pie_ant.reg":"Der Gründer hat einen Regulierer live auf Sendung ein Legacy-Protokoll genannt. Der Regulierer hat geantwortet, schriftlich.", +"pie_ant.reg_none":"Der Gründer hat einen Regulierer live auf Sendung ein Legacy-Protokoll genannt. Alle warten auf die Antwort.", +"pie_ant.spree":"Der Gründer hat zwischen 3 und 4 Uhr nachts {n}-mal gepostet. Die Orbit-Kunden sind nervös: {d} Tage lang weniger Anfragen und grantigere Kunden.", "pie_globe.switch_to_day_view":"Zur Tagansicht wechseln", "pie_globe.switch_to_night_view":"Zur Nachtansicht wechseln", "pie_globe.your_pies_in_orbit":"Deine Kuchen im Orbit, zum Drehen der Erde ziehen", diff --git a/site/i18n/es.js b/site/i18n/es.js index 9182266..0b95e12 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -3422,24 +3422,34 @@ "pie.founder_feed":"Lo que publica el Fundador", "pie.fp_3am":"Publico a las 3 de la mañana porque dormir es un protocolo obsoleto. Nuestras tartas son un 40 % más ricas que el trimestre pasado.", "pie.fp_astro":"Los astrónomos dicen que nuestras tartas se cuelan en sus telescopios. ¿Han probado a mirar entre ellas?", +"pie.fp_backup":"La facturación vuelve desde la copia de seguridad del martes pasado. El pequeño {nick} está castigado hasta que aprenda qué son las consultas preparadas.", "pie.fp_baked":"{crust} está bien horneada. Próxima parada: Marte. Probablemente el año que viene.", "pie.fp_booster":"El propulsor se volcó al aterrizar. Fue un vuelco planeado. Lo llamamos recuperación horizontal rápida.", "pie.fp_debris":"Una pequeña guerra de comida en {crust}. Las migas son señal de una constelación sana.", "pie.fp_dish":"Nuestra primera antena-tarta ya funciona. Mi madre dice que la señal es genial.", "pie.fp_fail":"El lanzamiento de hoy ha sido un éxito enorme. El cohete ahora está en muchos sitios a la vez.", "pie.fp_found":"Fundada {co}. Nuestra misión: tartas en el cielo para que todos tengan su porción.", +"pie.fp_kid":"Bienvenido al mundo, {kid}. El pequeño {nick}, para abreviar. Papá orgulloso.", "pie.fp_launch":"{n} tartas más en {crust}. Audaz. Visionario. A tiempo (esta vez).", +"pie.fp_leak":"Próximo lanzamiento: martes, 6:42, rampa dos, foto de la carga adjunta. Legal dice que lo borre. No lo borro.", +"pie.fp_leak_kid":"El pequeño {nick} publicó la fecha del próximo lanzamiento desde mi móvil. Niños. (Fui yo.)", +"pie.fp_mars":"Marte el año que viene. Pies en Marte. Reserva ya.", +"pie.fp_mars_kid":"Le prometí al pequeño {nick} una fiesta de cumpleaños en Marte. El año que viene. Seguro que el año que viene.", +"pie.fp_mars_slip":"Marte es ahora el año {n}. Marte siempre fue el año {n}. El planeta rojo puede esperar.", "pie.fp_promise":"Promesa: cobertura total para el año {n}. Apuntadlo.", +"pie.fp_reg":"Los reguladores son cortafuegos con acreditación. Venid a por mí.", "pie.fp_rename":"Ahora somos {co}. El nombre viejo frenaba la visión.", "pie.fp_slip":"La cobertura total es ahora para el año {n}. Siempre fue el año {n}. Leed la letra pequeña.", "pie.fp_spat":"Algún gobierno tiene preguntas. Nos encantan las preguntas. Las contestamos todas, algún día, en un hilo.", +"pie.fp_spree":"Hilo 1/{n}: por qué dormir es un protocolo heredado, por qué los pies son un estilo de vida y por qué mis críticos son bots.", +"pie.fp_spree_kid":"Otra vez las 3 de la mañana. Al pequeño {nick} le salen los dientes, así que escribí un hilo. 1/{n}.", "pie.fp_storm":"El Sol tiene envidia de {crust}. Totalmente normal. El clima espacial es clima, pero más.", "pie.fp_test":"El vuelo de prueba {n} acabó en una bola de fuego, tal como esperábamos. Hemos aprendido muchísimo.", "pie.fp_tour":"Me aparto del Tier 1 para hacer una gira de escucha. Sobre todo hablaré yo.", "pie.half_baked":"A medio hornear", "pie.heavy_tests":"Vuelos de prueba hechos: {n} de {max}. Los primeros siempre explotan.", "pie.ins_off":"Seguro: no", -"pie.ins_on":"Seguro: sí (8 %)", +"pie.ins_on_p":"Seguro: sí ({p})", "pie.landing_rights":"Derechos de aterrizaje", "pie.las_off":"Láseres: no", "pie.las_on":"Láseres: sí (+$0.5M por tarta)", @@ -3512,6 +3522,22 @@ "pie.why_queue_full":"El calendario de lanzamientos está lleno.", "pie.why_stock":"Necesita {n} tartas; la fábrica tiene {have}.", "pie.would_have":"Habría costado", +"pie_ant.backup":"La facturación orbital se ha restaurado desde la copia de seguridad. Las facturas vuelven a salir.", +"pie_ant.bill_paused":"La facturación orbital está caída hasta el {d}: la base de datos aún se atraganta con {kid}.", +"pie_ant.gasp":"Ooooh. Uuuuuh.", +"pie_ant.jit_calm":"Nervios en el mercado: 😌 calma", +"pie_ant.jit_high":"😬 altos", +"pie_ant.jit_line":{"one":"Nervios en el mercado: {lvl}, se calman en ~{n} día","other":"Nervios en el mercado: {lvl}, se calman en ~{n} días"}, +"pie_ant.jit_low":"🙂 bajos", +"pie_ant.jit_mid":"😟 inquietos", +"pie_ant.kid":"El Fundador llamó a su hijo {kid}. La base de datos de facturación leyó el anuncio del nacimiento y se atragantó: durante {n} días no sale ninguna factura orbital.", +"pie_ant.leak":"El Fundador publicó la fecha del próximo lanzamiento, la rampa y una foto de la carga. A las aseguradoras no les hace gracia: el seguro cuesta {p} durante {n} días.", +"pie_ant.mars":"El Fundador prometió Marte para el año que viene. Las ventas orbitales están eufóricas durante {n} días; nadie pregunta qué pasará el año que viene.", +"pie_ant.mars_slip":{"one":"Marte se retrasa otro año. {n} cliente orbital se ha dado de baja sin hacer ruido.","other":"Marte se retrasa otro año. {n} clientes orbitales se han dado de baja sin hacer ruido."}, +"pie_ant.mars_slip_none":"Marte se retrasa otro año. Los clientes orbitales ponen los ojos en blanco.", +"pie_ant.reg":"El Fundador llamó protocolo heredado a un regulador, en directo. El regulador ha respondido, por escrito.", +"pie_ant.reg_none":"El Fundador llamó protocolo heredado a un regulador, en directo. Todos esperan la respuesta.", +"pie_ant.spree":"El Fundador publicó {n} veces entre las 3 y las 4 de la mañana. Los clientes orbitales están nerviosos: menos llamadas y clientes más gruñones durante {d} días.", "pie_globe.switch_to_day_view":"Cambiar a vista de día", "pie_globe.switch_to_night_view":"Cambiar a vista nocturna", "pie_globe.your_pies_in_orbit":"Tus tartas en órbita, arrastra para girar la Tierra", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index f91d0a3..b787b96 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -3422,24 +3422,34 @@ "pie.founder_feed":"Les posts du Fondateur", "pie.fp_3am":"Je poste à 3 h du matin, car le sommeil est un protocole obsolète. Nos tartes sont 40 % plus délicieuses qu'au trimestre dernier.", "pie.fp_astro":"Les astronomes disent que nos tartes s'incrustent dans leurs télescopes. Ont-ils essayé de regarder entre elles ?", +"pie.fp_backup":"La facturation revient de la sauvegarde de mardi dernier. Le petit {nick} est privé de sortie jusqu'à ce qu'il comprenne les requêtes préparées.", "pie.fp_baked":"{crust} est bien cuite. Prochain arrêt : Mars. Sans doute l'an prochain.", "pie.fp_booster":"Le booster s'est renversé à l'atterrissage. C'était prévu. On appelle ça une récupération horizontale rapide.", "pie.fp_debris":"Une petite bataille de nourriture dans {crust}. Les miettes sont le signe d'une constellation en bonne santé.", "pie.fp_dish":"Notre première antenne-tarte est en service. Ma mère dit que le signal est super.", "pie.fp_fail":"Le lancement d'aujourd'hui est un immense succès. La fusée est désormais à plusieurs endroits à la fois.", "pie.fp_found":"{co} est fondée. Notre mission : mettre des tartes dans le ciel pour que chacun ait sa part.", +"pie.fp_kid":"Bienvenue au monde, {kid}. Le petit {nick}, pour faire court. Papa fier.", "pie.fp_launch":"{n} tartes de plus sur {crust}. Audacieux. Visionnaire. À l'heure (cette fois).", +"pie.fp_leak":"Prochain lancement : mardi, 6 h 42, pas de tir deux, photo de la charge utile jointe. Le service juridique dit de supprimer. Je ne supprime pas.", +"pie.fp_leak_kid":"Le petit {nick} a publié la date du prochain lancement depuis mon téléphone. Les enfants, hein. (C'était moi.)", +"pie.fp_mars":"Mars l'an prochain. Des pies sur Mars. Réservez maintenant.", +"pie.fp_mars_kid":"J'ai promis au petit {nick} un anniversaire sur Mars. L'an prochain. Sûrement l'an prochain.", +"pie.fp_mars_slip":"Mars, c'est maintenant l'année {n}. Mars a toujours été l'année {n}. La planète rouge peut attendre.", "pie.fp_promise":"Promis : couverture totale d'ici l'an {n}. Notez-le.", +"pie.fp_reg":"Les régulateurs ne sont que des pare-feu avec un badge. Venez.", "pie.fp_rename":"On s'appelle {co} maintenant. L'ancien nom bridait la vision.", "pie.fp_slip":"La couverture totale, c'est maintenant l'an {n}. Ça a toujours été l'an {n}. Lisez les notes de bas de page.", "pie.fp_spat":"Un gouvernement a des questions. On adore les questions. On y répond toutes, un jour, dans un thread.", +"pie.fp_spree":"Thread 1/{n} : pourquoi le sommeil est un protocole obsolète, pourquoi les pies sont un art de vivre et pourquoi mes critiques sont des bots.", +"pie.fp_spree_kid":"Encore 3 h du matin. Le petit {nick} fait ses dents, alors j'ai écrit un thread. 1/{n}.", "pie.fp_storm":"Le Soleil est jaloux de {crust}. Tout à fait normal. La météo spatiale, c'est de la météo, en plus fort.", "pie.fp_test":"Le vol d'essai {n} a fini en boule de feu, exactement comme espéré. On a tellement appris.", "pie.fp_tour":"Je prends du recul sur le Tier 1 pour une tournée d'écoute. Surtout, je vais parler.", "pie.half_baked":"À moitié cuite", "pie.heavy_tests":"Vols d'essai effectués : {n} sur {max}. Les premiers explosent toujours.", "pie.ins_off":"Assurance : non", -"pie.ins_on":"Assurance : oui (8 %)", +"pie.ins_on_p":"Assurance : oui ({p})", "pie.landing_rights":"Droits d'atterrissage", "pie.las_off":"Lasers : non", "pie.las_on":"Lasers : oui (+0,5 M$ par tarte)", @@ -3512,6 +3522,22 @@ "pie.why_queue_full":"Le calendrier des lancements est plein.", "pie.why_stock":"Il faut {n} tartes ; l'usine en a {have}.", "pie.would_have":"Aurait coûté", +"pie_ant.backup":"La facturation orbitale est restaurée depuis la sauvegarde. Les factures repartent.", +"pie_ant.bill_paused":"La facturation orbitale est en panne jusqu'au {d} : la base de données s'étrangle encore sur {kid}.", +"pie_ant.gasp":"Ooooh. Uuuuuh.", +"pie_ant.jit_calm":"Nervosité du marché : 😌 calme", +"pie_ant.jit_high":"😬 forte", +"pie_ant.jit_line":{"one":"Nervosité du marché : {lvl}, retour au calme dans ~{n} jour","other":"Nervosité du marché : {lvl}, retour au calme dans ~{n} jours"}, +"pie_ant.jit_low":"🙂 faible", +"pie_ant.jit_mid":"😟 inquiète", +"pie_ant.kid":"Le Fondateur a appelé son fils {kid}. La base de facturation a lu le faire-part et s'est étranglée : aucune facture orbitale ne part pendant {n} jours.", +"pie_ant.leak":"Le Fondateur a publié la date du prochain lancement, le pas de tir et une photo de la charge utile. Les assureurs n'apprécient pas : l'assurance coûte {p} pendant {n} jours.", +"pie_ant.mars":"Le Fondateur a promis Mars pour l'an prochain. Les ventes orbitales s'emballent pendant {n} jours ; personne ne demande ce qui se passera l'an prochain.", +"pie_ant.mars_slip":{"one":"Mars glisse encore d'un an. {n} client orbital a résilié sans bruit.","other":"Mars glisse encore d'un an. {n} clients orbitaux ont résilié sans bruit."}, +"pie_ant.mars_slip_none":"Mars glisse encore d'un an. Les clients orbitaux lèvent les yeux au ciel.", +"pie_ant.reg":"Le Fondateur a traité un régulateur de protocole obsolète, en direct. Le régulateur a répondu, par écrit.", +"pie_ant.reg_none":"Le Fondateur a traité un régulateur de protocole obsolète, en direct. Tout le monde attend la réponse.", +"pie_ant.spree":"Le Fondateur a publié {n} fois entre 3 h et 4 h du matin. Les clients orbitaux sont nerveux : moins d'appels et des clients plus grincheux pendant {d} jours.", "pie_globe.switch_to_day_view":"Passer en vue de jour", "pie_globe.switch_to_night_view":"Passer en vue de nuit", "pie_globe.your_pies_in_orbit":"Tes tartes en orbite, fais glisser pour tourner la Terre", diff --git a/site/i18n/it.js b/site/i18n/it.js index be89ce2..71b2ced 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -3422,24 +3422,34 @@ "pie.founder_feed":"I post del Fondatore", "pie.fp_3am":"Posto alle 3 di notte perché il sonno è un protocollo legacy. Le nostre torte sono il 40% più buone dello scorso trimestre.", "pie.fp_astro":"Gli astronomi dicono che le nostre torte fanno photobombing nei loro telescopi. Hanno provato a guardare in mezzo?", +"pie.fp_backup":"La fatturazione è tornata dal backup di martedì scorso. Il piccolo {nick} è in punizione finché non impara le prepared statement.", "pie.fp_baked":"{crust} è ben cotta. Prossima fermata: Marte. Probabilmente l'anno prossimo.", "pie.fp_booster":"Il booster si è ribaltato all'atterraggio. Era un ribaltamento previsto. Lo chiamiamo recupero orizzontale rapido.", "pie.fp_debris":"Una piccola battaglia di cibo in {crust}. Le briciole sono segno di una costellazione in salute.", "pie.fp_dish":"La nostra prima parabola-torta è attiva. Mia mamma dice che il segnale è ottimo.", "pie.fp_fail":"Il lancio di oggi è stato un enorme successo. Il razzo ora si trova in molti posti contemporaneamente.", "pie.fp_found":"Fondata {co}. La nostra missione: torte in cielo, così ognuno ha la sua fetta.", +"pie.fp_kid":"Benvenuto al mondo, {kid}. Il piccolo {nick}, per gli amici. Papà orgoglioso.", "pie.fp_launch":"Altre {n} torte in {crust}. Audace. Visionario. In orario (stavolta).", +"pie.fp_leak":"Prossimo lancio: martedì, 6:42, rampa due, foto del carico in allegato. L'ufficio legale dice di cancellarlo. Non lo cancello.", +"pie.fp_leak_kid":"Il piccolo {nick} ha postato la data del prossimo lancio dal mio telefono. Bambini, eh. (Sono stato io.)", +"pie.fp_mars":"Marte l'anno prossimo. Pie su Marte. Prenota ora.", +"pie.fp_mars_kid":"Ho promesso al piccolo {nick} una festa di compleanno su Marte. L'anno prossimo. Sicuramente l'anno prossimo.", +"pie.fp_mars_slip":"Marte adesso è l'anno {n}. Marte è sempre stato l'anno {n}. Il pianeta rosso può aspettare.", "pie.fp_promise":"Promessa: copertura totale entro l'anno {n}. Segnatevelo.", +"pie.fp_reg":"I regolatori sono solo firewall con il badge. Fatevi sotto.", "pie.fp_rename":"Ora ci chiamiamo {co}. Il vecchio nome frenava la visione.", "pie.fp_slip":"La copertura totale ora è per l'anno {n}. È sempre stato l'anno {n}. Leggete le note a piè di pagina.", "pie.fp_spat":"Un governo ha delle domande. Adoriamo le domande. Rispondiamo a tutte, prima o poi, in un thread.", +"pie.fp_spree":"Thread 1/{n}: perché il sonno è un protocollo legacy, perché le pie sono uno stile di vita e perché i miei critici sono bot.", +"pie.fp_spree_kid":"Di nuovo le 3 di notte. Al piccolo {nick} stanno spuntando i denti, quindi ho scritto un thread. 1/{n}.", "pie.fp_storm":"Il Sole è geloso di {crust}. Tutto normale. Il meteo spaziale è meteo, solo di più.", "pie.fp_test":"Il volo di prova {n} è finito in una palla di fuoco, proprio come speravamo. Abbiamo imparato tantissimo.", "pie.fp_tour":"Faccio un passo indietro dal Tier 1 per un tour dell'ascolto. Parlerò soprattutto io.", "pie.half_baked":"Mezza cruda", "pie.heavy_tests":"Voli di prova fatti: {n} di {max}. I primi esplodono sempre.", "pie.ins_off":"Assicurazione: no", -"pie.ins_on":"Assicurazione: sì (8%)", +"pie.ins_on_p":"Assicurazione: sì ({p})", "pie.landing_rights":"Diritti di atterraggio", "pie.las_off":"Laser: no", "pie.las_on":"Laser: sì (+$0.5M a torta)", @@ -3512,6 +3522,22 @@ "pie.why_queue_full":"Il calendario dei lanci è pieno.", "pie.why_stock":"Servono {n} torte; la fabbrica ne ha {have}.", "pie.would_have":"Sarebbe costato", +"pie_ant.backup":"La fatturazione orbitale è stata ripristinata dal backup. Le fatture ripartono.", +"pie_ant.bill_paused":"La fatturazione orbitale è ferma fino al {d}: il database si sta ancora strozzando con {kid}.", +"pie_ant.gasp":"Ooooh. Uuuuuh.", +"pie_ant.jit_calm":"Nervosismo del mercato: 😌 calmo", +"pie_ant.jit_high":"😬 alto", +"pie_ant.jit_line":{"one":"Nervosismo del mercato: {lvl}, si calma tra ~{n} giorno","other":"Nervosismo del mercato: {lvl}, si calma tra ~{n} giorni"}, +"pie_ant.jit_low":"🙂 basso", +"pie_ant.jit_mid":"😟 agitato", +"pie_ant.kid":"Il Fondatore ha chiamato suo figlio {kid}. Il database della fatturazione ha letto l'annuncio della nascita e si è strozzato: per {n} giorni non parte nessuna fattura orbitale.", +"pie_ant.leak":"Il Fondatore ha postato la data del prossimo lancio, la rampa e una foto del carico. Gli assicuratori non ridono: l'assicurazione costa {p} per {n} giorni.", +"pie_ant.mars":"Il Fondatore ha promesso Marte entro l'anno prossimo. Le vendite orbitali sono euforiche per {n} giorni; nessuno chiede cosa succede l'anno prossimo.", +"pie_ant.mars_slip":{"one":"Marte slitta di un altro anno. {n} cliente orbitale ha disdetto in silenzio.","other":"Marte slitta di un altro anno. {n} clienti orbitali hanno disdetto in silenzio."}, +"pie_ant.mars_slip_none":"Marte slitta di un altro anno. I clienti orbitali alzano gli occhi al cielo.", +"pie_ant.reg":"Il Fondatore ha dato del protocollo legacy a un regolatore, in diretta. Il regolatore ha risposto, per iscritto.", +"pie_ant.reg_none":"Il Fondatore ha dato del protocollo legacy a un regolatore, in diretta. Tutti aspettano la risposta.", +"pie_ant.spree":"Il Fondatore ha postato {n} volte tra le 3 e le 4 di notte. I clienti orbitali sono nervosi: meno chiamate e clienti più scontrosi per {d} giorni.", "pie_globe.switch_to_day_view":"Passa alla vista diurna", "pie_globe.switch_to_night_view":"Passa alla vista notturna", "pie_globe.your_pies_in_orbit":"Le tue torte in orbita, trascina per girare la Terra", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 007658f..1db0fd0 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -3422,24 +3422,34 @@ "pie.founder_feed":"Os posts do Fundador", "pie.fp_3am":"Postando às 3 da manhã porque dormir é um protocolo legado. Nossas tortas estão 40% mais gostosas que no último trimestre.", "pie.fp_astro":"Astrônomos dizem que nossas tortas aparecem de penetra nos telescópios. Já tentaram olhar entre elas?", +"pie.fp_backup":"A faturação voltou do backup da terça passada. O pequeno {nick} está de castigo até aprender o que são prepared statements.", "pie.fp_baked":"{crust} está bem assada. Próxima parada: Marte. Provavelmente no ano que vem.", "pie.fp_booster":"O propulsor tombou no pouso. Foi um tombo planejado. Chamamos de recuperação horizontal rápida.", "pie.fp_debris":"Uma pequena guerra de comida em {crust}. Migalhas são sinal de uma constelação saudável.", "pie.fp_dish":"Nossa primeira antena-torta está no ar. Minha mãe disse que o sinal está ótimo.", "pie.fp_fail":"O lançamento de hoje foi um enorme sucesso. O foguete agora está em vários lugares ao mesmo tempo.", "pie.fp_found":"Fundei a {co}. Nossa missão: tortas no céu para todo mundo ganhar uma fatia.", +"pie.fp_kid":"Bem-vindo ao mundo, {kid}. O pequeno {nick}, para encurtar. Pai orgulhoso.", "pie.fp_launch":"Mais {n} tortas em {crust}. Ousado. Visionário. No prazo (desta vez).", +"pie.fp_leak":"Próximo lançamento: terça, 6:42, plataforma dois, foto da carga em anexo. O jurídico diz para apagar. Não vou apagar.", +"pie.fp_leak_kid":"O pequeno {nick} publicou a data do próximo lançamento no meu telemóvel. Crianças, né. (Fui eu.)", +"pie.fp_mars":"Marte no ano que vem. Pies em Marte. Reserve já.", +"pie.fp_mars_kid":"Prometi ao pequeno {nick} uma festa de aniversário em Marte. No ano que vem. De certeza no ano que vem.", +"pie.fp_mars_slip":"Marte agora é o ano {n}. Marte sempre foi o ano {n}. O planeta vermelho pode esperar.", "pie.fp_promise":"Promessa: cobertura total até o ano {n}. Anotem.", +"pie.fp_reg":"Reguladores são só firewalls com crachá. Venham.", "pie.fp_rename":"Agora somos a {co}. O nome antigo segurava a visão.", "pie.fp_slip":"A cobertura total agora é no ano {n}. Sempre foi o ano {n}. Leiam as notas de rodapé.", "pie.fp_spat":"Algum governo tem perguntas. Adoramos perguntas. Respondemos todas, um dia, numa thread.", +"pie.fp_spree":"Fio 1/{n}: porque dormir é um protocolo legado, porque pies são um estilo de vida e porque os meus críticos são bots.", +"pie.fp_spree_kid":"Outra vez 3 da manhã. O pequeno {nick} está com os dentes a nascer, então escrevi um fio. 1/{n}.", "pie.fp_storm":"O Sol está com inveja de {crust}. Totalmente normal. Clima espacial é clima, só que mais.", "pie.fp_test":"O voo de teste {n} terminou numa bola de fogo, exatamente como esperávamos. Aprendemos muito.", "pie.fp_tour":"Vou me afastar do Tier 1 para uma turnê de escuta. Quem vai falar sou eu, principalmente.", "pie.half_baked":"Meio crua", "pie.heavy_tests":"Voos de teste feitos: {n} de {max}. Os primeiros sempre explodem.", "pie.ins_off":"Seguro: não", -"pie.ins_on":"Seguro: sim (8%)", +"pie.ins_on_p":"Seguro: sim ({p})", "pie.landing_rights":"Direitos de pouso", "pie.las_off":"Lasers: não", "pie.las_on":"Lasers: sim (+$0.5M por torta)", @@ -3512,6 +3522,22 @@ "pie.why_queue_full":"O calendário de lançamentos está cheio.", "pie.why_stock":"Precisa de {n} tortas; a fábrica tem {have}.", "pie.would_have":"Teria custado", +"pie_ant.backup":"A faturação orbital foi restaurada do backup. As faturas voltam a sair.", +"pie_ant.bill_paused":"A faturação orbital está em baixo até {d}: a base de dados ainda se engasga com {kid}.", +"pie_ant.gasp":"Ooooh. Uuuuuh.", +"pie_ant.jit_calm":"Nervosismo do mercado: 😌 calmo", +"pie_ant.jit_high":"😬 alto", +"pie_ant.jit_line":{"one":"Nervosismo do mercado: {lvl}, acalma em ~{n} dia","other":"Nervosismo do mercado: {lvl}, acalma em ~{n} dias"}, +"pie_ant.jit_low":"🙂 baixo", +"pie_ant.jit_mid":"😟 agitado", +"pie_ant.kid":"O Fundador deu ao filho o nome {kid}. A base de dados da faturação leu o anúncio do nascimento e engasgou-se: durante {n} dias não sai nenhuma fatura orbital.", +"pie_ant.leak":"O Fundador publicou a data do próximo lançamento, a plataforma e uma foto da carga. As seguradoras não acharam graça: o seguro custa {p} durante {n} dias.", +"pie_ant.mars":"O Fundador prometeu Marte até ao ano que vem. As vendas orbitais andam eufóricas durante {n} dias; ninguém pergunta o que acontece no ano que vem.", +"pie_ant.mars_slip":{"one":"Marte escorregou mais um ano. {n} cliente orbital cancelou em silêncio.","other":"Marte escorregou mais um ano. {n} clientes orbitais cancelaram em silêncio."}, +"pie_ant.mars_slip_none":"Marte escorregou mais um ano. Os clientes orbitais reviram os olhos.", +"pie_ant.reg":"O Fundador chamou protocolo legado a um regulador, em direto. O regulador respondeu, por escrito.", +"pie_ant.reg_none":"O Fundador chamou protocolo legado a um regulador, em direto. Todos esperam a resposta.", +"pie_ant.spree":"O Fundador publicou {n} vezes entre as 3 e as 4 da manhã. Os clientes orbitais estão nervosos: menos chamadas e clientes mais rabugentos durante {d} dias.", "pie_globe.switch_to_day_view":"Mudar para a visão diurna", "pie_globe.switch_to_night_view":"Mudar para a visão noturna", "pie_globe.your_pies_in_orbit":"Suas tortas em órbita, arraste para girar a Terra", diff --git a/src/agent/30-docs.js b/src/agent/30-docs.js index 8874bf1..d37b6e3 100644 --- a/src/agent/30-docs.js +++ b/src/agent/30-docs.js @@ -53,7 +53,7 @@ const API_STATE_DOC={ scrubMode:{type:'string',doc:'always | ondemand.'}, cnLic:{type:'map',doc:'Mainland China licence: none | pending (with ready day) | ok.'}, pieV:{type:'number',doc:'Pie in the Sky version stamp: 1 in games started since it shipped (only those unlock it, on a Tier 1 win).'}, - pie:{type:'map',doc:'The rocket company (Pie in the Sky), or null: company, factory, stock, pads, crusts (cohorts of pies by launch day), dishes, landing rights (lic), launch queue (q), R&D, spats, founder posts, books, and government money (gov: auctions, awards, Ex-Im).'}, + pie:{type:'map',doc:'The rocket company (Pie in the Sky), or null: company, factory, stock, pads, crusts (cohorts of pies by launch day), dishes, landing rights (lic), launch queue (q), R&D, spats, the founder (posts, promises made and broken with their due days, and his antics: jit, the market jitters 0..1 that fade over 30 days and lower orbit offer odds and happiness; next, the day of the next antic; kid, 1 + the index of PIE_KIDS once he has named his son; bill, the day orbit billing comes back (no orbit income until then); nerv, hype, leak: days a posting spree, Mars hype and a leaked launch date (dearer launch insurance) last until; mars, the due day of the Mars promise, whose slip loses a few orbit customers; all only with chaos on), books, and government money (gov: auctions, awards, Ex-Im).'}, ppol:{type:'string',doc:'Your published peering policy: open | selective | closed.'}, pdesk:{type:'map',doc:'This week\'s peering desk summary: sessions accepted and declined at which exchanges.'}, pdeskRep:{type:'map',doc:'Last week\'s peering desk summary, as the NOC log reported it.'}, @@ -95,7 +95,7 @@ const API_STATE_DOC={ }; const API_RESULTS_DOC={ - pie:{type:'map',doc:'Orbit this compute (only with a rocket company): revenue (rev, including patchy: {mo, cr} from patchy-sky customers who pay from 10% coverage, before a crust carries anything, and fade out between 40% and 60%), service per orbit customer, landing dishes, flows through the sky, backhaul for cut-off POPs (bh), crust and dish load, government money (gov).'}, + pie:{type:'map',doc:'Orbit this compute (only with a rocket company): revenue (rev; 0 while the founder has orbit billing down, with billOff what it would have been; including patchy: {mo, cr} from patchy-sky customers who pay from 10% coverage, before a crust carries anything, and fade out between 40% and 60%), service per orbit customer, landing dishes, flows through the sky, backhaul for cut-off POPs (bh), crust and dish load, government money (gov).'}, nt:{type:'map',doc:'Traffic per network through transit, by net id.'}, tNet:{type:'map',doc:'Traffic per network you hand to each upstream, by "net@upstream".'}, reachNT:{type:'number',doc:'Networks reachable without transit.'}, diff --git a/src/game/60-features/99-pie-in-the-sky.js b/src/game/60-features/99-pie-in-the-sky.js index d2253f4..4dfe8ec 100644 --- a/src/game/60-features/99-pie-in-the-sky.js +++ b/src/game/60-features/99-pie-in-the-sky.js @@ -18,7 +18,7 @@ - book.earned: revenue from orbit, for the customers that come with routing. */ function pieBlank(day){const crusts={};for(const id in CRUSTS)crusts[id]={cohorts:[],queued:0}; return {born:day,co:null,fac:false,stock:0,rd:{reuse:false,heavy:false,heavyTests:0},pads:[],crusts,dishes:[],lic:{},q:[], - founder:{posts:[],promises:0,broken:0,due:[]},book:{spent:0,earned:0,wouldHave:0},spat:{},safe:false,gov:pieGovBlank()};} + founder:{posts:[],promises:0,broken:0,due:[],jit:0,next:0,kid:0,bill:0,nerv:0,hype:0,leak:0,mars:0},book:{spent:0,earned:0,wouldHave:0},spat:{},safe:false,gov:pieGovBlank()};} function pieInit(){if(!S.pie)S.pie=pieBlank(S.day);return S.pie;} // The unlock: only on the Tier 1 transition of a save of this version, and only in a normal game. function pieUnlock(){if(S.pie||!(S.pieV>=1)||S.mode!=='normal'||S.scn)return;pieInit();track('pie_unlock'); @@ -50,8 +50,8 @@ function pieSpatDay(d){const sp=S.pie.spat;for(const k of Object.keys(sp)){const const pieYear=d=>1+Math.floor(d/360); function pieFounder(k,v={}){const F=S.pie.founder,p={d:S.day,k};if(v.n!==undefined)p.n=v.n;if(v.c)p.c=v.c;F.posts.unshift(p);if(F.posts.length>PIE_POSTS)F.posts.length=PIE_POSTS;} // Every promise slips by a year: made today, due in a year, broken then. -function piePromise(){const F=S.pie.founder;F.promises++;const due=S.day+360;F.due.push(due);if(F.due.length>8)F.due.shift();pieFounder(N_('pie.fp_promise'),{n:pieYear(due)});} -function pieFpText(p){const C=own(CRUSTS,p.c||'')?tr(CRUSTS[p.c].n):'',n=p.n||0;return tr(p.k,{co:pieCoName(),n,crust:C});} +function piePromise(k=N_('pie.fp_promise')){const F=S.pie.founder;F.promises++;const due=S.day+360;F.due.push(due);if(F.due.length>8)F.due.shift();pieFounder(k,{n:pieYear(due)});return due;} +function pieFpText(p){const C=own(CRUSTS,p.c||'')?tr(CRUSTS[p.c].n):'',n=p.n||0,K=pieKid();return tr(p.k,{co:pieCoName(),n,crust:C,kid:K?K.n:'',nick:K?K.k:''});} // Pads that can reach a crust: an orbit's inclination is at least the pad's latitude. const piePadOk=(c,cr)=>CRUSTS[cr].polar||Math.abs(CITY[c].lat)<=CRUSTS[cr].inc; const pieRkOk=rk=>{const R0=ROCKETS[rk];return !R0.rd||!!S.pie.rd[R0.rd];}; @@ -68,7 +68,7 @@ function pieQuote(rk,cr,o={}){const P=S.pie;if(!P||!own(ROCKETS,rk)||!own(CRUSTS if(!test&&pieLive(cr)+P.crusts[cr].queued+n>C.full*PIE_SPARE)return {why:tr('pie.why_full')}; const t0=S.day+leadDays(PIE_PREP),pad=pads.slice().sort((a,b)=>Math.max(t0,a.next)-Math.max(t0,b.next)||Math.abs(CITY[a.city].lat)-Math.abs(CITY[b.city].lat))[0]; const rocket=piePrice(R0.cost)*(1-pieEq(pad.city))*pieCrMul(cr),boost=rk==='again'&&!pad.boosters.length?piePrice(PIE_BOOST):0,pies=n*piePrice(PIE_PIE+(o.las?PIE_LAS:0)); - const ins=o.ins&&!test?Math.round((rocket+pies)*PIE_INS):0; + const ins=o.ins&&!test?Math.round((rocket+pies)*PIE_INS*pieInsMul()):0; return {ok:true,test,n,pad:pad.city,day:Math.max(t0,pad.next),cost:Math.round(rocket+boost+pies+ins),insured:Math.round(rocket+pies),ins:!!ins};} // The cheapest a crust can be filled from nothing (one-off costs only): rule O7. function pieFullCost(cr){const C=CRUSTS[cr],base=PIE_CO+PIE_FAC+PIE_PAD,pies=C.full*PIE_PIE; @@ -112,7 +112,7 @@ function pieDay(d){const P=S.pie;if(!P)return; if(P.q.length){const due=P.q.filter(L=>L.day<=d);if(due.length){P.q=P.q.filter(L=>L.day>d);for(const L of due)pieFly(L);}} for(const id in CRUSTS){const c=P.crusts[id],life=CRUSTS[id].life;if(c.cohorts.length&&d-c.cohorts[0].day>=life)c.cohorts=c.cohorts.filter(k=>d-k.dayob(x)&&FOUNDER_POSTS.includes(x.k)).slice(0,PIE_POSTS).map(x=>{const q={d:int(x.d,0,day,day),k:x.k};if(x.n!==undefined)q.n=n(x.n,1e7);if(own(CRUSTS,x.c||''))q.c=x.c;return q;}); - o.founder.due=(Array.isArray(F.due)?F.due:[]).map(v=>int(v,0,day+720,day)).sort((a,b)=>a-b).slice(-8);} + o.founder.due=(Array.isArray(F.due)?F.due:[]).map(v=>int(v,0,day+720,day)).sort((a,b)=>a-b).slice(-8);pieAnticFix(o.founder,F,day);} if(ob(p.book))for(const k of ['spent','earned','wouldHave'])o.book[k]=m(p.book[k],1e15); if(ob(p.spat))for(const k of Object.keys(p.spat)){const D=PIE_SPATS[k];if(!D||!ob(p.spat[k]))continue;const v=D.fix?D.fix(p.spat[k],s):null;if(v)o.spat[k]=v;} o.gov=pieGovFix(p.gov,s); diff --git a/src/game/60-features/99-pie-jitters.js b/src/game/60-features/99-pie-jitters.js new file mode 100644 index 0000000..79d6a4e --- /dev/null +++ b/src/game/60-features/99-pie-jitters.js @@ -0,0 +1,68 @@ +/* ---------- Pie in the Sky: the Founder's antics and the market's jitters (docs/plans/pie-in-the-sky.md) ---------- + Every 60 to 120 days while a rocket company exists, the Founder does something daft: a post, a gasp (a toast) and a + real effect that wears off. Each antic also bumps the market's jitters (S.pie.founder.jit, 0..1), which fade to nothing + over PIE_JIT_DAYS and meanwhile make orbit customers call less and keep the happiest a little less happy (at most + PIE_JIT_CAP under 100, never low enough to cancel over it): Ooooh, Uuuuuh, then it normalises. + Rule O5: the harm needs pieChaos() (chaos on, the 90 quiet days over); without it he still posts and nothing else + happens. Dice are rolled only with a company (pieAnticDay returns first), so every other game plays as before. + State in S.pie.founder (pieBlank, pieSanitize): jit; next, the day of the next antic (0: not planned yet); kid, 1 + an + index of PIE_KIDS (once a game, then a running gag); bill, the day orbit billing is back; nerv, hype, leak: the days + those last until; mars, the due day (in due) of the Mars promise, whose slip costs a few orbit customers. */ +const PIE_ANTIC_FIRST=90,PIE_ANTIC_GAP=60,PIE_ANTIC_SPAN=61,PIE_JIT_DAYS=30,PIE_JIT_OFFER=0.3,PIE_JIT_CAP=25, + PIE_KID_DAYS=3,PIE_SPREE_DAYS=14,PIE_NERV=0.6,PIE_SPREE_MOOD=4,PIE_LEAK_DAYS=30,PIE_LEAK_INS=1.75,PIE_HYPE_DAYS=14,PIE_HYPE=1.5,PIE_MARS_CHURN=0.02; +// The kid's name (code, not words: never translated) and what the feed calls him afterwards. +const PIE_KIDS=[{n:"Orbit'); DROP TABLE invoices;--",k:'Orby Tables'},{n:"Perigee'); DELETE FROM billing;--",k:'Perry Tables'},{n:"Max Q'); TRUNCATE customers;--",k:'Maxie Tables'}]; +FOUNDER_POSTS.push(N_('pie.fp_backup'),N_('pie.fp_kid'),N_('pie.fp_leak'),N_('pie.fp_leak_kid'),N_('pie.fp_mars'),N_('pie.fp_mars_kid'),N_('pie.fp_mars_slip'),N_('pie.fp_reg'),N_('pie.fp_spree'),N_('pie.fp_spree_kid')); +const pieKid=()=>{const F=S&&S.pie&&S.pie.founder;return F&&F.kid?PIE_KIDS[F.kid-1]:null;}; +const pieBump=(F,v)=>{F.jit=Math.min(1,+(F.jit+v).toFixed(4));}; +const pieOrbitBiz=()=>S.biz.filter(b=>BIZ_T[b.type].orbit); +// Read by pieMoney() (no orbit income while billing is down), pieQuote() (insurance) and the orbit sales desk (offers). +function pieBillOff(){const P=S&&S.pie;return !!P&&P.founder.bill>S.day&&pieChaos();} +function pieInsMul(){const P=S&&S.pie;return P&&P.founder.leak>S.day&&pieChaos()?PIE_LEAK_INS:1;} +function pieOfferMul(){const P=S.pie;if(!P||!pieChaos())return 1;const F=P.founder;let m=1-PIE_JIT_OFFER*F.jit;if(F.nerv>S.day)m*=PIE_NERV;if(F.hype>S.day)m*=PIE_HYPE;return m;} +// The antics: w their weight, ok(F) whether he can, go(F,harm,d) posts and, with harm, does it and returns the toast's text; +// j: how much it rattles the market. +const PIE_ANTICS={ + kid:{w:1.5,j:0.7,ok:F=>!F.kid,go:(F,h,d)=>{F.kid=1+Math.floor(Math.random()*PIE_KIDS.length);pieFounder(N_('pie.fp_kid'));if(!h)return ''; + const n=rint(PIE_KID_DAYS,3);F.bill=d+n+1;return tr('pie_ant.kid',{kid:esc(pieKid().n),n});}}, + spree:{w:3,j:0.6,ok:()=>true,go:(F,h,d)=>{const n=rint(40,50);pieFounder(F.kid?N_('pie.fp_spree_kid'):N_('pie.fp_spree'),{n});if(!h)return ''; + F.nerv=d+PIE_SPREE_DAYS;pieMood(b=>!!BIZ_T[b.type].orbit,-PIE_SPREE_MOOD);return tr('pie_ant.spree',{n,d:PIE_SPREE_DAYS});}}, + reg:{w:1,j:0.4,ok:()=>true,go:(F,h)=>{pieFounder(N_('pie.fp_reg'));if(!h)return '';const P=S.pie; + // A country where you have a dish or landing rights, through the spats' own machinery (pieSpatStart). + if(Object.keys(P.spat).lengthtrue,go:(F,h,d)=>{pieFounder(F.kid?N_('pie.fp_leak_kid'):N_('pie.fp_leak'));if(!h)return ''; + F.leak=d+PIE_LEAK_DAYS;return tr('pie_ant.leak',{p:pct(PIE_INS*PIE_LEAK_INS),n:PIE_LEAK_DAYS});}}, + mars:{w:2,j:0.3,ok:F=>!F.mars,go:(F,h,d)=>{F.mars=piePromise(F.kid?N_('pie.fp_mars_kid'):N_('pie.fp_mars'));if(!h)return ''; + F.hype=d+PIE_HYPE_DAYS;return tr('pie_ant.mars',{n:PIE_HYPE_DAYS});}}, +}; +const PIE_ANTIC_KEYS=Object.keys(PIE_ANTICS); +// One antic (k forces which, for tests); true when he did something. +function pieAntic(k){const P=S.pie;if(!P||!P.co)return false;const F=P.founder,d=S.day,h=pieChaos(); + if(!k){const o=PIE_ANTIC_KEYS.filter(x=>PIE_ANTICS[x].ok(F));let r=Math.random()*o.reduce((a,x)=>a+PIE_ANTICS[x].w,0);k=o[o.length-1];for(const x of o){r-=PIE_ANTICS[x].w;if(r<=0){k=x;break;}}} + const A=PIE_ANTICS[k];if(!A||!A.ok(F))return false;S.stats.pieAnt=(S.stats.pieAnt||0)+1; + const b=A.go(F,h,d);if(!h)return true; + pieBump(F,A.j);toast(`😱 ${tr('pie_ant.gasp')}
${b}`,'bad');sfx('alert');return true;} +// The Mars promise slipped (pieDay, when its due day comes): the unhappiest few orbit customers had enough. +function pieMarsSlip(d){const F=S.pie.founder;F.mars=0;pieFounder(N_('pie.fp_mars_slip'),{n:pieYear(d+360)});if(!pieChaos())return;pieBump(F,PIE_ANTICS.mars.j); + const bs=pieOrbitBiz().sort((a,b)=>a.mood-b.mood),n=Math.round(bs.length*PIE_MARS_CHURN); + if(n){const go=new Set(bs.slice(0,n));S.biz=S.biz.filter(b=>!go.has(b));S.stats.pieChurn=(S.stats.pieChurn||0)+n;} + toast(`😱 ${tr('pie_ant.gasp')}
${n?trn('pie_ant.mars_slip',n):tr('pie_ant.mars_slip_none')}`,'bad');} +function pieAnticDay(d){const P=S.pie,F=P.founder;if(!P.co)return; + if(F.bill&&d>=F.bill-1){F.bill=0;pieFounder(N_('pie.fp_backup'));if(pieChaos())toast(tr('pie_ant.backup'),'good');} + if(F.mars&&!F.due.includes(F.mars))F.mars=0; + if(F.jit>0){if(pieChaos()){const top=100-PIE_JIT_CAP*F.jit;for(const b of S.biz)if(BIZ_T[b.type].orbit&&b.mood>top)b.mood=top;}const j=+(F.jit-1/PIE_JIT_DAYS).toFixed(4);F.jit=j<0.005?0:j;} + if(!F.next)F.next=d+PIE_ANTIC_FIRST;else if(d>=F.next){F.next=d+rint(PIE_ANTIC_GAP,PIE_ANTIC_SPAN);pieAntic();}} +PIE_ON.day.push(pieAnticDay); +// sanitize: the antics' part of S.pie.founder (o: the repaired founder, F: the saved one). +function pieAnticFix(o,F,day){const n=(v,hi)=>int(v,0,hi,0);o.jit=clamp(num(F.jit,0),0,1);o.next=n(F.next,day+PIE_ANTIC_FIRST+PIE_ANTIC_GAP+PIE_ANTIC_SPAN);o.kid=n(F.kid,PIE_KIDS.length); + o.bill=n(F.bill,day+PIE_KID_DAYS+3);if(o.bill<=day)o.bill=0;o.nerv=n(F.nerv,day+PIE_SPREE_DAYS);o.hype=n(F.hype,day+PIE_HYPE_DAYS);o.leak=n(F.leak,day+PIE_LEAK_DAYS); + o.mars=n(F.mars,day+720);if(!o.due.includes(o.mars))o.mars=0;} +// The Company tab, next to the feed: how jumpy the market is and how long until it calms down. +function pieJitHtml(F){const j=F.jit||0,K=pieKid();let h=''; + if(!(j>0))h=`

${tr('pie_ant.jit_calm')}

`; + else{const l=j>=0.6?tr('pie_ant.jit_high'):j>=0.3?tr('pie_ant.jit_mid'):tr('pie_ant.jit_low'); + h=`

${trn('pie_ant.jit_line',Math.ceil(j*PIE_JIT_DAYS),{lvl:l})}

`;} + if(pieBillOff())h+=`

${tr('pie_ant.bill_paused',{d:dateStr(F.bill),kid:esc(K?K.n:'')})}

`; + return h;} diff --git a/src/game/60-features/99-pie-orbit-customers.js b/src/game/60-features/99-pie-orbit-customers.js index 22b8f5d..53e4883 100644 --- a/src/game/60-features/99-pie-orbit-customers.js +++ b/src/game/60-features/99-pie-orbit-customers.js @@ -32,4 +32,4 @@ function pieSpawn(t){const T=BIZ_T[t],min=T.opts[0],ok=pieCands(t).filter(c=>{if const PIE_OPEN_DAYS=30,PIE_OPEN_OFFERS=4; function pieOpening(){const P=S.pie;let on=false;for(const id of pieHubs()){const c=P.crusts[id];if(!c)continue;if(c.open===undefined&&pieCap(id)>0)c.open=S.day;if(c.open!==undefined&&S.day-c.open{const op=pieOpening();if(S.offers.filter(o=>BIZ_T[o.type].orbit).length>=(op?PIE_OPEN_OFFERS:PIE_OFFERS))return;const t=pieOfferTypes();if(t.length&&(op||Math.random(){const op=pieOpening();if(S.offers.filter(o=>BIZ_T[o.type].orbit).length>=(op?PIE_OPEN_OFFERS:PIE_OFFERS))return;const t=pieOfferTypes();if(t.length&&(op||Math.random()${tr('pie.pace_pad_none')}

`;} return x;})()}
${Object.keys(ROCKETS).filter(pieRkOk).map(rk=>{const q=pieQuote(rk,id,{ins:!!UI.pieIns,las:!!UI.pieLas});return btn(`${tr(ROCKETS[rk].n)} ${q.ok?(q.test?tr('pie.test_flight')+' · ':'')+fmt$(q.cost):esc(q.why)}`,'pieLaunch',{rk,cr:id},'ghost sm',!q.ok);}).join('')}
`;}).join(''); - h+=`
${btn(UI.pieIns?tr('pie.ins_on'):tr('pie.ins_off'),'pieIns',{},UI.pieIns?'green sm':'ghost sm')}${btn(UI.pieLas?tr('pie.las_on'):tr('pie.las_off'),'pieLas',{},UI.pieLas?'green sm':'ghost sm')}
`; + h+=`
${btn(UI.pieIns?tr('pie.ins_on_p',{p:pct(PIE_INS*pieInsMul())}):tr('pie.ins_off'),'pieIns',{},UI.pieIns?'green sm':'ghost sm')}${btn(UI.pieLas?tr('pie.las_on'):tr('pie.las_off'),'pieLas',{},UI.pieLas?'green sm':'ghost sm')}
`; h+=`

${tr('pie.stock_line',{n:Math.floor(P.stock)})}

`; if(P.q.length)h+=`

${tr('pie.queue')}

`+P.q.slice().sort((a,b)=>a.day-b.day).map(L=>`
${esc(tr(ROCKETS[L.rk].n))} → ${esc(tr(CRUSTS[L.cr].n))}${L.test?tr('pie.test_flight'):L.n} · ${esc(CITY[L.pad].name)} · ${dateStr(L.day)}
`).join(''); }else if(T==='dish'){ @@ -61,6 +61,6 @@ function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pi 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})}
` + return `

${tr('pie.founder_feed')}

${tr('pie.promises')}${tr('pie.promises_line',{n:F.promises,b:F.broken})}
`+pieJitHtml(F) +(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/i18n/en.js b/src/i18n/en.js index 98d9496..7f946fa 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -3423,24 +3423,34 @@ "pie.founder_feed":"The Founder posts", "pie.fp_3am":"Posting at 3 a.m. because sleep is a legacy protocol. Our pies are 40% more delicious than last quarter.", "pie.fp_astro":"Astronomers say our pies photobomb their telescopes. Have they tried looking between them?", +"pie.fp_backup":"Billing is back from last Tuesday's backup. Little {nick} is grounded until he learns about prepared statements.", "pie.fp_baked":"{crust} is fully baked. Next stop: Mars. Probably next year.", "pie.fp_booster":"The booster tipped over on landing. It was a planned tip. We call it a rapid horizontal recovery.", "pie.fp_debris":"A minor food fight in {crust}. Crumbs are a sign of a healthy constellation.", "pie.fp_dish":"Our first pie dish is up. My mum says the signal is great.", "pie.fp_fail":"Today's launch was a huge success. The rocket is now in many places at once.", "pie.fp_found":"Founded {co}. Our mission: put pies in the sky so everyone gets a slice.", +"pie.fp_kid":"Welcome to the world, {kid}. Little {nick} for short. Proud dad.", "pie.fp_launch":"{n} more pies in {crust}. Bold. Visionary. On schedule (this one).", +"pie.fp_leak":"Next launch: Tuesday, 6:42, pad two, payload photo attached. Legal says delete this. Not deleting this.", +"pie.fp_leak_kid":"Little {nick} posted the next launch date from my phone. Kids, eh. (It was me.)", +"pie.fp_mars":"Mars next year. Pies on Mars. Book now.", +"pie.fp_mars_kid":"Promised little {nick} a birthday party on Mars. Next year. Definitely next year.", +"pie.fp_mars_slip":"Mars is now year {n}. Mars was always year {n}. The red planet can wait.", "pie.fp_promise":"Promise: full coverage by year {n}. Write it down.", +"pie.fp_reg":"Regulators are just firewalls with lanyards. Come at me.", "pie.fp_rename":"We are {co} now. The old name was holding back the vision.", "pie.fp_slip":"Full coverage is now year {n}. It was always year {n}. Read the footnotes.", "pie.fp_spat":"Some government has questions. We love questions. We answer them all, eventually, in a thread.", +"pie.fp_spree":"Thread 1/{n}: why sleep is a legacy protocol, why pies are a lifestyle, and why my critics are bots.", +"pie.fp_spree_kid":"3 a.m. again. Little {nick} is teething, so I wrote a thread. 1/{n}.", "pie.fp_storm":"The Sun is jealous of {crust}. Totally normal. Space weather is just weather, but more.", "pie.fp_test":"Test flight {n} ended in a fireball, exactly as we hoped. We learned so much.", "pie.fp_tour":"Stepping back from Tier 1 to go on a listening tour. Mostly I will be talking.", "pie.half_baked":"Half-baked", "pie.heavy_tests":"Test flights flown: {n} of {max}. The first ones always explode.", "pie.ins_off":"Insurance: off", -"pie.ins_on":"Insurance: on (8%)", +"pie.ins_on_p":"Insurance: on ({p})", "pie.landing_rights":"Landing rights", "pie.las_off":"Lasers: off", "pie.las_on":"Lasers: on (+$0.5M a pie)", @@ -3513,6 +3523,22 @@ "pie.why_queue_full":"The launch schedule is full.", "pie.why_stock":"Needs {n} pies; the factory has {have}.", "pie.would_have":"Would have cost", +"pie_ant.backup":"Orbit billing is restored from backup. Invoices are going out again.", +"pie_ant.bill_paused":"Orbit billing is down until {d}: the database is still choking on {kid}.", +"pie_ant.gasp":"Ooooh. Uuuuuh.", +"pie_ant.jit_calm":"Market jitters: 😌 calm", +"pie_ant.jit_high":"😬 high", +"pie_ant.jit_line":{"one":"Market jitters: {lvl}, calming down in ~{n} day","other":"Market jitters: {lvl}, calming down in ~{n} days"}, +"pie_ant.jit_low":"🙂 low", +"pie_ant.jit_mid":"😟 nervous", +"pie_ant.kid":"The Founder named his son {kid}. The billing database read the birth announcement and choked: no orbit invoices go out for {n} days.", +"pie_ant.leak":"The Founder posted the next launch date, the pad and a photo of the payload. Launch insurers are not amused: insurance costs {p} for {n} days.", +"pie_ant.mars":"The Founder promised Mars by next year. Orbit sales are giddy for {n} days; nobody asks what happens next year.", +"pie_ant.mars_slip":{"one":"Mars slipped another year. {n} orbit customer quietly cancelled.","other":"Mars slipped another year. {n} orbit customers quietly cancelled."}, +"pie_ant.mars_slip_none":"Mars slipped another year. Orbit customers roll their eyes.", +"pie_ant.reg":"The Founder called a regulator a legacy protocol, live on air. The regulator has replied, in writing.", +"pie_ant.reg_none":"The Founder called a regulator a legacy protocol, live on air. Everyone is waiting for the reply.", +"pie_ant.spree":"The Founder posted {n} times between 3 and 4 a.m. Orbit customers are nervous: fewer calls and grumpier customers for {d} days.", "pie_globe.switch_to_day_view":"Switch to day view", "pie_globe.switch_to_night_view":"Switch to night view", "pie_globe.your_pies_in_orbit":"Your pies in orbit, drag to turn the Earth", diff --git a/src/styles/36-ops.css b/src/styles/36-ops.css index d4ebf86..fcd9486 100644 --- a/src/styles/36-ops.css +++ b/src/styles/36-ops.css @@ -18,6 +18,8 @@ .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} +.pie-jit{margin:6px 0 2px;overflow-wrap:anywhere} +.pie-jit-bar{margin-bottom:6px} /* 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} diff --git a/tests/pie-balance.test.js b/tests/pie-balance.test.js index 3897434..05f4c39 100644 --- a/tests/pie-balance.test.js +++ b/tests/pie-balance.test.js @@ -24,7 +24,7 @@ const YEARS = +(process.env.PIE_BALANCE_YEARS || 0); // With gov (the second test), the same player also takes government money: asks 50% in every Rural Digital Pie Fund // auction, takes the Ex-Im Pie Bank's loan and keeps a dish in its country (the covenant). // compute() runs every 30 days and whenever what the sky carries changes (coverage in 10% steps, hubs, lasers, -// safe mode, an orbit incident or spat starting or ending); orbit income is booked from the last one, as in the game. +// safe mode, an orbit incident or spat starting or ending, orbit billing going down or coming back); orbit income is booked from the last one, as in the game. function sim(days, stop = false, seed = 7, gov = false) { const g = load({ seed }); const save = fs.readFileSync(path.join(__dirname, 'fixtures', 'big-network.json'), 'utf8'); @@ -46,7 +46,7 @@ function sim(days, stop = false, seed = 7, gov = false) { if(window.__gov){const G=P.gov;for(const a of G.auc)if(a.bid!==0.5)ACT.pieBid({id:a.id,f:0.5});if(G.ex)ACT.pieExim(); const l=pieEximLoan();if(l&&!pieEximDishOk(l)){const c=Object.keys(S.pops).filter(c=>CITY[c].cc===l.pie.cc&&pieCovers('short',c)&&!P.dishes.some(x=>x.city===c)).sort((a,b)=>sfOf(R,b)-sfOf(R,a))[0]; if(c){if(!pieLicOk(l.pie.cc))ACT.pieLic({cc:l.pie.cc});ACT.pieDish({city:c});}}} - const key=[pieHubs().join(),Math.round(pieCarry('short')*10),Math.round(pieCov('short')*10),pieLased('short'),P.safe,S.inc.filter(i=>PIE_INC.includes(i.type)&&i.until>S.day).map(i=>i.id).join(),Object.keys(P.spat).join(),P.gov.aw.length].join('|');if(key!==window.__key)dirty=true;window.__key=key; + const key=[pieHubs().join(),Math.round(pieCarry('short')*10),Math.round(pieCov('short')*10),pieLased('short'),P.safe,S.inc.filter(i=>PIE_INC.includes(i.type)&&i.until>S.day).map(i=>i.id).join(),Object.keys(P.spat).join(),P.gov.aw.length,P.founder.bill>S.day].join('|');if(key!==window.__key)dirty=true;window.__key=key; const real=compute;compute=()=>{if(dirty||S.day%30===0){window.__nC=(window.__nC||0)+1;real();}};try{dayTick();}finally{compute=real;}}; window.__year=()=>({y:Math.round(S.day/360),spent:S.pie.book.spent,earned:S.pie.book.earned,mo:(R.pie&&R.pie.rev)||0,cov:pieCov('short'),cust:S.biz.filter(b=>BIZ_T[b.type].orbit).length,dishes:S.pie.dishes.length,nC:window.__nC|0}); window.__gov=${gov};closeModal()`); diff --git a/tests/pie-founder.test.js b/tests/pie-founder.test.js new file mode 100644 index 0000000..1e2d422 --- /dev/null +++ b/tests/pie-founder.test.js @@ -0,0 +1,260 @@ +// The Founder's antics and the market's jitters (src/game/60-features/99-pie-jitters.js): seeded; each antic is forced +// with pieAntic(k), the clock moved with dayTick(). +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); + +// On-call with open gates: real chaos, everything buildable. Dishes in Amsterdam, Brussels, Frankfurt and Singapore, a +// baked Shortcrust, the 90 quiet days over, and 40 orbit customers in Frankfurt and Amsterdam. +const sky = (ev, o = {}) => { + ev(`beginGame('Sky','fra',{mode:'normal',preset:'oncall',rules:${JSON.stringify(Object.assign({ gates: 'open' }, o))}});if(UI.pendGame)ACT.pitchSkip();S.cash=1e12;S.nextFail=1e9;S.nextEvent=1e9;S.monkey&&(S.monkey.next=1e9)`); + ev("for(const c of ['sin','ams','bru'])ACT.buildPop({city:c});ACT.pieFound();ACT.pieFactory();ACT.piePad({city:'sin'});for(const c of ['ams','bru','fra','sin'])ACT.pieDish({city:c});for(const cc of ['NL','BE','DE','SG'])ACT.pieLic({cc})"); + ev("for(const x of S.pie.dishes)x.ant=PIE_ANT_MAX;pieCohort('short',1200,true);S.day=S.pie.born+120;compute();S.pie.stock=400"); + ev("for(const c of ['fra','ams'])ACT.buyTransit({city:c,net:'cog',tier:1});for(let i=0;i<40;i++)S.biz.push({id:'o'+i,type:'pizza',city:i%2?'fra':'ams',city2:null,bw:1,rate:BIZ_T.pizza.rate,reqs:[],latMax:null,route:'normal',name:'o'+i,mood:80,since:0,sites:null});compute()"); + // No antic of its own while a test drives them; no other orbit incidents or spats by chance. + ev('S.pie.founder.next=1e9;for(const f of [pieIncDay,pieSpatDayAll])PIE_ON.day.splice(PIE_ON.day.indexOf(f),1)'); +}; +const F = (ev) => JSON.parse(ev('JSON.stringify(S.pie.founder)')); +const days = (ev, n) => ev(`for(let i=0;i<${n};i++)dayTick()`); +const orbitMood = (ev) => ev("S.biz.filter(b=>BIZ_T[b.type].orbit).reduce((a,b)=>a+b.mood,0)/S.biz.filter(b=>BIZ_T[b.type].orbit).length"); + +test('the kid is named once: orbit billing stops for 3 to 5 days, then comes back from backup, and he is remembered', () => { + const { ev, errors } = load(); + sky(ev); + const rev = ev('R.pie.rev'); + assert.ok(rev > 0, 'orbit earns before'); + assert.equal(ev("pieAntic('kid')"), true); + const f = F(ev), kid = ev('pieKid().n'), n = f.bill - ev('S.day') - 1; + assert.ok(n >= 3 && n <= 5, `billing down 3 to 5 days (${n})`); + assert.match(kid, /'\);/, 'a name that injects'); + assert.match(ev('S.log[0].t'), /Ooooh\. Uuuuuh\./); + assert.ok(ev("S.log[0].t.includes(pieKid().n)"), 'the toast says his name'); + for (let i = 0; i < n; i++) { + days(ev, 1); + assert.equal(ev('R.pie.rev'), 0, `no orbit income on day ${i + 1}`); + assert.ok(ev('R.pie.billOff') > 0, 'what it would have been is kept'); + } + assert.equal(F(ev).bill, 0, 'billing is back after the last day'); + assert.equal(ev('S.pie.founder.posts[0].k'), 'pie.fp_backup', 'restored from backup'); + assert.match(ev('pieFpText(S.pie.founder.posts[0])'), / Tables /, 'the post calls him by his nickname'); + days(ev, 1); + assert.ok(ev('R.pie.rev') > 0, 'orbit earns again'); + // Once a game, and later posts bring him back. + assert.equal(ev("pieAntic('kid')"), false, 'never twice'); + assert.equal(ev("PIE_ANTIC_KEYS.filter(x=>PIE_ANTICS[x].ok(S.pie.founder)).includes('kid')"), false, 'not in the draw any more'); + ev("pieAntic('spree')"); + assert.equal(ev('S.pie.founder.posts[0].k'), 'pie.fp_spree_kid'); + assert.ok(ev('pieFpText(S.pie.founder.posts[0]).includes(pieKid().k)'), 'the running gag'); + assert.deepEqual(errors, []); +}); + +test('a 3 a.m. spree: fewer orbit calls and grumpier customers for two weeks, then the market calms down', () => { + const { ev, errors } = load(); + sky(ev); + const m0 = orbitMood(ev); + assert.equal(ev('pieOfferMul()'), 1); + ev("pieAntic('spree')"); + assert.ok(orbitMood(ev) <= m0 - 3.5, 'a dip at once'); + const j = F(ev).jit; + assert.equal(j, 0.6); + assert.ok(ev('pieOfferMul()') < 0.55, `offers well down (${ev('pieOfferMul()')})`); + days(ev, 14); + assert.ok(ev('pieOfferMul()') > 0.5 && ev('pieOfferMul()') < 1, 'nerves gone, jitters left'); + days(ev, 5); + assert.equal(F(ev).jit, 0, 'jitters fade within 30 days of a 0.6 bump'); + assert.equal(ev('pieOfferMul()'), 1, 'back to normal'); + days(ev, 20); + assert.ok(orbitMood(ev) >= m0, 'happiness recovers'); + assert.equal(ev('S.biz.filter(b=>BIZ_T[b.type].orbit).length'), 40, 'nobody left over a spree'); + assert.deepEqual(errors, []); +}); + +test('jitters stack up to 1 and fade to nothing over 30 days, nudging offers and moods while high', () => { + const { ev, errors } = load(); + sky(ev); + ev("pieAntic('leak');pieAntic('spree');pieAntic('leak')"); + assert.equal(F(ev).jit, 1, 'capped at 1'); + ev('S.pie.founder.nerv=0'); + assert.equal(ev('pieOfferMul()'), 0.7); + ev("for(const b of S.biz)b.mood=100"); + days(ev, 10); + assert.ok(Math.abs(orbitMood(ev) - (100 - 25 * 20 / 30)) < 1, `the happiest are held under 100 while jitters are high (${orbitMood(ev)})`); + assert.ok(orbitMood(ev) > 50, 'never low enough to cancel at renewal'); + assert.ok(Math.abs(F(ev).jit - 20 / 30) < 0.01, 'a thirtieth a day'); + days(ev, 20); + assert.equal(F(ev).jit, 0); + assert.equal(ev('pieOfferMul()'), 1); + days(ev, 15); + assert.equal(orbitMood(ev), 100, 'and back to happy'); + // The orbit sales desk rolls its odds through pieOfferMul(). + assert.match(ev("PIE_ON.day.map(String).join()"), /PIE_OFFER_RATE\*pieOfferMul\(\)/); + assert.deepEqual(errors, []); +}); + +test('picking a fight with a regulator starts a spat in a country with a dish of yours', () => { + const { ev, errors } = load(); + sky(ev); + assert.equal(ev("pieAntic('reg')"), true); + const sp = JSON.parse(ev('JSON.stringify(S.pie.spat)')), ks = Object.keys(sp); + assert.equal(ks.length, 1, 'one spat'); + assert.ok(['lic', 'kill'].includes(ks[0]), `a regulator's spat (${ks[0]})`); + assert.ok(['NL', 'BE', 'DE', 'SG'].includes(sp[ks[0]].cc), `where you have a dish (${sp[ks[0]].cc})`); + assert.ok(ev("S.pie.founder.posts.some(p=>p.k==='pie.fp_reg')")); + assert.equal(F(ev).jit, 0.4); + // At the spat limit he still rants, but nothing new starts. + ev("S.pie.spat.grab={st:'on',ask:S.day,until:S.day+100,c:0,m:0.1,left:5}"); + assert.equal(ev("pieAntic('reg')"), true); + assert.equal(ev('Object.keys(S.pie.spat).length'), 2); + assert.deepEqual(errors, []); +}); + +test('a leaked launch date makes launch insurance dearer for 30 days', () => { + const { ev, errors } = load(); + sky(ev); + const q = () => JSON.parse(ev("JSON.stringify(pieQuote('falcon','short',{ins:true}))")); + const q0 = q(), base = q0.cost - Math.round(q0.insured * 0.08); + ev("pieAntic('leak')"); + const q1 = q(); + assert.equal(q1.cost - base, Math.round(q1.insured * 0.08 * 1.75), 'premium 14% instead of 8%'); + ev("UI.pieIns=true;UI.pieTab='fly';ACT.pieOpen()"); + assert.match(ev("document.querySelector('#modal').textContent"), /Insurance: on \(14%\)/); + ev('closeModal()'); + days(ev, 29); + assert.ok(q().cost > q0.cost, 'still dear on day 29'); + days(ev, 1); + assert.equal(q().cost, q0.cost, 'back to normal after 30 days'); + assert.deepEqual(errors, []); +}); + +test('Mars next year: two weeks of hype, then the slip costs a few orbit customers', () => { + const { ev, errors } = load(); + sky(ev); + const p0 = F(ev).promises; + ev("pieAntic('mars')"); + const f = F(ev); + assert.equal(f.promises, p0 + 1, 'a promise'); + assert.ok(f.due.includes(f.mars), 'due like the others'); + assert.equal(ev("pieAntic('mars')"), false, 'one Mars at a time'); + assert.ok(ev('pieOfferMul()') > 1, 'hype: more calls'); + days(ev, 14); + assert.ok(ev('pieOfferMul()') <= 1, 'hype over'); + // Bring the due day forward instead of playing a year. + ev('{const F=S.pie.founder,i=F.due.indexOf(F.mars);F.due[i]=F.mars=S.day+1;F.due.sort((a,b)=>a-b);for(const d of F.due)if(db.id==='o7').mood=5"); + const b0 = F(ev).broken; + days(ev, 1); + assert.equal(F(ev).broken, b0 + 1, 'broken'); + assert.equal(F(ev).mars, 0); + assert.equal(ev('S.pie.founder.posts[0].k'), 'pie.fp_mars_slip'); + assert.equal(ev('S.biz.filter(b=>BIZ_T[b.type].orbit).length'), 39, '2% of 40 cancel'); + assert.equal(ev("S.biz.some(b=>b.id==='o7')"), false, 'the unhappiest one'); + assert.match(ev('S.log[0].t'), /1 orbit customer quietly cancelled/); + assert.deepEqual(errors, []); +}); + +test('with chaos off he still posts, and nothing else happens', () => { + const { ev, errors } = load(); + sky(ev, { chaos: 'none' }); + const n0 = ev('S.log.length'), cash = ev('S.cash'); + for (const k of ['kid', 'spree', 'reg', 'leak', 'mars']) assert.equal(ev(`pieAntic('${k}')`), true, k); + const f = F(ev); + for (const k of ['fp_kid', 'fp_spree_kid', 'fp_reg', 'fp_leak_kid', 'fp_mars_kid']) assert.ok(f.posts.some((p) => p.k === 'pie.' + k), k); + assert.equal(f.jit, 0); + assert.equal(f.bill, 0); + assert.equal(ev('Object.keys(S.pie.spat).length'), 0, 'no spat'); + assert.equal(ev('S.log.length'), n0, 'no toasts'); + assert.equal(ev('pieOfferMul()'), 1); + assert.equal(ev('pieInsMul()'), 1); + assert.equal(ev('S.cash'), cash); + days(ev, 1); + assert.ok(ev('R.pie.rev') > 0, 'billing never stops'); + ev('{const F=S.pie.founder,i=F.due.indexOf(F.mars);F.due=[F.mars=S.day+1]}'); + days(ev, 1); + assert.equal(ev('S.biz.filter(b=>BIZ_T[b.type].orbit).length'), 40, 'Mars slips, nobody leaves'); + assert.equal(ev('S.pie.founder.posts[0].k'), 'pie.fp_mars_slip'); + // The schedule still runs: he posts every 60 to 120 days. + ev('S.pie.founder.next=S.day+1;S.stats.pieAnt=0'); + days(ev, 1 + 121 * 2); + assert.ok(ev('S.stats.pieAnt') >= 2, 'antics keep coming'); + assert.equal(F(ev).jit, 0); + assert.deepEqual(errors, []); +}); + +test('antics come every 60 to 120 days, and only with a rocket company', () => { + const { ev, errors } = load(); + sky(ev); + ev('S.pie.founder.next=0;S.stats.pieAnt=0'); + days(ev, 1); + const first = F(ev).next; + assert.equal(first, ev('S.day') + 90, 'the first one comes 90 days on, no dice'); + ev('{const f=pieAntic;pieAntic=k=>{(window.__ant=window.__ant||[]).push(S.day);return f(k);}}'); + days(ev, 90 + 360); + const at = JSON.parse(ev('JSON.stringify(window.__ant)')); + assert.ok(at.length >= 4, `several antics in a year (${at.length})`); + assert.equal(at[0], first); + for (let i = 1; i < at.length; i++) { const g = at[i] - at[i - 1]; assert.ok(g >= 60 && g <= 120, `gap ${g}`); } + // Unlocked but no company: no plan, no dice. + const q = load(); + q.ev(`beginGame('Sky','fra',{mode:'normal',preset:'oncall',rules:{gates:'open'}});if(UI.pendGame)ACT.pitchSkip();pieInit()`); + q.ev('{const r=Math.random;window.__rolls=0;Math.random=()=>{window.__rolls++;return r();};for(let i=0;i<200;i++)pieAnticDay(S.day+i);Math.random=r}'); + assert.equal(q.ev('__rolls'), 0, 'no dice without a company'); + assert.equal(q.ev('S.pie.founder.next'), 0); + assert.equal(q.ev('S.stats.pieAnt|0'), 0); + assert.deepEqual(errors, []); + assert.deepEqual(q.errors, []); +}); + +test('saves keep the antics, old saves load calm, and junk is repaired', () => { + const { ev, errors } = load(); + sky(ev); + ev("pieAntic('kid');pieAntic('spree');pieAntic('leak');pieAntic('mars');S.pie.founder.next=S.day+50"); + const before = F(ev); + ev('S=migrate(JSON.parse(JSON.stringify(S)));compute()'); + assert.deepEqual(F(ev), before, 'a round trip keeps everything'); + assert.equal(ev('R.pie.rev'), 0, 'billing still down after loading'); + // A save from before the antics: no fields at all. + ev("{const o=JSON.parse(JSON.stringify(S));for(const k of ['jit','next','kid','bill','nerv','hype','leak','mars'])delete o.pie.founder[k];S=migrate(o);compute()}"); + const old = F(ev); + for (const k of ['jit', 'next', 'kid', 'bill', 'nerv', 'hype', 'leak', 'mars']) assert.equal(old[k], 0, `${k} defaults to 0`); + assert.ok(ev('R.pie.rev') > 0); + assert.equal(ev('pieKid()'), null); + // Junk. + ev("{const o=JSON.parse(JSON.stringify(S)),F=o.pie.founder;Object.assign(F,{jit:7,next:'x',kid:99,bill:S.day-3,nerv:1e9,hype:-5,leak:'soon',mars:S.day+12345});S=migrate(o)}"); + const j = F(ev), d = ev('S.day'); + assert.equal(j.jit, 1); + assert.equal(j.next, 0); + assert.ok(j.kid >= 0 && j.kid <= ev('PIE_KIDS.length')); + assert.ok(ev('!S.pie.founder.kid||!!pieKid()'), 'a kid that exists'); + assert.equal(j.bill, 0, 'a pause in the past is over'); + assert.ok(j.nerv <= d + 14); + assert.equal(j.hype, 0); + assert.equal(j.leak, 0); + assert.equal(j.mars, 0, 'a Mars promise that is not due is dropped'); + ev("{const o=JSON.parse(JSON.stringify(S));o.pie.founder.posts.push({d:1,k:'pie.fp_kid'},{d:1,k:'pie.fp_nonsense'});S=migrate(o)}"); + assert.ok(ev("S.pie.founder.posts.some(p=>p.k==='pie.fp_kid')"), 'antic posts survive'); + assert.equal(ev("S.pie.founder.posts.some(p=>p.k==='pie.fp_nonsense')"), false); + assert.deepEqual(errors, []); +}); + +test('the Company tab shows the jitters in one line at 360 px, next to the feed', () => { + const { dom, ev, errors } = load(); + sky(ev); + ev("window.innerWidth=360;UI.pieTab='co';ACT.pieOpen()"); + const card = () => dom.window.document.querySelector('#modalCard'); + assert.match(card().querySelector('.pie-feed .pie-jit').textContent, /^Market jitters: 😌 calm$/); + ev("pieAntic('kid');pieAntic('spree');ACT.pieTab({t:'co'})"); + const feed = card().querySelector('.pie-feed'); + const line = feed.querySelector('p.pie-jit').textContent; + assert.match(line, /^Market jitters: 😬 high, calming down in ~30 days$/); + assert.ok(line.length < 60, 'short enough for a phone line'); + assert.ok(feed.querySelector('.bar.pie-jit-bar'), 'a small meter'); + assert.match(feed.textContent, /Orbit billing is down until/); + assert.match(feed.textContent, /3 a\.m\. again\. Little \w+ Tables/); + assert.doesNotMatch(feed.textContent, /pie_ant\.|pie\.fp_|undefined|NaN/); + assert.equal(/style="[^"]*width:\s*\d{3,}px/.test(card().innerHTML), false, 'no fixed widths'); + days(ev, 20); + ev("ACT.pieTab({t:'co'})"); + assert.match(card().querySelector('.pie-feed p.pie-jit').textContent, /calming down in ~1\d days|calming down in ~\d days/); + ev('closeModal()'); + assert.deepEqual(errors, []); +}); From 9a5522bbb18d5fd17155b1571e9c4c30cbc082b4 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Fri, 6 Nov 2026 09:40:18 +0100 Subject: [PATCH 08/10] Deals belong to Sales: the intern sticks to the network, the sales desk signs deals for you, orbit ones too The NOC intern loses the sales order. Saves that had it load cleanly: sanitize drops the order, its log lines and its weekly tally, and an intern who was running it hands its switch and minimum to the sales desk (S.slAuto). With someone at the sales desk, the player can let them sign offers once a game day and decline the ones under a minimum (39-sales-auto.js), each in their own style: the engineer and the CEO sign after the #185 routing trial (one a day, a misfit waits a week), the shark signs every offer whose POPs are up, promises and commission included, and the CEO's declines are a handshake away. Orbit offers need room on their landing dish instead of a trial. Nobody at the desk (the default; the CEO is a choice, not a given): every deal is signed by hand. The sales desk runs before the intern's shift, so a deal signed today is in the loads the intern works from. The sheet shows the switch, the minimum and this week's and last week's tally; the NOC gets one notice a week. Orbit offers go through the desk too (99-pie-sales.js): they carry o.by, so commission, renewal haggles and each one's mark at renewal apply. The engineer only offers where the landing dish has 1.5x room on a well-served POP, and those customers renew like the nerds (0.5x leave). The shark rings airlines, cruise lines and the Mars mission first, at the biggest size that fits and 25% more, and half of them get a full-sky promise (REQS.skyfull: a crust at 90%) before there is one; they grumble down to 40 happiness and never cancel over the promise alone. The CEO plays every other golf game with the Founder: the biggest orbit deal that fits, Mars first, at 30% off; jitters cut his orbit prices by 0.4x the jitters and from 0.6 the Founder skips golf. Without a salesperson orbit offers are drawn exactly as before (the O7 balance save has nobody at the desk: payback unchanged, 7.0 years on seed 7, 7.5 on seed 11). Also: the scenario reference plays 'sales' as the CEO signing for you; the route fuzz leaves out the state and buttons of a standing order only main still has; the intern's on/off dials (paid peering, keep a spare) show their translated value in the shipped page instead of the raw label. --- CHANGELOG.md | 2 + docs/ARCHITECTURE.md | 4 +- scripts/lib/fuzz-page.js | 11 +- scripts/lib/route-fuzz.js | 13 +- scripts/lib/scenario-ref.js | 5 +- site/i18n/de.js | 28 +- site/i18n/es.js | 28 +- site/i18n/fr.js | 28 +- site/i18n/it.js | 28 +- site/i18n/pt.js | 28 +- src/agent/20-commands.js | 6 +- src/agent/30-docs.js | 5 +- src/game/60-features/38-sales-desk.js | 10 +- src/game/60-features/39-sales-auto.js | 41 +++ src/game/60-features/80-new-game.js | 2 +- src/game/60-features/90-automation.js | 2 +- src/game/60-features/95-standing-orders.js | 59 ++-- .../60-features/99-pie-orbit-customers.js | 11 +- src/game/60-features/99-pie-sales.js | 36 +++ src/game/80-simulation/60-requirements.js | 2 + src/game/88-days/10-day-tick.js | 4 + src/game/90-actions/52-sales.js | 3 + src/game/93-ui/58-sales-panel.js | 17 +- src/i18n/en.js | 28 +- tests/automation.test.js | 46 +-- tests/sales-auto.test.js | 275 ++++++++++++++++++ tests/sales-trial.test.js | 2 +- tests/standing-orders.test.js | 73 ++--- 28 files changed, 613 insertions(+), 184 deletions(-) create mode 100644 src/game/60-features/39-sales-auto.js create mode 100644 src/game/60-features/99-pie-sales.js create mode 100644 tests/sales-auto.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 79bc4e9..9b2a039 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ All notable changes to this project are documented here. The project follows - 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. +- Deals belong to Sales now: the NOC intern sticks to the network, and your salesperson can sign deals for you, orbit customers included. Open the sales desk in Deals, switch on Sign deals and pick a minimum below which offers are declined: the engineer signs only what your network can serve, the shark signs everything at once (promises and commission included), and the CEO signs what fits but now and then has already shaken hands on an offer you would have declined. If your intern used to handle sales, that setting moved to the sales desk; with nobody running sales you sign by hand, as before. +- Your salesperson now sells for your rocket company too. The engineer only sells where a pie dish has room to spare, and those customers stay longer; the shark goes after airlines and cruise lines at the biggest size and a quarter more, and promises half of them a full sky before you have one, so they grumble until you do; the CEO plays every other round of golf with the Founder and comes back with the biggest orbit deal that fits (the Mars mission first) at 30% off, unless the markets are jumpy, which costs him. ## [2.10.1] — 2026-11-05 diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 255955b..77b2a1e 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -31,7 +31,7 @@ hoisted across files, and top-level statements run in path order. Find code by n | `30-networks/` | Other ASes (`NETS`), rival exchanges (`XIX`), the long tail, traffic shares (`NSH`) | | `40-progress/` | Customer types (`BIZ_T`), `LEVELS` and their requirements, `GOALS`; the per-save ruleset (`S.rules`, `rule()`, `PRESETS`, `chaosMul()`, `leadDays()`) | | `50-state.js` | The globals `S`, `R`, `UI`; `emptyR()` | -| `60-features/` | Banks and loans, scenarios and the weekly challenge, puzzles and the published weekly puzzle, conferences, the tutorial, traceroute, the share card, `newGame()`, the offer trial (`autoOffer()`), standing orders (`S.ops`, `opsDay()`, run from `dayTick()`), the sales desk (`S.sales`, `salesDay()`, `salesShape()` on new offers) | +| `60-features/` | Banks and loans, scenarios and the weekly challenge, puzzles and the published weekly puzzle, conferences, the tutorial, traceroute, the share card, `newGame()`, the offer trial (`autoOffer()`), standing orders (`S.ops`, `opsDay()`, run from `dayTick()`), the sales desk (`S.sales`, `salesDay()`, `salesShape()` on new offers, orbit ones through `pieSlShape()`; signing for you: `S.slAuto`, `slAutoDay()`) | | `70-rules/` | Formatting helpers and market rules: exchanges, PNIs, the peering desk (requests answered by policy), peering policy and snubs, DE-KICKS, sold-out routes, hot ports and the Tier 1/2/3 rank | | `80-simulation/` | Dijkstra, RouteScript, where a DDoS flood goes (`ddosLoad()`/`ddosAfter()`, called by `compute()`), `compute()`, monthly prices, `sanitize()`/`migrate()`, customer requirements, events, the customer lifecycle (contracts, renewals, the bandwidth market, why customers leave), geography pricing and latency, second sites and service | | `85-incidents/` | `addInc()`, DDoS attacks (targets, sizes, scoring, the NOC card) and scrubbing, `fireFailure()`, `clearInc()`, `fireEvent()`, the chaos monkey, cable ships (`50-cable-ships.js`: a subsea cut sends a club ship from its port along the cable routes; voyages in `S.fleet`, drawn by `96-map/88-cable-ships.js`) | @@ -117,6 +117,8 @@ never freezes the game. Then the NOC intern's standing orders (`opsDay()`), if one is hired: each order clicks the same `ACT` actions a player would, muted, within its monthly budget, and the shift recomputes once at the end, only if a job changed the network. An order that throws is paused; the day goes on. The NOC gets one notice a week. + Then the sales desk (`slAutoDay()`), if someone runs sales and the player lets them sign: deals are Sales', never + the intern's. Each salesperson signs in their own style (a routing trial a day, or the shark's sign-everything). 5. Updates customer mood, churn and new offers; IX members join; loans tick. 6. Every 30 days: bills the month (revenue minus costs) and checks for bankruptcy. 7. Checks goals, level, badges and scenario end conditions. diff --git a/scripts/lib/fuzz-page.js b/scripts/lib/fuzz-page.js index dc3646d..5b05a14 100644 --- a/scripts/lib/fuzz-page.js +++ b/scripts/lib/fuzz-page.js @@ -158,9 +158,14 @@ const parts = () => { const o = {}; if (!R) return o; for (const k of Object.keys(R)) o[k] = JSON.stringify(R[k]); o.fl = R.fl ? JSON.stringify(R.fl) : ''; return o; }; // A field only this checkout's game has (a new feature's state, on S or on its customers and offers) cannot match main // yet: the driver passes those (drop) and they are left out; every field both games have must still match. - const sKeys = () => ({ top: Object.keys(S), items: [...new Set([...(S.biz || []), ...(S.offers || [])].flatMap((x) => Object.keys(x)))] }); - const sDrop = (drop) => { if (!drop || (!drop.top.length && !drop.items.length)) return S; const o = {}; - for (const k of Object.keys(S)) if (!drop.top.includes(k)) o[k] = S[k]; + // The intern's state two levels deep (ops.on.sales, ops.wk.rev): a standing order one game has and the other retired. + const opsPaths = () => { const O = S.ops, out = []; if (!O || typeof O !== 'object') return out; + for (const k of Object.keys(O)) { out.push(k); const v = O[k]; if (v && typeof v === 'object' && !Array.isArray(v)) for (const j of Object.keys(v)) out.push(k + '.' + j); } return out; }; + const sKeys = () => ({ top: Object.keys(S), items: [...new Set([...(S.biz || []), ...(S.offers || [])].flatMap((x) => Object.keys(x)))], ops: opsPaths(), orders: typeof OPSK === 'object' ? Object.keys(OPSK) : [] }); + const opsDrop = (ops) => { const o = {}; for (const k of Object.keys(S.ops)) { if (ops.includes(k)) continue; const v = S.ops[k]; + if (v && typeof v === 'object' && !Array.isArray(v)) { const w = {}; for (const j of Object.keys(v)) if (!ops.includes(k + '.' + j)) w[j] = v[j]; o[k] = w; } else o[k] = v; } return o; }; + const sDrop = (drop) => { if (!drop || (!drop.top.length && !drop.items.length && !(drop.ops || []).length)) return S; const o = {}; + for (const k of Object.keys(S)) if (!drop.top.includes(k)) o[k] = k === 'ops' && S.ops && (drop.ops || []).length ? opsDrop(drop.ops) : S[k]; for (const k of ['biz', 'offers']) if (Array.isArray(o[k])) o[k] = o[k].map((x) => { const y = {}; for (const f of Object.keys(x)) if (!drop.items.includes(f)) y[f] = x[f]; return y; }); return o; }; const sDigest = (drop) => JSON.stringify(sDrop(drop)); diff --git a/scripts/lib/route-fuzz.js b/scripts/lib/route-fuzz.js index 164a8a7..dfca595 100644 --- a/scripts/lib/route-fuzz.js +++ b/scripts/lib/route-fuzz.js @@ -78,8 +78,10 @@ function playGame(pages, seed, opts = {}) { const [x, y] = both('check'); for (const k of ['a', 'b', 'c']) if (x[k] !== y[k]) { fail(where + ': routing (' + k + ') base vs head', { diff: firstDiff(base.call('parts'), head.call('parts')) }); return false; } if (y.b !== y.c) { fail(where + ': head cached vs uncached', { diff: 'R from the kept tables differs from a fresh route' }); return false; } - // Fields only this checkout's game has are left out on both sides (see sKeys in fuzz-page.js). - const [k1, k2] = both('sKeys'), drop = { top: k2.top.filter((k) => !k1.top.includes(k)), items: k2.items.filter((k) => !k1.items.includes(k)) }; + // Fields only this checkout's game has are left out on both sides (see sKeys in fuzz-page.js), and so is the state of a + // standing order only one of them has (one this checkout retired, or added). + const [k1, k2] = both('sKeys'), drop = { top: k2.top.filter((k) => !k1.top.includes(k)), items: k2.items.filter((k) => !k1.items.includes(k)), + ops: [...k1.ops.filter((k) => !k2.ops.includes(k)), ...k2.ops.filter((k) => !k1.ops.includes(k))] }; const [s1, s2] = both('sDigest', drop); if (s1 !== s2) { fail(where + ': game state S', { diff: firstDiff(base.call('sParts', drop), head.call('sParts', drop)) }); return false; } return true; @@ -102,8 +104,11 @@ function playGame(pages, seed, opts = {}) { // A screen's buttons on both pages; the same list or a divergence. // Buttons for actions main's page does not have (a new feature's) are left out: the driver only presses what both have. - let baseActs = null; - const screen = (w) => { const [a, b0] = both('screen', w); baseActs = baseActs || new Set(base.call('acts')); + // So are the switches and dials of a standing order this checkout retired (main's sheet still shows them). + let baseActs = null, retired = null; + const screen = (w) => { const [a0, b0] = both('screen', w); baseActs = baseActs || new Set(base.call('acts')); + if (!retired) { const [o1, o2] = both('sKeys'); retired = new Set(o1.orders.filter((k) => !o2.orders.includes(k))); } + const a = Array.isArray(a0) ? a0.filter((x) => !(/^ops/.test(x.act) && retired.has(x.args && x.args.k))) : a0; const b = Array.isArray(b0) ? b0.filter((x) => baseActs.has(x.act)) : b0; same('buttons of ' + JSON.stringify(w), a, b); return a || []; }; const press = (b, where) => { acts[b.act] = (acts[b.act] || 0) + 1; const [e1, e2] = both('press', b); same('press ' + where, e1, e2); note(where + ' ' + b.act + JSON.stringify(b.args) + (e1 ? ' !' + e1 : '')); }; // Answer whatever window opened, a few levels deep, then close it. diff --git a/scripts/lib/scenario-ref.js b/scripts/lib/scenario-ref.js index 7246bf6..da5da92 100644 --- a/scripts/lib/scenario-ref.js +++ b/scripts/lib/scenario-ref.js @@ -6,7 +6,7 @@ // A plan is a list of steps, each [op, ...args]: // ['bb', c] POP and broadband ['tr', c, tier] the cheapest transit there ['ix', c, tier] every exchange // ['pop', c] a POP only ['link', a, b, tier, cable] a wave (routers upgraded first, a swap a day) -// ['hire', orders, params] the NOC intern on standing orders, as soon as the level allows +// ['hire', orders, params] the NOC intern on standing orders, as soon as the level allows ('sales': the CEO signs deals) // ['wait', day] until that day ['served', g] until g Gbps are served ['prep', c, g] capacity for an event // ['scrub', c, tier] a scrubbing center ['pnis'] a PNI with every unreached network that takes one // ['pni', c, net, tier] one PNI with that network there ['last', c] transit there only as a last resort @@ -29,7 +29,8 @@ Q.link=(a,b,tier=1,via)=>{for(const c of [a,b])Q.pop(c);if(!S.pops[a]||!S.pops[b if(!waveOk(a,b,tier))return null;const n0=S.links.length;UI.via=via||null;UI.route=null;openLinkModal(a,b);ACT.buildLink({tier});closeModal();return S.links.length>n0;}; Q.hire=(orders,par)=>{Q.wantHire=[orders||['transit','routers','repair'],par||{}];return true;}; Q.hire0=(orders,par)=>{if(!opsCanHire()||!Q.can(20000))return false;if(!opsHired()){ACT.opsHire({id:'kevin'});closeModal();}if(!opsHired())return false; - for(const k of orders)if(!S.ops.on[k])ACT.opsToggle({k});for(const k in par)for(const [p,v] of Object.entries(par[k]))for(let i=0;i<8&&opsP(k,p)!==v;i++)ACT.opsParam({k,p});closeModal();return true;}; + // Deals are the sales desk's: 'sales' puts the CEO there (free, and he signs what the old sales order signed) and lets him sign. + for(const k of orders)if(k==='sales'){if(!slP()&&salesCanHire())ACT.salesHire({id:'ceo'});if(slP()&&!S.slAuto.on)ACT.salesAuto();}else if(!S.ops.on[k])ACT.opsToggle({k});for(const k in par)for(const [p,v] of Object.entries(par[k]))for(let i=0;i<8&&opsP(k,p)!==v;i++)ACT.opsParam({k,p});closeModal();return true;}; Q.pnis=(tier=0)=>{for(const n of NETS.filter(n=>!R.reachable[n.id]).sort((a,b)=>NSH[b.id]-NSH[a.id])){const b=pniBatch(n.id,tier);if(!b||!b.orders.length||!Q.can(b.cost))continue;ACT.pniAll({net:n.id,tier});}return true;}; Q.pni=(c,net,tier=0)=>{if(!S.pni.some(p=>p.city===c&&p.net===net))ACT.pni({city:c,net,tier});closeModal();return S.pni.some(p=>p.city===c&&p.net===net);}; Q.scrub=(c,tier=0)=>{ACT.buildScrub({city:c,tier});return true;}; diff --git a/site/i18n/de.js b/site/i18n/de.js index c39c736..2a9fa15 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -3223,7 +3223,6 @@ "ops.kevin_from_the_night_shift":"Kevin von der Nachtschicht", "ops.l_broke":{"one":"stand beim Budget für {where} an","other":"stand bei {n} Aufträgen am Budget an ({where})"}, "ops.l_caches":{"one":"hat einen Gratis-Cache in {where} eingebaut","other":"hat {n} Gratis-Caches eingebaut ({where})"}, -"ops.l_decline":{"one":"hat ein Mini-Angebot abgelehnt","other":"hat {n} Mini-Angebote abgelehnt"}, "ops.l_decom":{"one":"hat eine kleine Wave auf {where} zurückgegeben","other":"hat {n} kleine Waves zurückgegeben ({where})"}, "ops.l_line":"{name} {list}.", "ops.l_optics":{"one":"hat einen Kanal auf {where} aufgeschaltet","other":"hat {n} Kanäle aufgeschaltet ({where})"}, @@ -3235,7 +3234,6 @@ "ops.l_repair":{"one":"hat eine Reparatur beschleunigt","other":"hat {n} Reparaturen beschleunigt"}, "ops.l_routers":{"one":"hat Router in {where} aufgerüstet","other":"hat Router an {n} Orten aufgerüstet ({where})"}, "ops.l_rs":{"one":"hat sich einem Route Server angeschlossen","other":"hat sich {n} Route Servern angeschlossen"}, -"ops.l_sales":{"one":"hat einen Kunden unterschrieben","other":"hat {n} Kunden unterschrieben"}, "ops.l_snag":{"one":"ist bei {where} hängen geblieben und hat den Auftrag pausiert, bis du draufschaust","other":"ist bei {n} Aufträgen hängen geblieben ({where}) und hat sie pausiert, bis du draufschaust"}, "ops.l_transit":{"one":"hat Transit in {where} aufgestockt","other":"hat {n}-mal Transit aufgestockt ({where})"}, "ops.locked":"Das NOC stellt ab Kundenlevel {lv} Praktikanten ein.", @@ -3247,10 +3245,8 @@ "ops.mood_oops":"{name} ist heute sehr vorsichtig. Bitte niemand die Interface-Beschreibungen erwähnen.", "ops.mood_outage":"{name} beobachtet die Störungsgraphen und lädt die Statusseite neu. Sehr oft.", "ops.mood_quiet":"{name} liest in Ruhe RFCs. Die Graphen sind flach, genau wie es sein soll.", -"ops.mood_sales":"{name} läuft heute etwas aufrechter: In der eigenen Schicht hat jemand unterschrieben.", "ops.mood_snag":"{name} ist auf etwas Seltsames gestoßen, hat den Auftrag pausiert und dir einen Zettel hingeklebt.", "ops.mood_tracy":"Tracy ist drei Hops tief in einem Traceroute, bisher mit nur einem Sternchen.", -"ops.never":"nie", "ops.no_cap":"kein Limit", "ops.no_clock":"Keine Uhr, keine Schichten: Bei diesen Regeln gibt es keine Tage, an denen ein Praktikant arbeiten könnte.", "ops.o_caches":"Gratis-Caches annehmen", @@ -3269,18 +3265,14 @@ "ops.o_repair_d":"Für jeden Ausfall mit Eil-Reparatur zahlen, solange das Budget reicht.", "ops.o_routers":"Router voraus halten", "ops.o_routers_d":"Einen Router dazustellen oder auf die nächste Generation tauschen, wo ein zweiter Router den Traffic trägt, sobald Last oder Ports eine Grenze überschreiten.", -"ops.o_sales":"Vertrieb übernehmen", -"ops.o_sales_d":"Angebote unterschreiben, deren Anforderungen mit Kapazität übrig erfüllt sind, und die ablehnen, die sich nicht lohnen.", "ops.o_transit":"Transit-Reserve halten", "ops.o_transit_d":"Transit an jedem POP über einem Vielfachen seiner 30-Tage-Spitze halten: ein LAG-Member dazu oder eine Portgröße hoch.", "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", -"ops.p_acc":"Fertige Angebote annehmen", "ops.p_at":"Ab", "ops.p_g":"Ab", "ops.p_how":"Wie", "ops.p_keep":"Einen in Reserve", -"ops.p_min":"Ablehnen unter", "ops.p_paid":"Paid Peering", "ops.p_pick":"Optiken", "ops.p_prov":"Anbieter", @@ -3316,7 +3308,6 @@ "ops.w_line":"{name} {list}.", "ops.w_money":"Woche gesamt: {cost} einmalig, {mo}/Monat.", "ops.w_oops":{"one":"hat sich einmal kurz vertippt","other":"hat sich {n}-mal kurz vertippt"}, -"ops.w_sales":{"one":"hat einen Kunden gewonnen ({rev}/Monat)","other":"hat {n} Kunden gewonnen ({rev}/Monat)"}, "optic_counts.apply_price":"Übernehmen · {price}", "optic_counts.count_for_model":"Anzahl der {model}-Kanäle", "optic_counts.only_n_channels_free":"Auf dieser Glasfaser sind nur {n} Kanäle frei.", @@ -4083,6 +4074,7 @@ "requirements.n_400g_alien_wave_on_your":{"one":"{n}× 400G Alien Wave auf deiner Glasfaser {a}–{b}","other":"{n}× 400G Alien Waves auf deiner Glasfaser {a}–{b}"}, "requirements.needs_low_loss_reach_into_china":"Braucht verlustarme Anbindung nach China", "requirements.one_way_latency_within_max_ms":"Einweg-Latenz höchstens {max} ms (aktuell beste: {best})", +"requirements.promised_a_full_sky":"Versprochen: ein voller Himmel, eine Kruste zu mindestens {p} im Orbit", "requirements.refuses_cogentle_transit_anywhere_on":"Duldet nirgends in deinem Netz Transit von Cogentle (lange Geschichte)", "requirements.their_ceo_hates_puns_please_do":"Ihr CEO hasst Wortspiele. Bitte erwähne die Netznamen nicht.", "requirements.two_data_centers_in_every_metro":"Zwei Rechenzentren in jeder Stadt, in der sie vertreten sind", @@ -4288,8 +4280,15 @@ "rules.your_pager_never_sleeps":"Dein Pager schläft nie.", "sales.ask_vp":"Beim Vorstand einen VP Sales beantragen · {cost}", "sales.at_desk":"{name} leitet den Vertrieb", +"sales.auto":"Unterschreibt Deals für dich", +"sales.auto_ceo":"{name} unterschreibt die Angebote, die dein Netz heute bedienen kann, ein Test am Tag. Er lehnt auch die unter deinem Minimum ab, nur hat er ab und zu schon eingeschlagen.", +"sales.auto_eng":"{name} unterschreibt die Angebote, die dein Netz heute bedienen kann, nachdem jedes erst im Netz ausprobiert wurde (eins am Tag), und lehnt die ab, die weniger als dein Minimum zahlen.", +"sales.auto_shark":"{name} unterschreibt jedes Angebot, sobald es reinkommt, mitsamt Versprechen, solange du die Provision zahlen kannst, und lehnt die ab, die weniger als dein Minimum zahlen.", +"sales.by_hand":"Niemand macht den Vertrieb, also unterschreibst du jeden Deal selbst. Stell jemanden ein, oder lass den CEO ran, und sie unterschreiben für dich.", "sales.ceo_d":"Kostenlos, und überzeugt davon. Alle paar Monate unterschreibt er auf dem Golfplatz einen Riesendeal mit 30 % Rabatt, oft mit einem Versprechen, das niemand geprüft hat, und ab und zu ein Angebot, das du abgelehnt hast. Hat Meinungen. Kann nicht entlassen werden.", "sales.ceo_golf":"Der CEO hat {name} auf dem Golfplatz unterschrieben: {bw} in {city} für {price}/Monat, 30 % unter Liste.", +"sales.ceo_golf_skip":"Der Gründer hat das Golf geschwänzt: Die Märkte sind zu nervös. Der CEO hat allein gespielt und im Orbit nichts unterschrieben.", +"sales.ceo_golf_sky":"Der CEO und der Gründer haben {name} auf dem Golfplatz unterschrieben: {bw} im Orbit über {city} für {price}/Monat, {p} unter Liste.", "sales.ceo_n":"Der CEO, der besser verkauft als alle", "sales.ceo_override":"Du hast {name} abgelehnt, aber der CEO hatte schon eingeschlagen. Jetzt sind sie Kunde.", "sales.ceo_promised":"Er hat auch versprochen: {req}.", @@ -4301,27 +4300,38 @@ "sales.ceo_say_napkin":"Ich habe den nächsten Deal auf einer Serviette kalkuliert. Die Technik kann die Details klären.", "sales.ceo_say_synergy":"Wir verkaufen keine Bandbreite, wir verkaufen Synergie. Schreibt das auf die Website.", "sales.ceo_says":"Der CEO: „{say}“", +"sales.ceo_sky":"Im Orbit: jede zweite Golfrunde spielt er mit dem Gründer, für den größten Orbit-Deal, der passt, mit 30 % Rabatt. Nervöse Märkte kosten ihn: niedrigere Orbit-Preise, und gar kein Golf, wenn sie sehr nervös sind.", "sales.ceo_took_over":"{name} hat den Vertrieb persönlich übernommen. Er ist sicher, dass er besser verkauft als alle.", "sales.commission":"{name} hat unterschrieben. Provision für den Hai: {cost}.", +"sales.decline_below":"Ablehnen unter", "sales.desk":"Vertrieb", "sales.eng_booked":"{name} hat dich für {conf} in {city} angemeldet ({cost}). Das Badge liegt schon bereit.", "sales.eng_d":"War Netzwerkingenieur und hat jetzt ein Badge von jeder NOG. Meldet dich zu jeder an (das Ticket zahlst du), bringt viele kleine und mittlere Deals, aber nie die richtig großen, und verkauft nur, was das Netz kann, also bleiben die Kunden. Die Nerds lieben Dave. Verhandelt schlecht.", "sales.eng_n":"Der Ingenieur, jetzt Salesdroide", "sales.eng_s":"Dave", +"sales.eng_sky":"Im Orbit: verkauft nur, wo die Landeschüssel noch reichlich Platz hat, und diese Kunden bleiben wie die Nerds.", "sales.fired":"{name} hat den Schreibtisch geräumt. Der Vertrieb ist frei.", "sales.hire_sales":"Vertrieb einstellen", "sales.hired":"{name} ist jetzt im Vertrieb. Rechne mit Deals in diesem Stil.", "sales.intro":"Eine Person leitet den Vertrieb. Jede holt Deals auf ihre Art, und die Kunden, die sie abschließt, erinnern sich daran, wenn ihr Vertrag ausläuft.", "sales.let_ceo":"Den CEO machen lassen", "sales.locked":"Der Vertrieb öffnet ab Kundenstufe {lv}.", +"sales.never":"nie", "sales.one_at_a_time":"Immer nur eine Person: Lass sie gehen, um jemand anderen einzustellen.", +"sales.p_sign":"Deals unterschreiben", "sales.pitch":"Eine Person im Vertrieb holt Deals auf ihre eigene Art. Such sie aus.", "sales.shark_d":"Holt die größten Deals zu einem Viertel mehr und kassiert einen Monat jedes Deals als Provision. Verkauft zu viel: Die Hälfte kommt mit einem Versprechen, das dein Netz noch nicht hält, und diese Kunden gehen früher. Ignoriert die Nerds: keine technischen Kunden, keine Meetings, und Peering-Desks wollen ein Viertel mehr Verkehr von dir. Gewinnt die meisten Verhandlungen.", "sales.shark_n":"Der Hai", "sales.shark_s":"Chad", +"sales.shark_sky":"Im Orbit: ruft zuerst Airlines und Kreuzfahrtreedereien an, in der größten Größe und zu einem Viertel mehr, und verspricht der Hälfte einen vollen Himmel, bevor du einen hast. Sie murren, bis es so weit ist.", "sales.vp_arrived":"Der VP Sales hat angefangen, und der CEO ist zurück bei der Strategie. Der Vertrieb ist frei: Stell jemanden ein.", "sales.vp_asked":"Der Vorstand hat zugestimmt, nach dem Mittagessen. Ein VP Sales fängt in {n} Tagen an; bis dahin verkauft der CEO weiter.", "sales.vp_coming":"Ein VP Sales übernimmt in {n} Tagen.", +"sales.w_anyway":{"one":"hat eins davon trotzdem unterschrieben","other":"hat {n} davon trotzdem unterschrieben"}, +"sales.w_declined":{"one":"hat ein Mini-Angebot abgelehnt","other":"hat {n} Mini-Angebote abgelehnt"}, +"sales.w_last":"Letzte Woche: {name} {list}.", +"sales.w_now":"Diese Woche: {name} {list}.", +"sales.w_signed":{"one":"hat einen Kunden gewonnen ({rev}/Monat)","other":"hat {n} Kunden gewonnen ({rev}/Monat)"}, "save.cash_in_the_bank":"{cash} auf der Bank", "save.import_failed_err":"Import fehlgeschlagen.
{err}", "save.load_name":"{name} laden?", diff --git a/site/i18n/es.js b/site/i18n/es.js index 0b95e12..f6070ac 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -3221,7 +3221,6 @@ "ops.kevin_from_the_night_shift":"Kevin, el del turno de noche", "ops.l_broke":{"one":"se paró en el presupuesto de {where}","other":"se paró en el presupuesto de {n} órdenes ({where})"}, "ops.l_caches":{"one":"montó una caché gratis en {where}","other":"montó {n} cachés gratis ({where})"}, -"ops.l_decline":{"one":"rechazó una oferta diminuta","other":"rechazó {n} ofertas diminutas"}, "ops.l_decom":{"one":"devolvió una wave pequeña en {where}","other":"devolvió {n} waves pequeñas ({where})"}, "ops.l_line":"{name} {list}.", "ops.l_optics":{"one":"encendió un canal en {where}","other":"encendió {n} canales ({where})"}, @@ -3233,7 +3232,6 @@ "ops.l_repair":{"one":"aceleró una reparación","other":"aceleró {n} reparaciones"}, "ops.l_routers":{"one":"mejoró los routers en {where}","other":"mejoró los routers en {n} sitios ({where})"}, "ops.l_rs":{"one":"se unió a un route server","other":"se unió a {n} route servers"}, -"ops.l_sales":{"one":"firmó un cliente","other":"firmó {n} clientes"}, "ops.l_snag":{"one":"se atascó con {where} y la pausó hasta que le eches un vistazo","other":"se atascó con {n} órdenes ({where}) y las pausó hasta que les eches un vistazo"}, "ops.l_transit":{"one":"amplió el tránsito en {where}","other":"amplió el tránsito {n} veces ({where})"}, "ops.locked":"El NOC contrata becarios a partir del nivel de clientes {lv}.", @@ -3245,10 +3243,8 @@ "ops.mood_oops":"{name} va con mucho cuidado hoy. Que nadie mencione las descripciones de las interfaces.", "ops.mood_outage":"{name} está mirando las gráficas de la avería y recargando la página de estado. Mucho.", "ops.mood_quiet":"{name} lee RFCs tranquilamente. Las gráficas están planas, como debe ser.", -"ops.mood_sales":"{name} camina un poco más erguido hoy: alguien firmó en su turno.", "ops.mood_snag":"{name} se topó con algo raro, pausó esa orden y te dejó un pósit.", "ops.mood_tracy":"Tracy va por el tercer salto de un traceroute, con solo un asterisco de momento.", -"ops.never":"nunca", "ops.no_cap":"sin límite", "ops.no_clock":"Sin reloj no hay turnos: con estas reglas no hay días en los que un becario pueda trabajar.", "ops.o_caches":"Aceptar cachés gratis", @@ -3267,18 +3263,14 @@ "ops.o_repair_d":"Pagar la reparación urgente de cada caída que la tenga, mientras dure el presupuesto.", "ops.o_routers":"Routers por delante", "ops.o_routers_d":"Añadir un router, o pasar a la siguiente generación donde un segundo router lleve el tráfico, cuando la carga o los puertos pasen de un nivel.", -"ops.o_sales":"Llevar las ventas", -"ops.o_sales_d":"Firmar las ofertas cuyos requisitos se cumplen con capacidad de sobra y rechazar las que pagan demasiado poco.", "ops.o_transit":"Margen de tránsito", "ops.o_transit_d":"Mantener el tránsito de cada POP por encima de un múltiplo de su pico de 30 días: un miembro LAG más o un tamaño de puerto mayor.", "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", -"ops.p_acc":"Aceptar ofertas listas", "ops.p_at":"Por encima de", "ops.p_g":"Desde", "ops.p_how":"Cómo", "ops.p_keep":"Dejar uno de reserva", -"ops.p_min":"Rechazar por debajo de", "ops.p_paid":"Peering de pago", "ops.p_pick":"Ópticas", "ops.p_prov":"Proveedor", @@ -3314,7 +3306,6 @@ "ops.w_line":"{name} {list}.", "ops.w_money":"Total de la semana: {cost} de entrada, {mo}/mes.", "ops.w_oops":{"one":"tuvo un pequeño despiste","other":"tuvo {n} pequeños despistes"}, -"ops.w_sales":{"one":"firmó un cliente ({rev}/mes)","other":"firmó {n} clientes ({rev}/mes)"}, "optic_counts.apply_price":"Aplicar · {price}", "optic_counts.count_for_model":"Número de canales {model}", "optic_counts.only_n_channels_free":"Solo quedan {n} canales libres en esta fibra.", @@ -4081,6 +4072,7 @@ "requirements.n_400g_alien_wave_on_your":{"one":"{n}× onda alien de 400G en tu fibra {a}–{b}","other":"{n}× ondas alien de 400G en tu fibra {a}–{b}"}, "requirements.needs_low_loss_reach_into_china":"Necesita alcance a China con poca pérdida", "requirements.one_way_latency_within_max_ms":"Latencia en un sentido de máximo {max} ms (mejor ahora: {best})", +"requirements.promised_a_full_sky":"Prometió un cielo lleno: una corteza al menos al {p} en órbita", "requirements.refuses_cogentle_transit_anywhere_on":"Rechaza el tránsito de Cogentle en cualquier parte de tu red (larga historia)", "requirements.their_ceo_hates_puns_please_do":"Su CEO odia los juegos de palabras. Por favor, no menciones los nombres de las redes.", "requirements.two_data_centers_in_every_metro":"Dos centros de datos en cada área metropolitana que toquen", @@ -4286,8 +4278,15 @@ "rules.your_pager_never_sleeps":"Tu busca no duerme nunca.", "sales.ask_vp":"Pedir al consejo un VP de Ventas · {cost}", "sales.at_desk":"{name} lleva las ventas", +"sales.auto":"Firma tratos por ti", +"sales.auto_ceo":"{name} firma las ofertas que tu red puede servir hoy, una prueba al día. También rechaza las que quedan bajo tu mínimo, aunque de vez en cuando ya había dado la mano.", +"sales.auto_eng":"{name} firma las ofertas que tu red puede servir hoy, después de probar cada una en la red (una al día), y rechaza las que pagan menos que tu mínimo.", +"sales.auto_shark":"{name} firma cada oferta en cuanto llega, con promesas y todo, mientras puedas pagar la comisión, y rechaza las que pagan menos que tu mínimo.", +"sales.by_hand":"Nadie lleva las ventas, así que firmas cada trato a mano. Contrata a un vendedor, o deja que lo lleve el CEO, y podrá firmar por ti.", "sales.ceo_d":"Gratis, y convencido. Cada par de meses firma un trato enorme en el campo de golf con un 30 % de descuento, a menudo con una promesa que nadie comprobó, y de vez en cuando firma una oferta que tú rechazaste. Tiene opiniones. No se le puede despedir.", "sales.ceo_golf":"El CEO firmó a {name} en el campo de golf: {bw} en {city} por {price}/mes, un 30 % por debajo de tarifa.", +"sales.ceo_golf_skip":"El Fundador se saltó el golf: los mercados están demasiado nerviosos. El CEO jugó solo y no firmó nada en órbita.", +"sales.ceo_golf_sky":"El CEO y el Fundador firmaron a {name} en el campo de golf: {bw} en órbita sobre {city} por {price}/mes, un {p} bajo tarifa.", "sales.ceo_n":"El CEO, que vende mejor que nadie", "sales.ceo_override":"Rechazaste a {name}, pero el CEO ya había dado la mano. Ahora son clientes.", "sales.ceo_promised":"También prometió: {req}.", @@ -4299,27 +4298,38 @@ "sales.ceo_say_napkin":"He calculado el próximo trato en una servilleta. Ingeniería puede resolver los detalles.", "sales.ceo_say_synergy":"No vendemos ancho de banda, vendemos sinergia. Ponedlo en la web.", "sales.ceo_says":"El CEO: «{say}»", +"sales.ceo_sky":"En órbita: una de cada dos partidas de golf la juega con el Fundador, por el trato en órbita más grande que quepa, con un 30 % de descuento. Los mercados nerviosos le cuestan: precios más bajos en órbita, y nada de golf cuando están muy nerviosos.", "sales.ceo_took_over":"{name} se ha hecho cargo de las ventas en persona. Está seguro de que vende mejor que nadie.", "sales.commission":"{name} firmó. Comisión para el tiburón: {cost}.", +"sales.decline_below":"Rechazar por debajo de", "sales.desk":"Ventas", "sales.eng_booked":"{name} te apuntó a {conf} en {city} ({cost}). Ya tiene la acreditación.", "sales.eng_d":"Era ingeniero de redes y ahora tiene la acreditación de cada NOG. Te apunta a todas (la entrada la pagas tú), trae muchos tratos pequeños y medianos pero nunca los grandes de verdad, y solo vende lo que la red puede hacer, así que los clientes se quedan. Los nerds adoran a Dave. Negocia fatal.", "sales.eng_n":"El ingeniero convertido en vendedroide", "sales.eng_s":"Dave", +"sales.eng_sky":"En órbita: solo vende donde la antena de aterrizaje tiene margen de sobra, y esos clientes se quedan como los nerds.", "sales.fired":"{name} ha vaciado su mesa. Ventas está libre.", "sales.hire_sales":"Contratar ventas", "sales.hired":"{name} se unió a ventas. Espera tratos a su estilo.", "sales.intro":"Una persona lleva las ventas. Cada una trae tratos a su manera, y los clientes que firma lo recuerdan cuando les toca renovar.", "sales.let_ceo":"Dejar que lo lleve el CEO", "sales.locked":"Ventas se abre en el nivel de clientes {lv}.", +"sales.never":"nunca", "sales.one_at_a_time":"Solo una a la vez: despídela para contratar a otra.", +"sales.p_sign":"Firmar tratos", "sales.pitch":"Una persona de ventas trae tratos a su manera. Elige quién.", "sales.shark_d":"Consigue los tratos más grandes a un cuarto más, y se lleva un mes de cada trato de comisión. Vende de más: la mitad llega con una promesa que tu red aún no cumple, y esos clientes se van antes. Ignora a los nerds: nada de clientes técnicos ni de reuniones, y los equipos de peering te piden un cuarto más de tráfico. Gana casi todas las negociaciones.", "sales.shark_n":"El tiburón", "sales.shark_s":"Chad", +"sales.shark_sky":"En órbita: llama primero a aerolíneas y cruceros, al tamaño más grande y a un cuarto más, y a la mitad les promete un cielo lleno antes de que lo tengas. Refunfuñan hasta que lo tienes.", "sales.vp_arrived":"El VP de Ventas ya empezó, y el CEO ha vuelto a la estrategia. Ventas está libre: contrata a alguien.", "sales.vp_asked":"El consejo aceptó, después de comer. Un VP de Ventas empieza en {n} días; hasta entonces el CEO sigue vendiendo.", "sales.vp_coming":"Un VP de Ventas toma el relevo en {n} días.", +"sales.w_anyway":{"one":"firmó una de ellas igualmente","other":"firmó {n} de ellas igualmente"}, +"sales.w_declined":{"one":"rechazó una oferta diminuta","other":"rechazó {n} ofertas diminutas"}, +"sales.w_last":"La semana pasada {name} {list}.", +"sales.w_now":"Esta semana {name} {list}.", +"sales.w_signed":{"one":"firmó un cliente ({rev}/mes)","other":"firmó {n} clientes ({rev}/mes)"}, "save.cash_in_the_bank":"{cash} en el banco", "save.import_failed_err":"Falló la importación.
{err}", "save.load_name":"¿Cargar {name}?", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index b787b96..1941da6 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -3221,7 +3221,6 @@ "ops.kevin_from_the_night_shift":"Kevin de l'équipe de nuit", "ops.l_broke":{"one":"s'est arrêté au budget de {where}","other":"s'est arrêté au budget de {n} ordres ({where})"}, "ops.l_caches":{"one":"a installé un cache gratuit à {where}","other":"a installé {n} caches gratuits ({where})"}, -"ops.l_decline":{"one":"a refusé une offre minuscule","other":"a refusé {n} offres minuscules"}, "ops.l_decom":{"one":"a rendu une petite wave sur {where}","other":"a rendu {n} petites waves ({where})"}, "ops.l_line":"{name} {list}.", "ops.l_optics":{"one":"a allumé un canal sur {where}","other":"a allumé {n} canaux ({where})"}, @@ -3233,7 +3232,6 @@ "ops.l_repair":{"one":"a accéléré une réparation","other":"a accéléré {n} réparations"}, "ops.l_routers":{"one":"a mis à niveau les routeurs à {where}","other":"a mis à niveau les routeurs à {n} endroits ({where})"}, "ops.l_rs":{"one":"a rejoint un route server","other":"a rejoint {n} route servers"}, -"ops.l_sales":{"one":"a signé un client","other":"a signé {n} clients"}, "ops.l_snag":{"one":"a calé sur {where} et l'a mis en pause en attendant que tu jettes un œil","other":"a calé sur {n} ordres ({where}) et les a mis en pause en attendant que tu jettes un œil"}, "ops.l_transit":{"one":"a renforcé le transit à {where}","other":"a renforcé le transit {n} fois ({where})"}, "ops.locked":"Le NOC recrute des stagiaires à partir du niveau clients {lv}.", @@ -3245,10 +3243,8 @@ "ops.mood_oops":"{name} fait très attention aujourd'hui. Personne ne parle des descriptions d'interface.", "ops.mood_outage":"{name} surveille les graphes de la panne et rafraîchit la page de statut. Beaucoup.", "ops.mood_quiet":"{name} lit tranquillement des RFC. Les graphes sont plats, comme il se doit.", -"ops.mood_sales":"{name} marche un peu plus droit aujourd'hui : quelqu'un a signé pendant sa garde.", "ops.mood_snag":"{name} est tombé sur un truc bizarre, a mis cet ordre en pause et t'a laissé un post-it.", "ops.mood_tracy":"Tracy en est au troisième saut d'un traceroute, avec une seule étoile pour l'instant.", -"ops.never":"jamais", "ops.no_cap":"sans limite", "ops.no_clock":"Pas d'horloge, pas de service : avec ces règles, il n'y a pas de jours où un stagiaire pourrait travailler.", "ops.o_caches":"Accepter les caches gratuits", @@ -3267,18 +3263,14 @@ "ops.o_repair_d":"Payer la réparation express de chaque panne qui en a une, tant que le budget suit.", "ops.o_routers":"Garder les routeurs en avance", "ops.o_routers_d":"Ajouter un routeur, ou passer à la génération suivante là où un second routeur porte le trafic, quand la charge ou les ports dépassent un seuil.", -"ops.o_sales":"Gérer les ventes", -"ops.o_sales_d":"Signer les offres dont les exigences sont remplies avec de la capacité en réserve, et refuser celles qui paient trop peu.", "ops.o_transit":"Garder de la marge de transit", "ops.o_transit_d":"Garder le transit de chaque POP au-dessus d'un multiple de son pic sur 30 jours : un membre LAG de plus, ou une taille de port au-dessus.", "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", -"ops.p_acc":"Accepter les offres prêtes", "ops.p_at":"Au-delà de", "ops.p_g":"À partir de", "ops.p_how":"Comment", "ops.p_keep":"En garder un de secours", -"ops.p_min":"Refuser sous", "ops.p_paid":"Peering payant", "ops.p_pick":"Optiques", "ops.p_prov":"Fournisseur", @@ -3314,7 +3306,6 @@ "ops.w_line":"{name} {list}.", "ops.w_money":"Total de la semaine : {cost} d'entrée, {mo}/mois.", "ops.w_oops":{"one":"a fait une petite bourde","other":"a fait {n} petites bourdes"}, -"ops.w_sales":{"one":"a signé un client ({rev}/mois)","other":"a signé {n} clients ({rev}/mois)"}, "optic_counts.apply_price":"Appliquer · {price}", "optic_counts.count_for_model":"Nombre de canaux {model}", "optic_counts.only_n_channels_free":"Il ne reste que {n} canaux libres sur cette fibre.", @@ -4081,6 +4072,7 @@ "requirements.n_400g_alien_wave_on_your":{"one":"{n}× longueur d’onde alien 400G sur ta fibre {a}–{b}","other":"{n}× longueurs d’onde alien 400G sur ta fibre {a}–{b}"}, "requirements.needs_low_loss_reach_into_china":"Veut un accès vers la Chine à faible perte", "requirements.one_way_latency_within_max_ms":"Latence aller simple sous {max} ms (meilleure actuelle : {best})", +"requirements.promised_a_full_sky":"Un ciel plein promis : une croûte à au moins {p} en orbite", "requirements.refuses_cogentle_transit_anywhere_on":"Refuse le transit Cogentle partout sur ton réseau (longue histoire)", "requirements.their_ceo_hates_puns_please_do":"Leur PDG déteste les jeux de mots. Merci de ne pas mentionner les noms des réseaux.", "requirements.two_data_centers_in_every_metro":"Deux datacenters dans chaque métropole qu’il touche", @@ -4286,8 +4278,15 @@ "rules.your_pager_never_sleeps":"Ton bipeur ne dort jamais.", "sales.ask_vp":"Demander un VP Ventes au conseil · {cost}", "sales.at_desk":"{name} gère les ventes", +"sales.auto":"Signe les contrats pour vous", +"sales.auto_ceo":"{name} signe les offres que votre réseau peut servir aujourd'hui, un essai par jour. Il refuse aussi celles sous votre minimum, même si de temps en temps il a déjà topé.", +"sales.auto_eng":"{name} signe les offres que votre réseau peut servir aujourd'hui, après avoir essayé chacune sur le réseau (une par jour), et refuse celles qui paient moins que votre minimum.", +"sales.auto_shark":"{name} signe chaque offre dès qu'elle arrive, promesses comprises, tant que vous pouvez payer la commission, et refuse celles qui paient moins que votre minimum.", +"sales.by_hand":"Personne ne s'occupe des ventes, donc vous signez chaque contrat à la main. Embauchez un commercial, ou laissez faire le PDG, et il pourra signer pour vous.", "sales.ceo_d":"Gratuit, et convaincu. Tous les deux mois, il signe un énorme contrat sur le terrain de golf à -30 %, souvent avec une promesse que personne n'a vérifiée, et de temps en temps une offre que vous aviez refusée. A des avis sur tout. Impossible à licencier.", "sales.ceo_golf":"Le PDG a signé {name} sur le terrain de golf : {bw} à {city} pour {price}/mois, 30 % sous le tarif.", +"sales.ceo_golf_skip":"Le Fondateur a séché le golf : les marchés sont trop nerveux. Le PDG a joué seul et n'a rien signé en orbite.", +"sales.ceo_golf_sky":"Le PDG et le Fondateur ont signé {name} sur le terrain de golf : {bw} en orbite au-dessus de {city} pour {price}/mois, {p} sous le tarif.", "sales.ceo_n":"Le PDG, qui vend mieux que personne", "sales.ceo_override":"Vous avez refusé {name}, mais le PDG avait déjà topé. C'est maintenant un client.", "sales.ceo_promised":"Il a aussi promis : {req}.", @@ -4299,27 +4298,38 @@ "sales.ceo_say_napkin":"J'ai chiffré le prochain contrat sur une serviette. L'ingénierie réglera les détails.", "sales.ceo_say_synergy":"Nous ne vendons pas de la bande passante, nous vendons de la synergie. Mettez ça sur le site.", "sales.ceo_says":"Le PDG : « {say} »", +"sales.ceo_sky":"En orbite : une partie de golf sur deux se joue avec le Fondateur, pour le plus gros contrat en orbite qui rentre, à -30 %. Les marchés nerveux lui coûtent : des prix plus bas en orbite, et pas de golf du tout quand ils sont très nerveux.", "sales.ceo_took_over":"{name} a pris les ventes en main personnellement. Il est sûr de vendre mieux que personne.", "sales.commission":"{name} a signé. Commission du requin : {cost}.", +"sales.decline_below":"Refuser sous", "sales.desk":"Service commercial", "sales.eng_booked":"{name} vous a inscrit à {conf} à {city} ({cost}). Le badge est déjà prêt.", "sales.eng_d":"Ancien ingénieur réseau, il a un badge de chaque NOG. Il vous inscrit à toutes (vous payez le billet), apporte beaucoup de petits et moyens contrats mais jamais les très gros, et ne vend que ce que le réseau sait faire : les clients restent. Les geeks adorent Dave. Il négocie mal.", "sales.eng_n":"L'ingénieur devenu commercial-droïde", "sales.eng_s":"Dave", +"sales.eng_sky":"En orbite : ne vend que là où l'antenne d'atterrissage a de la marge, et ces clients restent comme les geeks.", "sales.fired":"{name} a vidé son bureau. Le service commercial est libre.", "sales.hire_sales":"Recruter un commercial", "sales.hired":"{name} rejoint le service commercial. Attendez-vous à des contrats dans son style.", "sales.intro":"Une seule personne gère les ventes. Chacune apporte des contrats à sa façon, et les clients qu'elle signe s'en souviennent à l'échéance.", "sales.let_ceo":"Laisser le PDG s'en charger", "sales.locked":"Le service commercial ouvre au niveau clients {lv}.", +"sales.never":"jamais", "sales.one_at_a_time":"Une seule à la fois : laissez-la partir pour en recruter une autre.", +"sales.p_sign":"Signer les contrats", "sales.pitch":"Un commercial apporte des contrats à sa façon. Choisissez qui.", "sales.shark_d":"Décroche les plus gros contrats un quart plus cher, et prend un mois de chaque contrat en commission. Survend : la moitié arrive avec une promesse que votre réseau ne tient pas encore, et ces clients partent plus tôt. Ignore les geeks : pas de clients techniques, pas de NOG, et les équipes peering vous demandent un quart de trafic en plus. Gagne la plupart des négociations.", "sales.shark_n":"Le requin", "sales.shark_s":"Chad", +"sales.shark_sky":"En orbite : appelle d'abord les compagnies aériennes et les croisières, à la plus grande taille et un quart plus cher, et promet à la moitié un ciel plein avant que vous l'ayez. Ils râlent jusqu'à ce que ce soit le cas.", "sales.vp_arrived":"Le VP Ventes a pris son poste, et le PDG est retourné à la stratégie. Le service commercial est libre : recrutez quelqu'un.", "sales.vp_asked":"Le conseil a dit oui, après le déjeuner. Un VP Ventes arrive dans {n} jours ; d'ici là, le PDG continue de vendre.", "sales.vp_coming":"Un VP Ventes prend le relais dans {n} jours.", +"sales.w_anyway":{"one":"en a signé une quand même","other":"en a signé {n} quand même"}, +"sales.w_declined":{"one":"a refusé une offre minuscule","other":"a refusé {n} offres minuscules"}, +"sales.w_last":"La semaine dernière, {name} {list}.", +"sales.w_now":"Cette semaine, {name} {list}.", +"sales.w_signed":{"one":"a signé un client ({rev}/mois)","other":"a signé {n} clients ({rev}/mois)"}, "save.cash_in_the_bank":"{cash} en banque", "save.import_failed_err":"Échec de l’import.
{err}", "save.load_name":"Charger {name} ?", diff --git a/site/i18n/it.js b/site/i18n/it.js index 71b2ced..20cf0c8 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -3221,7 +3221,6 @@ "ops.kevin_from_the_night_shift":"Kevin del turno di notte", "ops.l_broke":{"one":"si è fermato al budget di {where}","other":"si è fermato al budget di {n} ordini ({where})"}, "ops.l_caches":{"one":"ha montato una cache gratuita a {where}","other":"ha montato {n} cache gratuite ({where})"}, -"ops.l_decline":{"one":"ha rifiutato un'offerta minuscola","other":"ha rifiutato {n} offerte minuscole"}, "ops.l_decom":{"one":"ha restituito una wave piccola su {where}","other":"ha restituito {n} wave piccole ({where})"}, "ops.l_line":"{name} {list}.", "ops.l_optics":{"one":"ha acceso un canale su {where}","other":"ha acceso {n} canali ({where})"}, @@ -3233,7 +3232,6 @@ "ops.l_repair":{"one":"ha accelerato una riparazione","other":"ha accelerato {n} riparazioni"}, "ops.l_routers":{"one":"ha potenziato i router a {where}","other":"ha potenziato i router in {n} posti ({where})"}, "ops.l_rs":{"one":"si è unito a un route server","other":"si è unito a {n} route server"}, -"ops.l_sales":{"one":"ha firmato un cliente","other":"ha firmato {n} clienti"}, "ops.l_snag":{"one":"si è bloccato su {where} e l'ha messo in pausa finché non dai un'occhiata","other":"si è bloccato su {n} ordini ({where}) e li ha messi in pausa finché non dai un'occhiata"}, "ops.l_transit":{"one":"ha aumentato il transit a {where}","other":"ha aumentato il transit {n} volte ({where})"}, "ops.locked":"Il NOC assume stagisti dal livello clienti {lv}.", @@ -3245,10 +3243,8 @@ "ops.mood_oops":"{name} oggi va con i piedi di piombo. Nessuno nomini le descrizioni delle interfacce.", "ops.mood_outage":"{name} guarda i grafici del guasto e ricarica la pagina di stato. Parecchio.", "ops.mood_quiet":"{name} legge RFC in santa pace. I grafici sono piatti, come devono essere.", -"ops.mood_sales":"{name} cammina un po' più dritto oggi: qualcuno ha firmato nel suo turno.", "ops.mood_snag":"{name} ha trovato qualcosa di strano, ha messo in pausa quell'ordine e ti ha lasciato un post-it.", "ops.mood_tracy":"Tracy è al terzo hop di un traceroute, con un solo asterisco per ora.", -"ops.never":"mai", "ops.no_cap":"nessun limite", "ops.no_clock":"Niente orologio, niente turni: con queste regole non ci sono giorni in cui uno stagista possa lavorare.", "ops.o_caches":"Accetta cache gratuite", @@ -3267,18 +3263,14 @@ "ops.o_repair_d":"Paga la riparazione urgente di ogni guasto che ce l'ha, finché il budget regge.", "ops.o_routers":"Router sempre avanti", "ops.o_routers_d":"Aggiungi un router, o passa alla generazione successiva dove un secondo router regge il traffico, quando carico o porte superano una soglia.", -"ops.o_sales":"Gestisci le vendite", -"ops.o_sales_d":"Firma le offerte i cui requisiti sono soddisfatti con capacità in avanzo, e rifiuta quelle che pagano troppo poco.", "ops.o_transit":"Margine di transit", "ops.o_transit_d":"Tieni il transit di ogni POP sopra un multiplo del suo picco a 30 giorni: un membro LAG in più, o una porta più grande.", "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", -"ops.p_acc":"Accetta offerte pronte", "ops.p_at":"Oltre", "ops.p_g":"Da", "ops.p_how":"Come", "ops.p_keep":"Tienine uno di scorta", -"ops.p_min":"Rifiuta sotto", "ops.p_paid":"Peering a pagamento", "ops.p_pick":"Ottiche", "ops.p_prov":"Fornitore", @@ -3314,7 +3306,6 @@ "ops.w_line":"{name} {list}.", "ops.w_money":"Totale della settimana: {cost} subito, {mo}/mese.", "ops.w_oops":{"one":"ha fatto un piccolo pasticcio","other":"ha fatto {n} piccoli pasticci"}, -"ops.w_sales":{"one":"ha firmato un cliente ({rev}/mese)","other":"ha firmato {n} clienti ({rev}/mese)"}, "optic_counts.apply_price":"Applica · {price}", "optic_counts.count_for_model":"Numero di canali {model}", "optic_counts.only_n_channels_free":"Su questa fibra sono liberi solo {n} canali.", @@ -4081,6 +4072,7 @@ "requirements.n_400g_alien_wave_on_your":{"one":"{n}× alien wave 400G sulla tua fibra {a}–{b}","other":"{n}× alien wave 400G sulla tua fibra {a}–{b}"}, "requirements.needs_low_loss_reach_into_china":"Vuole raggiungere la Cina con poche perdite", "requirements.one_way_latency_within_max_ms":"Latenza di sola andata entro {max} ms (migliore ora: {best})", +"requirements.promised_a_full_sky":"Promesso un cielo pieno: una crosta almeno al {p} in orbita", "requirements.refuses_cogentle_transit_anywhere_on":"Rifiuta il transit Cogentle ovunque sulla tua rete (lunga storia)", "requirements.their_ceo_hates_puns_please_do":"Il loro CEO odia i giochi di parole. Per favore, non citare i nomi delle reti.", "requirements.two_data_centers_in_every_metro":"Due data center in ogni area metropolitana che tocca", @@ -4286,8 +4278,15 @@ "rules.your_pager_never_sleeps":"Il tuo cercapersone non dorme mai.", "sales.ask_vp":"Chiedi al consiglio un VP vendite · {cost}", "sales.at_desk":"{name} gestisce le vendite", +"sales.auto":"Firma i contratti per te", +"sales.auto_ceo":"{name} firma le offerte che la tua rete può servire oggi, una prova al giorno. Rifiuta anche quelle sotto il tuo minimo, anche se ogni tanto ha già stretto la mano.", +"sales.auto_eng":"{name} firma le offerte che la tua rete può servire oggi, dopo averle provate sulla rete (una al giorno), e rifiuta quelle che pagano meno del tuo minimo.", +"sales.auto_shark":"{name} firma ogni offerta appena arriva, promesse comprese, finché puoi pagare la provvigione, e rifiuta quelle che pagano meno del tuo minimo.", +"sales.by_hand":"Nessuno si occupa delle vendite, quindi firmi ogni contratto a mano. Assumi un venditore, o lascia fare al CEO, e potrà firmare per te.", "sales.ceo_d":"Gratis, e convinto. Ogni paio di mesi firma un contratto enorme sul campo da golf con il 30% di sconto, spesso con una promessa che nessuno ha controllato, e ogni tanto firma un'offerta che avevi rifiutato. Ha opinioni. Non si può licenziare.", "sales.ceo_golf":"Il CEO ha firmato {name} sul campo da golf: {bw} a {city} per {price}/mese, il 30% sotto listino.", +"sales.ceo_golf_skip":"Il Fondatore ha saltato il golf: i mercati sono troppo nervosi. Il CEO ha giocato da solo e non ha firmato niente in orbita.", +"sales.ceo_golf_sky":"Il CEO e il Fondatore hanno firmato {name} sul campo da golf: {bw} in orbita sopra {city} per {price}/mese, il {p} sotto listino.", "sales.ceo_n":"Il CEO, che vende meglio di chiunque", "sales.ceo_override":"Hai rifiutato {name}, ma il CEO aveva già stretto la mano. Ora sono clienti.", "sales.ceo_promised":"Ha anche promesso: {req}.", @@ -4299,27 +4298,38 @@ "sales.ceo_say_napkin":"Ho fatto il prezzo del prossimo contratto su un tovagliolo. L'ingegneria sistemerà i dettagli.", "sales.ceo_say_synergy":"Non vendiamo banda, vendiamo sinergia. Mettetelo sul sito.", "sales.ceo_says":"Il CEO: «{say}»", +"sales.ceo_sky":"In orbita: una partita di golf su due la gioca con il Fondatore, per il contratto in orbita più grande che ci sta, con il 30% di sconto. I mercati nervosi gli costano: prezzi in orbita più bassi, e niente golf quando sono molto nervosi.", "sales.ceo_took_over":"{name} ha preso in mano le vendite di persona. È sicuro di vendere meglio di chiunque.", "sales.commission":"{name} ha firmato. Provvigione per lo squalo: {cost}.", +"sales.decline_below":"Rifiuta sotto", "sales.desk":"Ufficio vendite", "sales.eng_booked":"{name} ti ha iscritto a {conf} a {city} ({cost}). Ha già il badge.", "sales.eng_d":"Era un ingegnere di rete e ora ha il badge di ogni NOG. Ti iscrive a tutti (il biglietto lo paghi tu), porta tanti contratti piccoli e medi ma mai quelli davvero grandi, e vende solo ciò che la rete sa fare, così i clienti restano. I nerd adorano Dave. Tratta male.", "sales.eng_n":"L'ingegnere diventato venditore-droide", "sales.eng_s":"Dave", +"sales.eng_sky":"In orbita: vende solo dove la parabola di atterraggio ha spazio d'avanzo, e quei clienti restano come i nerd.", "sales.fired":"{name} ha svuotato la scrivania. L'ufficio vendite è libero.", "sales.hire_sales":"Assumi un venditore", "sales.hired":"{name} è entrato nelle vendite. Aspettati contratti nel suo stile.", "sales.intro":"Una persona alla volta gestisce le vendite. Ognuna porta contratti a modo suo, e i clienti che firma se ne ricordano alla scadenza.", "sales.let_ceo":"Lascia fare al CEO", "sales.locked":"L'ufficio vendite apre al livello clienti {lv}.", +"sales.never":"mai", "sales.one_at_a_time":"Uno alla volta: lascialo andare per assumerne un altro.", +"sales.p_sign":"Firma contratti", "sales.pitch":"Un venditore porta contratti a modo suo. Scegli chi.", "sales.shark_d":"Porta i contratti più grandi a un quarto in più, e si prende un mese di ogni contratto come provvigione. Vende troppo: metà arriva con una promessa che la tua rete non mantiene ancora, e quei clienti se ne vanno prima. Ignora i nerd: niente clienti tecnici, niente incontri, e i peering desk ti chiedono un quarto di traffico in più. Vince quasi tutte le trattative.", "sales.shark_n":"Lo squalo", "sales.shark_s":"Chad", +"sales.shark_sky":"In orbita: chiama prima compagnie aeree e navi da crociera, alla taglia più grande e a un quarto in più, e a metà promette un cielo pieno prima che tu ce l'abbia. Brontolano finché non arriva.", "sales.vp_arrived":"Il VP vendite ha iniziato, e il CEO è tornato alla strategia. L'ufficio vendite è libero: assumi qualcuno.", "sales.vp_asked":"Il consiglio ha detto sì, dopo pranzo. Un VP vendite inizia tra {n} giorni; fino ad allora il CEO continua a vendere.", "sales.vp_coming":"Un VP vendite subentra tra {n} giorni.", +"sales.w_anyway":{"one":"ne ha firmata una lo stesso","other":"ne ha firmate {n} lo stesso"}, +"sales.w_declined":{"one":"ha rifiutato un'offerta minuscola","other":"ha rifiutato {n} offerte minuscole"}, +"sales.w_last":"La settimana scorsa {name} {list}.", +"sales.w_now":"Questa settimana {name} {list}.", +"sales.w_signed":{"one":"ha firmato un cliente ({rev}/mese)","other":"ha firmato {n} clienti ({rev}/mese)"}, "save.cash_in_the_bank":"{cash} in cassa", "save.import_failed_err":"Importazione fallita.
{err}", "save.load_name":"Caricare {name}?", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 1db0fd0..9c5555e 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -3221,7 +3221,6 @@ "ops.kevin_from_the_night_shift":"Kevin do turno da noite", "ops.l_broke":{"one":"parou no orçamento de {where}","other":"parou no orçamento de {n} ordens ({where})"}, "ops.l_caches":{"one":"instalou um cache grátis em {where}","other":"instalou {n} caches grátis ({where})"}, -"ops.l_decline":{"one":"recusou uma oferta minúscula","other":"recusou {n} ofertas minúsculas"}, "ops.l_decom":{"one":"devolveu uma wave pequena em {where}","other":"devolveu {n} waves pequenas ({where})"}, "ops.l_line":"{name} {list}.", "ops.l_optics":{"one":"acendeu um canal em {where}","other":"acendeu {n} canais ({where})"}, @@ -3233,7 +3232,6 @@ "ops.l_repair":{"one":"acelerou um reparo","other":"acelerou {n} reparos"}, "ops.l_routers":{"one":"melhorou os roteadores em {where}","other":"melhorou os roteadores em {n} lugares ({where})"}, "ops.l_rs":{"one":"entrou em um route server","other":"entrou em {n} route servers"}, -"ops.l_sales":{"one":"fechou com um cliente","other":"fechou com {n} clientes"}, "ops.l_snag":{"one":"travou em {where} e pausou a ordem até você dar uma olhada","other":"travou em {n} ordens ({where}) e pausou-as até você dar uma olhada"}, "ops.l_transit":{"one":"reforçou o trânsito em {where}","other":"reforçou o trânsito {n} vezes ({where})"}, "ops.locked":"O NOC contrata estagiários a partir do nível de clientes {lv}.", @@ -3245,10 +3243,8 @@ "ops.mood_oops":"{name} está tomando muito cuidado hoje. Ninguém fale das descrições das interfaces.", "ops.mood_outage":"{name} está olhando os gráficos da pane e recarregando a página de status. Muito.", "ops.mood_quiet":"{name} lê RFCs em paz. Os gráficos estão planos, como deve ser.", -"ops.mood_sales":"{name} está andando um pouco mais ereto hoje: alguém assinou no seu turno.", "ops.mood_snag":"{name} encontrou algo estranho, pausou essa ordem e deixou um post-it para você.", "ops.mood_tracy":"Tracy está no terceiro salto de um traceroute, com só um asterisco até agora.", -"ops.never":"nunca", "ops.no_cap":"sem limite", "ops.no_clock":"Sem relógio, sem turnos: com estas regras não há dias para um estagiário trabalhar.", "ops.o_caches":"Aceitar caches grátis", @@ -3267,18 +3263,14 @@ "ops.o_repair_d":"Pagar o reparo urgente de cada queda que tenha um, enquanto o orçamento durar.", "ops.o_routers":"Roteadores à frente", "ops.o_routers_d":"Adicionar um roteador, ou trocar para a próxima geração onde um segundo roteador segura o tráfego, quando a carga ou as portas passarem de um nível.", -"ops.o_sales":"Cuidar das vendas", -"ops.o_sales_d":"Fechar as ofertas cujos requisitos estão atendidos com capacidade de sobra e recusar as que pagam pouco demais.", "ops.o_transit":"Folga de trânsito", "ops.o_transit_d":"Manter o trânsito de cada POP acima de um múltiplo do seu pico de 30 dias: mais um membro LAG, ou um tamanho de porta acima.", "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", -"ops.p_acc":"Aceitar ofertas prontas", "ops.p_at":"Acima de", "ops.p_g":"A partir de", "ops.p_how":"Como", "ops.p_keep":"Manter um de reserva", -"ops.p_min":"Recusar abaixo de", "ops.p_paid":"Peering pago", "ops.p_pick":"Ópticas", "ops.p_prov":"Provedor", @@ -3314,7 +3306,6 @@ "ops.w_line":"{name} {list}.", "ops.w_money":"Total da semana: {cost} de entrada, {mo}/mês.", "ops.w_oops":{"one":"cometeu um pequeno deslize","other":"cometeu {n} pequenos deslizes"}, -"ops.w_sales":{"one":"assinou um cliente ({rev}/mês)","other":"assinou {n} clientes ({rev}/mês)"}, "optic_counts.apply_price":"Aplicar · {price}", "optic_counts.count_for_model":"Número de canais {model}", "optic_counts.only_n_channels_free":"Só há {n} canais livres nesta fibra.", @@ -4081,6 +4072,7 @@ "requirements.n_400g_alien_wave_on_your":{"one":"{n}× alien wave 400G na sua fibra {a}–{b}","other":"{n}× alien waves 400G na sua fibra {a}–{b}"}, "requirements.needs_low_loss_reach_into_china":"Precisa chegar na China com pouca perda", "requirements.one_way_latency_within_max_ms":"Latência de ida até {max} ms (melhor agora: {best})", +"requirements.promised_a_full_sky":"Prometeu um céu cheio: uma crosta com pelo menos {p} em órbita", "requirements.refuses_cogentle_transit_anywhere_on":"Recusa transit da Cogentle em qualquer ponto da sua rede (longa história)", "requirements.their_ceo_hates_puns_please_do":"O CEO deles odeia trocadilhos. Por favor, não mencione os nomes das redes.", "requirements.two_data_centers_in_every_metro":"Dois data centers em toda metro que tocar", @@ -4286,8 +4278,15 @@ "rules.your_pager_never_sleeps":"O seu pager nunca dorme.", "sales.ask_vp":"Pedir ao conselho um VP de Vendas · {cost}", "sales.at_desk":"{name} cuida das vendas", +"sales.auto":"Assina contratos por você", +"sales.auto_ceo":"{name} assina as ofertas que sua rede consegue atender hoje, um teste por dia. Ele também recusa as que ficam abaixo do seu mínimo, mas de vez em quando já apertou a mão.", +"sales.auto_eng":"{name} assina as ofertas que sua rede consegue atender hoje, depois de testar cada uma na rede (uma por dia), e recusa as que pagam menos que o seu mínimo.", +"sales.auto_shark":"{name} assina toda oferta assim que ela chega, com promessas e tudo, desde que você possa pagar a comissão, e recusa as que pagam menos que o seu mínimo.", +"sales.by_hand":"Ninguém cuida das vendas, então você assina cada contrato à mão. Contrate um vendedor, ou deixe o CEO cuidar, e ele pode assinar por você.", "sales.ceo_d":"De graça, e convicto. A cada dois meses fecha um contrato enorme no campo de golfe com 30% de desconto, muitas vezes com uma promessa que ninguém conferiu, e de vez em quando assina uma oferta que você recusou. Tem opiniões. Não pode ser demitido.", "sales.ceo_golf":"O CEO fechou com {name} no campo de golfe: {bw} em {city} por {price}/mês, 30% abaixo da tabela.", +"sales.ceo_golf_skip":"O Fundador faltou ao golfe: os mercados estão nervosos demais. O CEO jogou sozinho e não assinou nada em órbita.", +"sales.ceo_golf_sky":"O CEO e o Fundador fecharam com {name} no campo de golfe: {bw} em órbita sobre {city} por {price}/mês, {p} abaixo da tabela.", "sales.ceo_n":"O CEO, que vende melhor que ninguém", "sales.ceo_override":"Você recusou {name}, mas o CEO já tinha apertado a mão. Agora são clientes.", "sales.ceo_promised":"Ele também prometeu: {req}.", @@ -4299,27 +4298,38 @@ "sales.ceo_say_napkin":"Fiz o preço do próximo contrato num guardanapo. A engenharia resolve os detalhes.", "sales.ceo_say_synergy":"Não vendemos banda, vendemos sinergia. Coloquem isso no site.", "sales.ceo_says":"O CEO: “{say}”", +"sales.ceo_sky":"Em órbita: metade das partidas de golfe é com o Fundador, pelo maior contrato em órbita que couber, com 30% de desconto. Mercados nervosos custam caro: preços menores em órbita, e nada de golfe quando estão muito nervosos.", "sales.ceo_took_over":"{name} assumiu as vendas pessoalmente. Tem certeza de que vende melhor que ninguém.", "sales.commission":"{name} assinou. Comissão do tubarão: {cost}.", +"sales.decline_below":"Recusar abaixo de", "sales.desk":"Vendas", "sales.eng_booked":"{name} inscreveu você no {conf} em {city} ({cost}). O crachá já está pronto.", "sales.eng_d":"Era engenheiro de redes e agora tem o crachá de cada NOG. Inscreve você em todas (o ingresso é por sua conta), traz muitos negócios pequenos e médios, mas nunca os realmente grandes, e só vende o que a rede consegue entregar, então os clientes ficam. Os nerds adoram o Dave. Negocia mal.", "sales.eng_n":"O engenheiro que virou vendedroide", "sales.eng_s":"Dave", +"sales.eng_sky":"Em órbita: só vende onde a antena de pouso tem folga, e esses clientes ficam como os nerds.", "sales.fired":"{name} esvaziou a mesa. Vendas está livre.", "sales.hire_sales":"Contratar vendas", "sales.hired":"{name} entrou em vendas. Espere negócios no estilo dele.", "sales.intro":"Uma pessoa por vez cuida das vendas. Cada uma traz negócios do seu jeito, e os clientes que ela fecha lembram disso quando o contrato vence.", "sales.let_ceo":"Deixar o CEO cuidar", "sales.locked":"Vendas abre no nível de clientes {lv}.", +"sales.never":"nunca", "sales.one_at_a_time":"Uma por vez: dispense para contratar outra.", +"sales.p_sign":"Assinar contratos", "sales.pitch":"Uma pessoa de vendas traz negócios do jeito dela. Escolha quem.", "sales.shark_d":"Fecha os maiores negócios por um quarto a mais, e leva um mês de cada contrato de comissão. Vende demais: metade chega com uma promessa que sua rede ainda não cumpre, e esses clientes saem mais cedo. Ignora os nerds: nada de clientes técnicos nem de encontros, e as equipes de peering pedem um quarto a mais de tráfego. Ganha quase todas as negociações.", "sales.shark_n":"O tubarão", "sales.shark_s":"Chad", +"sales.shark_sky":"Em órbita: liga primeiro para companhias aéreas e cruzeiros, no maior tamanho e por um quarto a mais, e promete a metade deles um céu cheio antes de você ter um. Eles reclamam até você ter.", "sales.vp_arrived":"O VP de Vendas começou, e o CEO voltou para a estratégia. Vendas está livre: contrate alguém.", "sales.vp_asked":"O conselho aprovou, depois do almoço. Um VP de Vendas começa em {n} dias; até lá o CEO continua vendendo.", "sales.vp_coming":"Um VP de Vendas assume em {n} dias.", +"sales.w_anyway":{"one":"assinou uma delas mesmo assim","other":"assinou {n} delas mesmo assim"}, +"sales.w_declined":{"one":"recusou uma oferta minúscula","other":"recusou {n} ofertas minúsculas"}, +"sales.w_last":"Semana passada {name} {list}.", +"sales.w_now":"Esta semana {name} {list}.", +"sales.w_signed":{"one":"assinou um cliente ({rev}/mês)","other":"assinou {n} clientes ({rev}/mês)"}, "save.cash_in_the_bank":"{cash} no banco", "save.import_failed_err":"Falha na importação.
{err}", "save.load_name":"Carregar {name}?", diff --git a/src/agent/20-commands.js b/src/agent/20-commands.js index 62cdc99..508872a 100644 --- a/src/agent/20-commands.js +++ b/src/agent/20-commands.js @@ -241,6 +241,10 @@ const API_CMD={ doc:'Let the salesperson go (not the CEO: ask the board for a VP of Sales instead).'}, salesVp:{args:[], doc:'With the CEO running sales: pay for a board meeting that brings a VP of Sales, who frees the desk a month later.'}, + salesAuto:{args:[],watch:['slAuto'], + doc:'With someone at the sales desk: switch automatic signing on or off. Once a game day they sign the offers that fit, in their own style: eng and ceo after a routing trial (one a day; an offer that did not fit waits a week), shark every offer whose POPs are up, promises and all, while the cash covers the commission. Orbit offers sign where the landing dish has room (the shark ignores that). Nobody at the desk: nothing is signed for you.'}, + salesMin:{args:[],watch:['slAuto'], + doc:'Step the minimum monthly value under which the sales desk declines offers: never, 2k, 5k, 10k, 25k, 50k. With the CEO, about one decline in three is signed anyway.'}, renewMatch:{args:[['id','entityId']],watch:['biz.#id'], doc:'Answer a renewal haggle (a customer with hag): renew at the price they asked. Unanswered, this happens on its own when the term ends.'}, renewMeet:{args:[['id','entityId']],watch:['biz.#id'], @@ -325,7 +329,7 @@ const API_CMD={ opsCap:{args:[['k','opsKey']],watch:['ops'], doc:'Step the monthly budget of an order that has one: 10k, 25k, 50k, 100k, 250k, no limit.'}, opsFloor:{args:[],watch:['ops'], - doc:'Step the floor under your cash that the intern keeps clear when signing customers: 0, 50k, 250k, 1M, 5M.'}, + doc:'Step the floor under your cash that the intern keeps clear when paying for jobs: 0, 50k, 250k, 1M, 5M.'}, opsPop:{args:[['k','opsPopKind'],['city','cityId']],watch:['ops'], doc:'Add or remove one POP as an exception to an order: the intern never touches the POPs you except.'}, opsTpl:{args:[['k','opsTplKey']],watch:['ops'], diff --git a/src/agent/30-docs.js b/src/agent/30-docs.js index d37b6e3..7644d07 100644 --- a/src/agent/30-docs.js +++ b/src/agent/30-docs.js @@ -35,7 +35,8 @@ const API_STATE_DOC={ nni:{type:'array',doc:'Fabric ports: city, provider, tier.'}, biz:{type:'array',doc:'Signed customers: type, cities, bandwidth, rate, mood, contract dates (te: the day the term ends, mk: the bandwidth market it was priced in, hag: an open renewal haggle {rate, until}).'}, offers:{type:'array',doc:'Pending customer offers, each expiring on a day (mk: the bandwidth market they were priced in; refN: the customer who referred them).'}, - sales:{type:'map',doc:'The sales desk: p (eng, shark, ceo or null), hired (day), vp (the day a VP of Sales takes over from the CEO), golf and say (the CEO\'s next golf deal and opinion). Offers and customers carry by: who brought or signed them.'}, + sales:{type:'map',doc:'The sales desk: p (eng, shark, ceo or null), hired (day), vp (the day a VP of Sales takes over from the CEO), golf and say (the CEO\'s next golf deal and opinion). Offers and customers carry by: who brought or signed them, orbit ones too (the shark\'s may carry the skyfull promise).'}, + slAuto:{type:'map',doc:'Deals the sales desk signs for you (only while someone runs sales): on (sign offers that fit), min (decline offers paying less a month; 0 never), wk (this week: w, p who was at the desk, n signed, rev their monthly revenue, x declined, y declined but signed anyway by the CEO) and rep (last week, the same).'}, cl:{type:'map',doc:'Customer lifecycle (#178): odd (the day of the last unusual departure) and mo, one entry a month of customers won, renewed, grown, haggling and lost by reason.'}, done:{type:'map',doc:'Goals landed, by goal id → day.'}, ach:{type:'map',doc:'Badges earned this game, by badge id → day.'}, @@ -57,7 +58,7 @@ const API_STATE_DOC={ ppol:{type:'string',doc:'Your published peering policy: open | selective | closed.'}, pdesk:{type:'map',doc:'This week\'s peering desk summary: sessions accepted and declined at which exchanges.'}, pdeskRep:{type:'map',doc:'Last week\'s peering desk summary, as the NOC log reported it.'}, - ops:{type:'map',doc:'The NOC intern: who is hired, each standing order\'s on/off switch and settings, the monthly budget and what it spent, per-POP exceptions, the new-POP template and the weekly log.'}, + ops:{type:'map',doc:'The NOC intern: who is hired, each standing order\'s on/off switch and settings (network work only: deals belong to the sales desk, slAuto), the monthly budget and what it spent, per-POP exceptions, the new-POP template and the weekly log.'}, core:{type:'map',doc:'Your backbone technology: lv bought, the level it runs at, the interop lab.'}, ddosAuto:{type:'map',doc:'The NOC\'s auto-mitigation switches: rtbh and scrub.'}, popStd:{type:'map',doc:'The standard POP: router model and count new POPs start with, or null for none.'}, diff --git a/src/game/60-features/38-sales-desk.js b/src/game/60-features/38-sales-desk.js index 2e5e00e..ff2efd0 100644 --- a/src/game/60-features/38-sales-desk.js +++ b/src/game/60-features/38-sales-desk.js @@ -43,8 +43,9 @@ function salesShape(n0){const p=slP();if(!p)return;for(let i=S.offers.length-1;i // A promise nobody checked: a requirement this deal can have, that the network does not meet today. function salesPromise(o){const T=BIZ_T[o.type],pool=Object.keys(REQS).filter(k=>!(o.reqs||[]).includes(k)&&!REQS[k].only&&(!REQS[k].l2||T.l2)&&(!REQS[k].ip||!T.l2)&&reqCan(k,o)).sort(); const no=pool.filter(k=>{try{return !REQS[k].ok(o);}catch(e){return false;}});return no.length?no[Math.floor(slR('promise|'+slKey(o))*no.length)]:null;} -// Their mark at renewal: how much likelier the customers they signed are to leave. -function salesLeaveMul(b){if(b.by==='eng')return SALES_NERDS.includes(b.type)?0.5:0.75;if(b.by==='shark')return 1.5;if(b.by==='ceo')return 1.25;return 1;} +// Their mark at renewal: how much likelier the customers they signed are to leave. The engineer's orbit customers, sold +// only where a dish had room to spare, stay like the nerds do. +function salesLeaveMul(b){if(b.by==='eng')return SALES_NERDS.includes(b.type)||BIZ_T[b.type].orbit?0.5:0.75;if(b.by==='shark')return 1.5;if(b.by==='ceo')return 1.25;return 1;} // Haggles with whoever is at the desk now: how deep the discount they ask, and how often meeting halfway works. const salesAsk=()=>slP()==='eng'?0.72:0.8; const salesMeet=()=>({shark:0.9,eng:0.5,ceo:0.55})[slP()]||0.65; @@ -61,8 +62,9 @@ function salesDay(d){const L=S.sales;if(!L)return; if(p==='ceo'){if(!(L.golf>=d))L.golf=d+50+Math.floor(slR('golf|'+d)*30);else if(d===L.golf){salesGolf(d);L.golf=d+50+Math.floor(slR('golf|'+d)*30);} if(!(L.say>=d))L.say=d+20+Math.floor(slR('say|'+d)*15);else if(d===L.say){toast(tr('sales.ceo_says',{say:tr(SALES_SAY[Math.floor(slR('sayl|'+d)*SALES_SAY.length)])}),'');L.say=d+20+Math.floor(slR('say|'+d)*15);}}} // The golf course: the biggest internet customer this network can take, in its biggest city, at 30% off, signed on the spot. +// With a rocket company, every other game is with the Founder, and in orbit (pieGolf, 99-pie-sales.js). const SALES_GOLF=['metav','cgame','gpu','stream','isp','edu','host','dia']; -function salesGolf(d){const mine=Object.keys(S.pops).filter(c=>popUp(c)&&bizCity(c));if(!mine.length)return; +function salesGolf(d){if(pieGolf(d))return;const mine=Object.keys(S.pops).filter(c=>popUp(c)&&bizCity(c));if(!mine.length)return; const t=SALES_GOLF.find(x=>(BIZ_T[x].lv||1)<=lvl());if(!t)return;const T=BIZ_T[t],city=mine.sort((a,b)=>CITY[b].P-CITY[a].P||(a!S.usedNames.includes(n));const name=list.length?list[Math.floor(slR('golfn|'+d)*list.length)]:(T.names||BIZ_N)[0];useName(name); const o={id:uid(),city,city2:null,name,type:t,bw:T.opts[T.opts.length-1],rate:Math.round((CITY[city].au?T.rate*AU_ARPU:T.rate)*mkt()*0.7),reqs:[],exp:d+40}; @@ -74,4 +76,4 @@ function salesOverride(o){if(slP()!=='ceo'||!o||!bHas(o)||BIZ_T[o.type].event||s // Saves: who is at the desk, the VP on the way, the CEO's calendar; who brought each offer and signed each customer. function salesFix(s){const L=s.sales&&typeof s.sales==='object'&&!Array.isArray(s.sales)?s.sales:{},n=v=>Number.isInteger(v)&&v>=0&&v<1e7?v:null; s.sales={p:own(SALES,L.p)?L.p:null,hired:n(L.hired)||0,vp:L.p==='ceo'?n(L.vp):null,golf:n(L.golf),say:n(L.say)}; - for(const x of [...s.biz,...s.offers])if(x.by!==undefined&&!own(SALES,x.by))delete x.by;} + for(const x of [...s.biz,...s.offers])if(x.by!==undefined&&!own(SALES,x.by))delete x.by;slAutoFix(s);} diff --git a/src/game/60-features/39-sales-auto.js b/src/game/60-features/39-sales-auto.js new file mode 100644 index 0000000..11f3b81 --- /dev/null +++ b/src/game/60-features/39-sales-auto.js @@ -0,0 +1,41 @@ +/* ---------- The sales desk signs deals for you ---------- + Deals belong to Sales, not to the NOC intern. With someone at the desk, the player can let them sign offers once a + game day (S.slAuto.on) and decline the ones that pay less than a minimum (S.slAuto.min). How they sign is who they are: + - the engineer signs only what the network can serve: #185's trial (autoOffer, a full routing pass), at most + SL_TRIALS a day, and an offer that did not fit waits SL_RETRY days; + - the shark signs every offer whose POPs are up the moment it lands, promises and all: no trial, an unkept promise is + the customer's problem. The commission is paid as on any shark deal, so only while the cash covers it; + - the CEO signs like the engineer, and a decline is a handshake away (salesOverride: about one in three he signs anyway). + Orbit offers need no routing pass: the dish they land on (pieServe) must have room, except for the shark. + Nobody at the desk, nothing automatic: every deal is signed by hand. No random numbers are drawn here. */ +const SL_MINS=[0,2000,5000,10000,25000,50000],SL_TRIALS=1,SL_RETRY=7; +const slAutoNew=()=>({on:false,min:0,wk:null,rep:null}); +// Is the desk signing or declining anything today? +const slAutoOn=()=>!!(S&&S.slAuto&&slP()&&(S.slAuto.on||S.slAuto.min)); +// A week's tally: {w: week, p: who was at the desk, n: signed, rev: what they pay a month, x: declined, y: of those, signed anyway}. +function slWkOk(x){if(!x||typeof x!=='object'||Array.isArray(x)||!own(SALES,x.p))return null;const n=v=>int(v,0,1e6,0);return {w:n(x.w),p:x.p,n:n(x.n),rev:int(x.rev,0,1e10,0),x:n(x.x),y:n(x.y)};} +const slWkAny=x=>!!x&&(x.n>0||x.x>0); +function slAutoFix(s){const a=s.slAuto&&typeof s.slAuto==='object'&&!Array.isArray(s.slAuto)?s.slAuto:{}; + s.slAuto={on:a.on===true,min:SL_MINS.includes(a.min)?a.min:0,wk:slWkOk(a.wk),rep:slWkOk(a.rep)};} +// An old save whose intern ran the sales order: the same switch and minimum, now at the sales desk (they run once someone is there). +function slAutoFrom(s,on,p){if(!on||(s.slAuto&&typeof s.slAuto==='object'))return;s.slAuto={on:p.acc!==false,min:SL_MINS.includes(p.min)?p.min:0,wk:null,rep:null};} +// "This week Dave signed 3 customers (+$41k/mo), declined 17 tiny offers." +function slWeekLine(x,last){const parts=[];if(x.n)parts.push(trn('sales.w_signed',x.n,{rev:opsMo$(x.rev)}));if(x.x)parts.push(trn('sales.w_declined',x.x));if(x.y)parts.push(trn('sales.w_anyway',x.y)); + const v={name:tr(SALES[x.p].s),list:parts.join(', ')};return last?tr('sales.w_last',v):tr('sales.w_now',v);} +// An orbit offer fits where its dish has room for it; used: what this shift already signed on each dish. +function slSkyOk(o,used){const L=pieServe(o.city,o.type);if(!L)return null;const k=L.cr+'|'+L.k;return slP()==='shark'||L.left-(used.get(k)||0)>=o.bw?k:null;} +function slAutoDay(d){if(!slAutoOn())return;const A=S.slAuto,p=slP(),w=Math.floor(d/7); + // A new week: last week's tally becomes the report, and the one notice of the week. + if(!A.wk||A.wk.w!==w){if(slWkAny(A.wk)&&A.wk.w${esc(tr('sales.desk'))} ${esc(slWeekLine(A.rep,true))}`,A.rep.rev>0?'good':'',[],{a:'tab',v:'deals'});}A.wk={w,p,n:0,rev:0,x:0,y:0};} + const W=A.wk,used=new Map();W.p=p;let tries=0,dirty=false; + const tried=UI.slTried&&UI.slTried.s===S?UI.slTried.m:(UI.slTried={s:S,m:new Map()}).m; + const won=o=>{if(S.offers.includes(o))return false;W.n++;W.rev+=Math.round(bizMo(o));dirty=true;return true;}; + opsQuiet(()=>{for(const o of S.offers.slice()){if(!S.offers.includes(o))continue;const T=BIZ_T[o.type];if(!T||!(o.exp>d))continue;const v=T.event?(o.fee||0):bizMo(o); + if(A.min&&vb0){W.y++;W.rev+=Math.round(bizMo(o));dirty=true;}continue;} + if(!A.on)continue; + if(T.orbit){const k=slSkyOk(o,used);if(!k||(p==='shark'&&S.cashd)))continue;ACT.accept({id:o.id});won(o);continue;} + // Each trial is a full routing pass: at most SL_TRIALS a day, and an offer that did not fit waits a week. + if(!reqOk(o)||tries>=SL_TRIALS||tried.get(o.id)>d-SL_RETRY)continue;tries++;ACT.accept({id:o.id,auto:true});if(!won(o))tried.set(o.id,d);}}); + if(dirty)compute();} diff --git a/src/game/60-features/80-new-game.js b/src/game/60-features/80-new-game.js index 802b2b4..c661e15 100644 --- a/src/game/60-features/80-new-game.js +++ b/src/game/60-features/80-new-game.js @@ -1,6 +1,6 @@ function newGame(name,home){ S={v:1,name,asn:200000+Math.floor(_rand()*15000),home,day:0,cash:START_CASH, - ltv:2,t1v:4,auV:1,calV:1,pieV:1,pie:null,ops:opsNew(),achP:{},seen:NETS.map(n=>n.id),spares:{},pops:{[home]:{day:0,bb:null,boost:0,down:0,routers:1,gen:false}},links:[],nni:[],transit:[],ixp:{},rs:{},peers:{},pni:[],caches:[],biz:[],offers:[],myIx:{},pairMet:{}, + ltv:2,t1v:4,auV:1,calV:1,pieV:1,pie:null,ops:opsNew(),slAuto:slAutoNew(),achP:{},seen:NETS.map(n=>n.id),spares:{},pops:{[home]:{day:0,bb:null,boost:0,down:0,routers:1,gen:false}},links:[],nni:[],transit:[],ixp:{},rs:{},peers:{},pni:[],caches:[],biz:[],offers:[],myIx:{},pairMet:{}, done:{},inc:[],fleet:{},ev:{ddosMore:[]},ddosStarts:[],priceMul:1,nextFail:45,nextEvent:40,usedNames:[],stats:{survived:0,incidents:0,peak:0},cnLic:{state:'none'},scrubs:[],scrubMode:'always',ddosAuto:{rtbh:false,scrub:true},capDeal:null,core:{lv:0,run:0},popStd:null,won:false,lost:false,neg:0,loans:[],loanOffers:[],loanStrikes:0,ppol:'open',pdesk:null,pdeskRep:null,hw:{},rules:makeRules('oncall'),charter:'global',chartSet:false,demo:{},seatOff:null,solWon:0,monkey:{next:null,on:0}}; } diff --git a/src/game/60-features/90-automation.js b/src/game/60-features/90-automation.js index 528c15a..0bb5dc9 100644 --- a/src/game/60-features/90-automation.js +++ b/src/game/60-features/90-automation.js @@ -1,4 +1,4 @@ -/* The sales engine of #185: would this offer work if signed now? The intern's sales order runs it once a day. +/* The sales engine of #185: would this offer work if signed now? The sales desk runs it once a day (39-sales-auto.js). It trials the new demand on a copy of the game, so a failed trial leaves the live game untouched. */ function offerCustomer(o){return {id:o.id,city:o.city,city2:o.city2||null,reqs:o.reqs||[],latMax:o.latMax||null,route:BIZ_T[o.type].scenic?'scenic':BIZ_T[o.type].lat?'fast':'normal',name:o.name,type:o.type,bw:o.bw,rate:o.rate,mood:100,since:S.day,sites:o.sites||null,start:o.start,dur:o.dur,fee:o.fee,link:o.link,slots:o.slots||0,what:o.what,prov:o.prov,due:BIZ_T[o.type].cap?S.day+o.win:undefined};} function autoOffer(o){if(!o||!own(BIZ_T,o.type)||!(o.exp>S.day)||!(o.bw>0)||o.rate<0||!bCities(o).length||!bCities(o).every(popUp)||!reqOk(o))return null; diff --git a/src/game/60-features/95-standing-orders.js b/src/game/60-features/95-standing-orders.js index 4f10364..f852910 100644 --- a/src/game/60-features/95-standing-orders.js +++ b/src/game/60-features/95-standing-orders.js @@ -8,6 +8,7 @@ const INTERNS={ kevin:{i:'🌙',n:N_('ops.kevin_from_the_night_shift'),s:N_('ops.kevin'),d:N_('ops.kevin_d')}, tracy:{i:'🧭',n:N_('ops.tracy_route'),s:N_('ops.tracy'),d:N_('ops.tracy_d')}, }; +// Deals are not the intern's: the sales desk signs them (39-sales-auto.js). // The orders, in the order the panel shows them. pop: can be switched off per POP. cap: default monthly budget, of setup // fees, or (mo) of the running costs the order adds, for caches, which are free to rack but cost rent every month. const OPS=[ @@ -16,19 +17,18 @@ const OPS=[ {k:'routers',i:'🧠',pop:1,cap:250000,t:N_('ops.o_routers'),d:N_('ops.o_routers_d'),p:{at:{d:80,v:[60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},how:{d:'auto',v:['auto','add','swap'],l:N_('ops.p_how'),f:v=>tr({auto:N_('ops.how_auto'),add:N_('ops.how_add'),swap:N_('ops.how_swap')}[v])}}}, {k:'caches',i:'📦',pop:1,cap:5000,mo:1,t:N_('ops.o_caches'),d:N_('ops.o_caches_d'),p:{g:{d:5,v:[1,5,10,25,50],l:N_('ops.p_g'),f:v=>fmtG(v)}}}, {k:'ix',i:'🔀',t:N_('ops.o_ix'),d:N_('ops.o_ix_d'),p:{}}, - {k:'pni',i:'🤝',pop:1,cap:50000,t:N_('ops.o_pni'),d:N_('ops.o_pni_d'),p:{g:{d:25,v:[5,10,25,50,100],l:N_('ops.p_g'),f:v=>fmtG(v)},tier:{d:0,v:[0,1,2],l:N_('ops.p_tier'),f:v=>tr('ops.at_least_port',{port:PORT[v].n})},paid:{d:false,v:[false,true],l:N_('ops.p_paid'),f:v=>tr(v?'common.on':'common.off')}}}, - {k:'sales',i:'💼',t:N_('ops.o_sales'),d:N_('ops.o_sales_d'),p:{acc:{d:true,v:[true,false],l:N_('ops.p_acc'),f:v=>tr(v?'common.on':'common.off')},min:{d:0,v:[0,2000,5000,10000,25000,50000],l:N_('ops.p_min'),f:v=>v?tr('common.price_mo',{price:fmt$(v)}):tr('ops.never')}}}, + {k:'pni',i:'🤝',pop:1,cap:50000,t:N_('ops.o_pni'),d:N_('ops.o_pni_d'),p:{g:{d:25,v:[5,10,25,50,100],l:N_('ops.p_g'),f:v=>fmtG(v)},tier:{d:0,v:[0,1,2],l:N_('ops.p_tier'),f:v=>tr('ops.at_least_port',{port:PORT[v].n})},paid:{d:false,v:[false,true],l:N_('ops.p_paid'),f:v=>v?tr('common.on'):tr('common.off')}}}, {k:'repair',i:'🔧',cap:50000,t:N_('ops.o_repair'),d:N_('ops.o_repair_d'),p:{}}, {k:'optics',i:'🌈',cap:250000,t:N_('ops.o_optics'),d:N_('ops.o_optics_d'),p:{at:{d:70,v:[50,60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},pick:{d:'cheap',v:['cheap','big'],l:N_('ops.p_pick'),f:v=>tr({cheap:N_('ops.pick_cheap'),big:N_('ops.pick_big')}[v])}}}, - {k:'decom',i:'🧹',t:N_('ops.o_decom'),d:N_('ops.o_decom_d'),p:{keep:{d:true,v:[true,false],l:N_('ops.p_keep'),f:v=>tr(v?'common.on':'common.off')}}}, + {k:'decom',i:'🧹',t:N_('ops.o_decom'),d:N_('ops.o_decom_d'),p:{keep:{d:true,v:[true,false],l:N_('ops.p_keep'),f:v=>v?tr('common.on'):tr('common.off')}}}, ]; const OPSK=Object.fromEntries(OPS.map(o=>[o.k,o])),OPS_POP=OPS.filter(o=>o.pop).map(o=>o.k); const OPS_TPL=['bb','transit','ix','kit']; // What the shift log can say. One line per day: "{name} did this, that and the other." -const OPS_SAY={transit:N_('ops.l_transit'),ports:N_('ops.l_ports'),routers:N_('ops.l_routers'),caches:N_('ops.l_caches'),rs:N_('ops.l_rs'),peer:N_('ops.l_peer'),pni:N_('ops.l_pni'),sales:N_('ops.l_sales'),decline:N_('ops.l_decline'),repair:N_('ops.l_repair'),optics:N_('ops.l_optics'),decom:N_('ops.l_decom'),broke:N_('ops.l_broke'),snag:N_('ops.l_snag')}; +const OPS_SAY={transit:N_('ops.l_transit'),ports:N_('ops.l_ports'),routers:N_('ops.l_routers'),caches:N_('ops.l_caches'),rs:N_('ops.l_rs'),peer:N_('ops.l_peer'),pni:N_('ops.l_pni'),repair:N_('ops.l_repair'),optics:N_('ops.l_optics'),decom:N_('ops.l_decom'),broke:N_('ops.l_broke'),snag:N_('ops.l_snag')}; // Fat fingers: rare, visible, harmless. Only the LAG one costs anything, and only a little. const OPS_FF=[N_('ops.ff_desc'),N_('ops.ff_hostname'),N_('ops.ff_typo'),N_('ops.ff_lag'),N_('ops.ff_ping')]; -const OPS_TRIALS=1,OPS_FF_RATE={oncall:1/150,bgp:1/60}; +const OPS_FF_RATE={oncall:1/150,bgp:1/60}; function opsNew(){return {intern:null,hired:0,on:Object.fromEntries(OPS.map(o=>[o.k,false])),p:{},cap:{},spent:Object.fromEntries(OPS.filter(o=>o.cap).map(o=>[o.k,0])),addMo:{},mon:0,skip:{},log:[],wk:null,rep:null,floor:50000,tpl:{bb:true,transit:true,ix:true,kit:true}};} const opsO=()=>S.ops||(S.ops=opsNew()); const opsHired=()=>!!(S&&S.ops&&S.ops.intern&&own(INTERNS,S.ops.intern)); @@ -40,8 +40,9 @@ function opsCap(k){const c=S.ops.cap[k];return opsCaps(k).includes(c)?c:OPSK[k]. const opsHere=(k,c)=>!(S.ops.skip[c]||[]).includes(k); const opsPops=k=>Object.keys(S.pops).filter(c=>opsHere(k,c)); // Saves are untrusted: rebuild ops from known orders, params, cities and log shapes. Runs after the POPs are repaired, -// so exceptions only survive for POPs that still exist. Old saves get no intern, -// and the two #185 toggles (auto-accept, auto-pay repairs) become the sales and repair orders. +// so exceptions only survive for POPs that still exist. Old saves get no intern, and the #185 auto-repair toggle becomes +// the repair order. A sales order the intern was running moves to the sales desk (slAutoFrom); #185's auto-accept never +// ran without an intern, so it goes. function opsSanitize(s){const o=s.ops&&typeof s.ops==='object'&&!Array.isArray(s.ops)?s.ops:{},n=opsNew(),ob=x=>x&&typeof x==='object'&&!Array.isArray(x)?x:{}; n.intern=typeof o.intern==='string'&&own(INTERNS,o.intern)?o.intern:null;n.hired=int(o.hired,0,1e7,0);n.mon=int(o.mon,0,1e6,0); n.floor=OPS_FLOORS.includes(o.floor)?o.floor:n.floor; @@ -54,28 +55,32 @@ function opsSanitize(s){const o=s.ops&&typeof s.ops==='object'&&!Array.isArray(s {const sk=ob(o.skip);for(const c of Object.keys(sk))if(isCity(c)&&own(s.pops,c)&&Array.isArray(sk[c])){const ks=[...new Set(sk[c].filter(k=>OPS_POP.includes(k)))];if(ks.length)n.skip[c]=ks;}} if(Array.isArray(o.log))n.log=o.log.map(opsLogOk).filter(Boolean).slice(0,OPS_LOG); n.wk=opsWkOk(o.wk);n.rep=opsWkOk(o.rep); - if(s.autoSales===true)n.on.sales=true;if(s.autoRepair===true)n.on.repair=true;delete s.autoSales;delete s.autoRepair; + slAutoFrom(s,on.sales===true&&!!n.intern,ob(p.sales));if(s.autoRepair===true)n.on.repair=true;delete s.autoSales;delete s.autoRepair; s.ops=n;} // A log entry: {d, i: intern, r: [[kind, n, [where…]]], f: fat-finger index, c: its city, up: paid up front, mo: running costs added}. const opsWhereOk=w=>typeof w==='string'&&w.length<=48&&/^[a-z0-9~|]+( [+\w.×→⇧]+)?$/i.test(w)&&w.split(' ')[0].split('|').every(x=>isIx(x)||own(OPSK,x)||isNet(x)); -function opsLogOk(e){if(!e||typeof e!=='object'||!own(INTERNS,e.i))return null;const r=Array.isArray(e.r)?e.r.filter(x=>Array.isArray(x)&&own(OPS_SAY,x[0])&&Array.isArray(x[2])).map(x=>[x[0],int(x[1],1,1e6,1),x[2].filter(opsWhereOk).slice(0,3)]).slice(0,16):[]; +function opsLogOk(e){if(!e||typeof e!=='object'||!own(INTERNS,e.i))return null;const r0=Array.isArray(e.r)?e.r:[],r=r0.filter(x=>Array.isArray(x)&&own(OPS_SAY,x[0])&&Array.isArray(x[2])).map(x=>[x[0],int(x[1],1,1e6,1),x[2].filter(opsWhereOk).slice(0,3)]).slice(0,16); const f=Number.isInteger(e.f)&&OPS_FF[e.f]?e.f:undefined,up=int(e.up,0,1e12,0),mo=int(e.mo,-1e9,1e9,0); + // A day that only signed or declined deals (the retired sales order) has nothing left to say. + if(r0.length&&!r.length&&f===undefined&&!up&&!mo)return null; return {d:int(e.d,0,1e7,0),i:e.i,r,...(f!==undefined&&isCity(e.c)?{f,c:e.c}:{}),...(up?{up}:{}),...(mo?{mo}:{})};} -// A week's tally, for the shift report and the one NOC notice a week: {w: week, i: intern, n: {kind: count}, wh: {kind: [where…]}, up, mo, rev, ff}. +// A week's tally, for the shift report and the one NOC notice a week: {w: week, i: intern, n: {kind: count}, wh: {kind: [where…]}, up, mo, ff}. function opsWkOk(x){if(!x||typeof x!=='object'||Array.isArray(x)||!own(INTERNS,x.i))return null;const n={},wh={},xn=x.n&&typeof x.n==='object'?x.n:{},xw=x.wh&&typeof x.wh==='object'?x.wh:{}; for(const k of Object.keys(OPS_SAY)){if(own(xn,k)){const v=int(xn[k],0,1e6,0);if(v)n[k]=v;}if(own(xw,k)&&Array.isArray(xw[k])){const w=xw[k].filter(opsWhereOk).slice(0,3);if(w.length)wh[k]=w;}} - return {w:int(x.w,0,1e6,0),i:x.i,n,wh,up:int(x.up,0,1e12,0),mo:int(x.mo,-1e9,1e9,0),rev:int(x.rev,0,1e9,0),ff:int(x.ff,0,7,0)};} -const opsWkNew=w=>({w,i:S.ops.intern,n:{},wh:{},up:0,mo:0,rev:0,ff:0}); + // A tally of only the retired sales order says nothing any more. + const ff=int(x.ff,0,7,0);if(Object.keys(xn).length&&!Object.keys(n).length&&!ff)return null; + return {w:int(x.w,0,1e6,0),i:x.i,n,wh,up:int(x.up,0,1e12,0),mo:int(x.mo,-1e9,1e9,0),ff};} +const opsWkNew=w=>({w,i:S.ops.intern,n:{},wh:{},up:0,mo:0,ff:0}); const opsWkAny=x=>!!x&&(Object.keys(x.n).length>0||x.ff>0); -// "Kevin's week: signed 3 customers (+$41k/mo), topped up transit 2 times (Frankfurt +1×100G), declined 17 tiny offers. Week total: …" -function opsWeekLine(x){const I=INTERNS[x.i],name=I?tr(I.s):'',ks=Object.keys(x.n).sort((a,b)=>(a==='sales'?-1:b==='sales'?1:0)||(a==='broke')-(b==='broke')); - const parts=ks.map(k=>k==='sales'?trn('ops.w_sales',x.n[k],{rev:opsMo$(x.rev)}):trn(OPS_SAY[k],x.n[k],{where:(x.wh[k]||[]).map(w=>opsWhere(w,k)).join(', ')})); +// "Kevin's week: topped up transit 2 times (Frankfurt +1×100G), rushed a repair. Week total: …" +function opsWeekLine(x){const I=INTERNS[x.i],name=I?tr(I.s):'',ks=Object.keys(x.n).sort((a,b)=>(a==='broke')-(b==='broke')); + const parts=ks.map(k=>trn(OPS_SAY[k],x.n[k],{where:(x.wh[k]||[]).map(w=>opsWhere(w,k)).join(', ')})); if(x.ff)parts.push(trn('ops.w_oops',x.ff)); return tr('ops.w_line',{name,list:parts.join(', ')})+(x.up||x.mo?' '+tr('ops.w_money',{cost:fmt$(x.up),mo:opsMo$(x.mo)}):'');} // The intern's mood, from what the week has been like. No dice: the same day always reads the same. -function opsMood(){const O=S.ops,x=O.wk&&O.wk.w===Math.floor(S.day/7)?O.wk:null,n=x?x.n:{},jobs=Object.keys(n).filter(k=>k!=='broke'&&k!=='decline').reduce((a,k)=>a+n[k],0); - const k=S.day-O.hired<7?'new':x&&x.ff?'oops':n.snag?'snag':S.inc.some(i=>i.until>S.day&&i.type!=='ddos')?'outage':n.sales?'sales':n.broke?'broke':jobs>=5?'busy':S.day%2?'quiet':O.intern; - return tr({new:N_('ops.mood_new'),oops:N_('ops.mood_oops'),snag:N_('ops.mood_snag'),outage:N_('ops.mood_outage'),sales:N_('ops.mood_sales'),broke:N_('ops.mood_broke'),busy:N_('ops.mood_busy'),quiet:N_('ops.mood_quiet'), +function opsMood(){const O=S.ops,x=O.wk&&O.wk.w===Math.floor(S.day/7)?O.wk:null,n=x?x.n:{},jobs=Object.keys(n).filter(k=>k!=='broke').reduce((a,k)=>a+n[k],0); + const k=S.day-O.hired<7?'new':x&&x.ff?'oops':n.snag?'snag':S.inc.some(i=>i.until>S.day&&i.type!=='ddos')?'outage':n.broke?'broke':jobs>=5?'busy':S.day%2?'quiet':O.intern; + return tr({new:N_('ops.mood_new'),oops:N_('ops.mood_oops'),snag:N_('ops.mood_snag'),outage:N_('ops.mood_outage'),broke:N_('ops.mood_broke'),busy:N_('ops.mood_busy'),quiet:N_('ops.mood_quiet'), annie:N_('ops.mood_annie'),kevin:N_('ops.mood_kevin'),tracy:N_('ops.mood_tracy')}[k],{name:opsName()});} // "fra +1×100G", "fra|ams", "ams~3", "transit" (an order, for the budget line) or "ggl" (a network). // Peering is always at an exchange, and a city's first exchange has the city's id ("lon" is LYNX): name the exchange (#228). @@ -99,9 +104,9 @@ function opsQuiet(fn){const a=after,t=toast,s=sfx,f=floater,sel=UI.sel,cf=UI.con try{return fn();}finally{after=a;toast=t;sfx=s;floater=f;UI.confirm=cf;UI.tab=tab;UI.sel=sel&&(sel.type!=='link'||S.links.some(l=>l.id===sel.id))&&(sel.type!=='city'||isCity(sel.id))?sel:null;}} // One shift's bookkeeping: what got done, and whether a job had to wait for next month's budget. // dirty: a job changed the network, so R (loads, routing) is out of date until the next compute(). -// up/mo/rev: what this shift paid up front, added to the monthly bill, and signed in monthly revenue. +// up/mo: what this shift paid up front and added to the monthly bill. function opsShift(){const r=new Map(),broke=new Set(); - return {r,broke,dirty:false,up:0,mo:0,rev:0,did(k,w){if(k!=='decline')this.dirty=true;const x=r.get(k)||{n:0,w:[]};x.n++;if(w&&x.w.length<3&&!x.w.includes(w))x.w.push(w);r.set(k,x);}, + return {r,broke,dirty:false,up:0,mo:0,did(k,w){this.dirty=true;const x=r.get(k)||{n:0,w:[]};x.n++;if(w&&x.w.length<3&&!x.w.includes(w))x.w.push(w);r.set(k,x);}, // A job that costs nothing up front still has to pass the cash floor if it adds to the monthly bill. // quiet: only asking, so a no is not logged as the budget running out. can(k,cost,mo=0,quiet){const O=S.ops,cap=opsCap(k);if(cost<=0&&!(mo>0))return true; @@ -122,12 +127,6 @@ const opsProv=c=>{const pv=opsP('transit','prov'),n=isNet(pv)?NET[pv]:null;retur // The orders. Each takes the shift and does its jobs through the player's own actions. const OPS_RUN={ repair(X){purgeInc();for(const i of S.inc.slice())if(i.type!=='ddos'&&i.until>S.day&&i.cost>0&&!(i.slow&&i.rushed)&&X.can('repair',i.cost)&&X.pay('repair',()=>ACT.fixInc({id:i.id})))X.did('repair');}, - sales(X){const min=opsP('sales','min'),acc=opsP('sales','acc');let tries=0; - for(const o of S.offers.slice()){const T=BIZ_T[o.type];if(!T)continue;const v=T.event?(o.fee||0):bizMo(o); - if(min&&vx!==o);X.did('decline');continue;} - // Each trial is a full routing pass: at most one a shift, and an offer that did not fit waits a week. - if(acc&&o.exp>S.day&&bCities(o).every(popUp)&&reqOk(o)&&triesS.day-7)){tries++;ACT.accept({id:o.id,auto:true}); - if(!S.offers.includes(o)){X.did('sales');X.rev+=bizMo(o);}else{if(!UI.opsTried||UI.opsTried.s!==S)UI.opsTried={s:S,m:new Map()};UI.opsTried.m.set(o.id,S.day);}}}}, routers(X){const at=opsP('routers','at')/100,how=opsP('routers','how'); for(const c of opsPops('routers')){const p=S.pops[c];if(p.rupDay===S.day)continue; const ld=Math.max((R.nodeLoad[c]||0)/(R.nodeCap[c]||nodeCap(c)||1),portsUsed(c)/Math.max(1,portsMax(c)));if(ld(b.reqs||[]).some(k=>k==='diverse'||k==='sharks'||k==='lat')&&b.city2);if(!bz.length)return true; const chk=b=>(b.reqs||[]).every(k=>k==='diverse'?diversePaths(b.city,b.city2):k==='sharks'?terrestrialPath(b.city,b.city2):k==='lat'?bestLat(b.city,b.city2)<=b.latMax:true); const was=bz.filter(chk),all=S.links;S.links=all.filter(x=>x!==l);try{return was.every(chk);}finally{S.links=all;}} -const OPS_ORDER=['repair','sales','routers','transit','ports','optics','caches','ix','pni','decom']; +const OPS_ORDER=['repair','routers','transit','ports','optics','caches','ix','pni','decom']; // The shift: once per game day from dayTick, after outages and events have had their turn. function opsDay(d){if(!opsHired())return;const O=S.ops,m=monthIdx(d);if(m!==O.mon){O.mon=m;for(const k in O.spent)O.spent[k]=0;O.addMo={};} // A new week: last week's tally becomes the shift report, and the one NOC notice of the week. - const w=Math.floor(d/7);if(!O.wk||O.wk.w!==w){if(opsWkAny(O.wk)&&O.wk.w${esc(tr('ops.shift_report',{name:opsName()}))} ${esc(opsWeekLine(O.rep))}`,O.rep.rev>0?'good':'',[],{a:'ops'});}O.wk=opsWkNew(w);} + const w=Math.floor(d/7);if(!O.wk||O.wk.w!==w){if(opsWkAny(O.wk)&&O.wk.w${esc(tr('ops.shift_report',{name:opsName()}))} ${esc(opsWeekLine(O.rep))}`,'',[],{a:'ops'});}O.wk=opsWkNew(w);} const X=opsShift(); // One order that trips over something (an odd save, a bug) is paused and noted; payday, goals and the save still happen. opsQuiet(()=>{for(const k of OPS_ORDER)if(O.on[k])try{OPS_RUN[k](X);}catch(err){O.on[k]=false;X.dirty=true;X.did('snag',k);console.error('[tubes] standing order failed',k,err);}}); @@ -236,12 +235,12 @@ function opsDay(d){if(!opsHired())return;const O=S.ops,m=monthIdx(d);if(m!==O.mo if(f===3){const t=O.on.transit&&opsHere('transit',c)&&!scnRule('noTransit')&&S.transit.find(t=>t.city===c&&(t.n||1)X.pay('transit',()=>ACT.lagT({id:t.id,d:1}))))f=0;else X.dirty=true;} e.f=f;e.c=c;toast(esc(opsFFLine(e)),'',[{l:tr('ops.ops'),act:'opsOpen',args:{}}]);} if(X.up)e.up=Math.round(X.up);if(Math.round(X.mo))e.mo=Math.round(X.mo); - // Declining an offer or stopping at a budget changes nothing a route depends on: no recompute for those. + // Stopping at a budget changes nothing a route depends on: no recompute for that. if(X.dirty)compute(); if(e.r.length||e.f!==undefined){O.log.unshift(e);O.log.length=Math.min(O.log.length,OPS_LOG);} // The day's detail stays in the Ops sheet; the NOC gets one notice a week (above). const W=O.wk;for(const [k,n,ws] of e.r){W.n[k]=(W.n[k]||0)+n;const a=W.wh[k]||(W.wh[k]=[]);for(const x of ws)if(a.length<3&&!a.includes(x))a.push(x);} - W.up+=e.up||0;W.mo+=e.mo||0;W.rev+=Math.round(X.rev);if(e.f!==undefined)W.ff=Math.min(7,W.ff+1);} + W.up+=e.up||0;W.mo+=e.mo||0;if(e.f!==undefined)W.ff=Math.min(7,W.ff+1);} // New POP from the template: price the whole bundle first, then click through it in one go. function opsTplQuote(c){if(!S||S.pops[c]||!cityOn(c)||(cnCity(c)&&!cnOk()))return null;const T=S.ops.tpl,parts=[];let cost=popCost(c),net=null,ix=null,kit=null; if(T.bb){cost+=bbCost(c);parts.push(tr('ops.tpl_bb'));} diff --git a/src/game/60-features/99-pie-orbit-customers.js b/src/game/60-features/99-pie-orbit-customers.js index 53e4883..5012f29 100644 --- a/src/game/60-features/99-pie-orbit-customers.js +++ b/src/game/60-features/99-pie-orbit-customers.js @@ -22,14 +22,15 @@ function pieOfferTypes(){if(!pieOn()||!R||!R.pie||!R.pie.hubs.length||!pieDishes // Cities a terminal could sit in: cruise ships call at the coast, airlines at big airports, homes anywhere. function pieCands(t){if(t==='boat')return CITIES.filter(c=>c.beach||pieCoast(c.id));if(t==='flywifi')return CITIES.filter(c=>c.P>=250);return CITIES;} // The size fits the market left and the room on the dish it would land on (offers on the table count as taken). -function pieSpawn(t){const T=BIZ_T[t],min=T.opts[0],ok=pieCands(t).filter(c=>{if(c.cn)return false;const L=pieServe(c.id,t);return !!L&&L.left>=min;});if(!ok.length)return; +// Whoever runs sales has a say (99-pie-sales.js): the room they will sell, the size they ask for, how they dress it up. +function pieSpawn(t){const T=BIZ_T[t],min=T.opts[0],ok=pieCands(t).filter(c=>{if(c.cn)return false;const L=pieServe(c.id,t);return !!L&&pieSlRoom(L)>=min;});if(!ok.length)return; const far=ok.filter(c=>!S.pops[c.id]&&c.P<=60),city=(far.length&&Math.random()a+(BIZ_T[o.type].orbit?o.bw:0),0)),opts=T.opts.filter(g=>g<=left),bw=opts.length?pick(opts):0;if(!bw)return; + const left=Math.min(pieRoom(t),pieSlRoom(pieServe(city,t))-S.offers.reduce((a,o)=>a+(BIZ_T[o.type].orbit?o.bw:0),0)),opts=T.opts.filter(g=>g<=left),bw=opts.length?pieSlSize(opts):0;if(!bw)return; const list=T.names.filter(n=>!S.usedNames.includes(n)),name=list.length?pick(list):pick(T.names);useName(name); - S.offers.push({id:uid(),city,city2:null,name,type:t,bw,rate:T.rate,reqs:[],exp:S.day+40});} + const o={id:uid(),city,city2:null,name,type:t,bw,rate:T.rate,reqs:[],exp:S.day+40};pieSlShape(o);S.offers.push(o);} // Grand opening: the first PIE_OPEN_DAYS after a crust starts carrying traffic (crust.open, the day it first did), the phone // rings every day and up to PIE_OPEN_OFFERS wait, so regular customers sign while the patchy-sky income fades (99-pie-patchy.js). const PIE_OPEN_DAYS=30,PIE_OPEN_OFFERS=4; function pieOpening(){const P=S.pie;let on=false;for(const id of pieHubs()){const c=P.crusts[id];if(!c)continue;if(c.open===undefined&&pieCap(id)>0)c.open=S.day;if(c.open!==undefined&&S.day-c.open{const op=pieOpening();if(S.offers.filter(o=>BIZ_T[o.type].orbit).length>=(op?PIE_OPEN_OFFERS:PIE_OFFERS))return;const t=pieOfferTypes();if(t.length&&(op||Math.random(){const op=pieOpening();if(S.offers.filter(o=>BIZ_T[o.type].orbit).length>=(op?PIE_OPEN_OFFERS:PIE_OFFERS))return;const t=pieOfferTypes();if(t.length&&(op||Math.random()=PIE_ENG_SF?L.left/PIE_ENG_ROOM:0;} +// Which kinds get a call: the shark rings airlines and cruise lines first. +function pieSlTypes(t){if(slP()!=='shark')return t;const big=t.filter(x=>x==='flywifi'||x==='boat'||x==='marsorb');return big.length?big:t;} +// The size: the shark asks for the biggest that fits, everyone else as the customer asks (pick, as before). +const pieSlSize=opts=>slP()==='shark'?opts[opts.length-1]:pick(opts); +// A new orbit offer, dressed by whoever is at the desk. +function pieSlShape(o){const p=slP();if(!p)return;o.by=p; + if(p==='shark'){o.rate=Math.round(o.rate*PIE_SHARK);if(!REQS.skyfull.ok()&&slR('skyover|'+slKey(o))0)o.rate=Math.round(o.rate*(1-PIE_CEO_JIT*j));}} +const pieJit=()=>(S.pie&&S.pie.founder&&S.pie.founder.jit)||0; +// The CEO's golf with the Founder (salesGolf, on a golf day): true when this game was in orbit, deal or no deal. +function pieGolf(d){if(!pieOn()||!S.pie||!S.pie.co||slR('golfsky|'+d)>=PIE_GOLF_SKY)return false; + const ts=pieOfferTypes();if(!ts.length)return false; + if(pieJit()>=PIE_CEO_SKIP){toast(tr('sales.ceo_golf_skip'),'');return true;} + for(const t of ['marsorb','boat','flywifi','pizza']){if(!ts.includes(t))continue;const T=BIZ_T[t]; + const cs=pieCands(t).filter(c=>!c.cn).map(c=>[c,pieServe(c.id,t)]).filter(([,L])=>L&&L.left>=T.opts[0]).sort((a,b)=>b[0].P-a[0].P||(a[0].idg<=Math.min(pieRoom(t),L.left)).pop();if(!bw)continue; + const list=T.names.filter(n=>!S.usedNames.includes(n)),name=list.length?list[Math.floor(slR('golfskyn|'+d)*list.length)]:T.names[0];useName(name); + const off=1-0.7*(1-PIE_CEO_JIT*pieJit()),o={id:uid(),city:c.id,city2:null,name,type:t,bw,rate:Math.round(T.rate*(1-off)),reqs:REQS.skyfull.ok()?[]:['skyfull'],exp:d+40}; + const b=offerCustomer(o);b.by='ceo';S.biz.push(clSign(b)); + toast(tr('sales.ceo_golf_sky',{name:esc(name),city:esc(c.name),bw:fmtG(bw),price:fmt$(bw*o.rate),p:pct(off)})+(o.reqs.length?' '+tr('sales.ceo_promised',{req:esc(REQS.skyfull.l())}):''),'goal',[{l:tr('common.show_me'),act:'custGo',args:{id:b.id}}]);sfx('coin');return true;} + return false;} diff --git a/src/game/80-simulation/60-requirements.js b/src/game/80-simulation/60-requirements.js index 784a72d..65c6e85 100644 --- a/src/game/80-simulation/60-requirements.js +++ b/src/game/80-simulation/60-requirements.js @@ -15,6 +15,8 @@ const REQS={ china:{l:tr('requirements.needs_low_loss_reach_into_china'),bonus:.3,ip:true,ok:()=>S.transit.some(premOn)||S.links.some(l=>l.premium)||S.pni.some(p=>NET[p.net].cn&&pniOn(p))}, scrubbed:{l:tr('requirements.will_only_sign_with_a_network'),bonus:.15,ok:()=>hasScrub()}, scrubnear:{l:tr('requirements.wants_a_scrubbing_center_on_its'),bonus:.15,ip:true,ok:b=>S.scrubs.some(x=>CITY[x.city].reg===CITY[b.city].reg)}, + // The shark's orbit promise (99-pie-sales.js): a full sky, a crust at least PIE_PROMISE in orbit. Never on an ordinary offer. + skyfull:{only:true,bonus:0,l:()=>tr('requirements.promised_a_full_sky',{p:pct(PIE_PROMISE)}),ok:()=>pieHubs().some(id=>pieCov(id)>=PIE_PROMISE)}, puns:{l:tr('requirements.their_ceo_hates_puns_please_do'),bonus:.05,ok:()=>true}, }; function terrestrialPath(a,b){const ls=S.links.filter(l=>!linkDown(l)&&!l.sub);const adj={};for(const l of ls){(adj[l.a]=adj[l.a]||[]).push(l.b);(adj[l.b]=adj[l.b]||[]).push(l.a);}const seen=new Set([a]),q=[a];while(q.length){const u=q.shift();if(u===b)return true;for(const v of adj[u]||[])if(!seen.has(v)){seen.add(v);q.push(v);}}return false;} diff --git a/src/game/88-days/10-day-tick.js b/src/game/88-days/10-day-tick.js index 74c618b..2f008db 100644 --- a/src/game/88-days/10-day-tick.js +++ b/src/game/88-days/10-day-tick.js @@ -52,6 +52,8 @@ function dayPost(d){ if(sf>=0.95&&reachOk&&scrubOk&&divOk)b.mood=Math.min(100,b.mood+2); else if(S.day-(b.since||0)<15){} else{const dm=frr*(Math.max(0,0.95-sf)*45+(!reachOk?3:0)+(!scrubOk?4:0)+(!divOk?3:0));b.mood-=BIZ_T[b.type].orbit?Math.min(dm,PIE_PATIENCE):dm; + // An orbit customer served in full but promised more (the shark's full sky) grumbles, and never cancels over it. + if(BIZ_T[b.type].orbit&&sf>=0.95&&reachOk)b.mood=Math.max(b.mood,Math.min(b.pm,PIE_GRUMBLE)); if(b.mood<=0){S.biz=S.biz.filter(x=>x!==b);toast(tr('day_tick.name_cancelled_too_many_outages_and',{name:esc(b.name),city:CITY[b.city].name}),'bad');sfx('err');} else if(b.mood<30&&!b.warned){b.warned=b.warn60=true;const why=bizWhy(b)[0],paused=pref('pauseFurious')&&autoPause(); toast(tr('day_tick.name_is_furious_fix_service_in',{name:esc(b.name),city:CITY[b.city].name})+(why?`
${esc(why)}`:'')+(paused?`
${tr('common.game_paused')}`:''),'bad',[{l:tr('common.show_me'),act:'custGo',args:{id:b.id}}].concat(paused?[resumeAct()]:[]));sfx('err');} @@ -82,6 +84,8 @@ function dayPost(d){ if(cm&&d>45&&scnRule('anchors')){const n=S.links.filter(l=>l.kind!=='vxc'&&!linkDown(l)&&anchorProne(l)).length;if(n&&Math.random()=S.nextEvent){dirty=true;fireEvent();S.nextEvent=d+Math.round((45+Math.floor(Math.random()*45))/cm);} if(dirty)compute(); + // the sales desk signs and declines deals, when the player lets it (39-sales-auto.js), then the intern's shift sees them + slAutoDay(d); opsDay(d); if(S.pie){pieDay(d);pieTier();} // payday floaters diff --git a/src/game/90-actions/52-sales.js b/src/game/90-actions/52-sales.js index 68d36ee..b909207 100644 --- a/src/game/90-actions/52-sales.js +++ b/src/game/90-actions/52-sales.js @@ -8,5 +8,8 @@ Object.assign(ACT,{ salesFire:()=>{const p=slP();if(!p||p==='ceo')return;if(UI.confirm!=='salesFire'){UI.confirm='salesFire';salesModal();return;}UI.confirm=null;const nm=slCap();S.sales.p=null; toast(tr('sales.fired',{name:esc(nm)}),'');after();salesModal();}, // The CEO cannot be fired. A board meeting (and its catering) can get you a VP of Sales, who takes over a month later. + // Signing for you (39-sales-auto.js): on or off, and the minimum under which offers are declined. + salesAuto:()=>{if(!slP())return;const A=S.slAuto||(S.slAuto=slAutoNew());A.on=!A.on;sfx('click');after();salesModal();}, + salesMin:()=>{if(!slP())return;const A=S.slAuto||(S.slAuto=slAutoNew());A.min=opsCycle(SL_MINS,A.min);sfx('click');after();salesModal();}, salesVp:()=>{if(slP()!=='ceo'||S.sales.vp)return;if(!spend(SALES_VP))return;S.sales.vp=S.day+SALES_VP_DAYS;toast(tr('sales.vp_asked',{n:SALES_VP_DAYS}),'');after();salesModal();}, }); diff --git a/src/game/93-ui/58-sales-panel.js b/src/game/93-ui/58-sales-panel.js index 9204186..b155c20 100644 --- a/src/game/93-ui/58-sales-panel.js +++ b/src/game/93-ui/58-sales-panel.js @@ -1,7 +1,7 @@ // The sales desk in Deals, and its sheet: the three kinds of salesperson, who is at the desk, and what they cost. function salesCard(){if(!S||!rule('clock'))return '';const p=slP(),L=S.sales||{}; return `
${p?`${SALES[p].i} ${esc(tr('sales.at_desk',{name:slCap()}))}`:`💼 ${tr('sales.desk')}`}
-
${p?(L.vp?tr('sales.vp_coming',{n:Math.max(0,L.vp-S.day)}):tr(SALES[p].d)):salesCanHire()?tr('sales.pitch'):tr('sales.locked',{lv:SALES_LV})}
+
${p?(L.vp?tr('sales.vp_coming',{n:Math.max(0,L.vp-S.day)}):slCardLine()||tr(SALES[p].d)):salesCanHire()?tr('sales.pitch'):tr('sales.locked',{lv:SALES_LV})}
${btn(p?tr('sales.desk'):tr('sales.hire_sales'),'salesOpen',{},p?'sm':'pink sm',!p&&!salesCanHire())}
`;} function salesModal(){if(!S)return;const p=slP(),L=S.sales||{}; let h=`
${tr('common.deals')}

${tr('sales.desk')}

`; @@ -12,6 +12,19 @@ function salesModal(){if(!S)return;const p=slP(),L=S.sales||{}; :btn(UI.confirm==='salesFire'?tr('ops.really_fire'):tr('ops.fire'),'salesFire',{},'ghost sm')) :p?'':btn(id==='ceo'?tr('sales.let_ceo'):tr('ops.hire_mo',{price:fmt$(P.mo)}),'salesHire',{id},'pink sm',!salesCanHire()||!rule('clock')||S.cash
${tr(P.n)}
-
${tr(P.d)}
${here&&id!=='ceo'?`
${tr('ops.salary',{price:fmt$(P.mo),d:dateStr(L.hired||0)})}
`:''}${act?`
${act}
`:''}
`;}).join(''); +
${tr(P.d)}
${pieOn()?`
🥧 ${tr(SL_SKY[id])}
`:''}${here&&id!=='ceo'?`
${tr('ops.salary',{price:fmt$(P.mo),d:dateStr(L.hired||0)})}
`:''}${act?`
${act}
`:''}
`;}).join(''); if(p&&p!=='ceo')h+=`

${tr('sales.one_at_a_time')}

`; + h+=p?slAutoHtml(p):rule('clock')?`

${tr('sales.by_hand')}

`:''; openModal(h,'ops');} +// What each of them does in orbit, shown once there is a rocket company to sell for (99-pie-sales.js). +const SL_SKY={eng:N_('sales.eng_sky'),shark:N_('sales.shark_sky'),ceo:N_('sales.ceo_sky')}; +const SL_AUTO={eng:N_('sales.auto_eng'),shark:N_('sales.auto_shark'),ceo:N_('sales.auto_ceo')}; +// Signing for you (39-sales-auto.js): the switch, the minimum, and this week's and last week's tally. +function slAutoHtml(p){const A=S.slAuto||slAutoNew(),w=Math.floor(S.day/7),cur=A.wk&&A.wk.w===w&&slWkAny(A.wk)?A.wk:null,rep=A.rep&&A.rep.w===w-1?A.rep:null; + const row=(x,last)=>`
${esc(slWeekLine(x,last))}
`; + return `

${tr('sales.auto')}

${tr(SL_AUTO[p],{name:esc(slCap())})}

+
+ ${btn(`${tr('sales.decline_below')}: ${A.min?tr('common.price_mo',{price:fmt$(A.min)}):tr('sales.never')}`,'salesMin',{},'ghost sm')}
+ ${rep?row(rep,true):''}${cur?row(cur,false):''}
`;} +// On the card in Deals: this week's tally, once there is one. +function slCardLine(){if(!slAutoOn())return '';const A=S.slAuto,x=A.wk&&A.wk.w===Math.floor(S.day/7)&&slWkAny(A.wk)?A.wk:null;return x?esc(slWeekLine(x,false)):'';} diff --git a/src/i18n/en.js b/src/i18n/en.js index 7f946fa..3e441b0 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -3222,7 +3222,6 @@ "ops.kevin_from_the_night_shift":"Kevin from the night shift", "ops.l_broke":{"one":"stopped at the budget for {where}","other":"stopped at the budget for {n} orders ({where})"}, "ops.l_caches":{"one":"racked a free cache in {where}","other":"racked {n} free caches ({where})"}, -"ops.l_decline":{"one":"declined a tiny offer","other":"declined {n} tiny offers"}, "ops.l_decom":{"one":"handed back a small wave on {where}","other":"handed back {n} small waves ({where})"}, "ops.l_line":"{name} {list}.", "ops.l_optics":{"one":"lit a channel on {where}","other":"lit {n} channels ({where})"}, @@ -3234,7 +3233,6 @@ "ops.l_repair":{"one":"rushed a repair","other":"rushed {n} repairs"}, "ops.l_routers":{"one":"upgraded routers in {where}","other":"upgraded routers in {n} places ({where})"}, "ops.l_rs":{"one":"joined a route server","other":"joined {n} route servers"}, -"ops.l_sales":{"one":"signed a customer","other":"signed {n} customers"}, "ops.l_snag":{"one":"got stuck on {where} and paused it until you have a look","other":"got stuck on {n} orders ({where}) and paused them until you have a look"}, "ops.l_transit":{"one":"topped up transit in {where}","other":"topped up transit {n} times ({where})"}, "ops.locked":"The NOC hires interns from customer level {lv}.", @@ -3246,10 +3244,8 @@ "ops.mood_oops":"{name} is being very careful today. Nobody mention the interface descriptions.", "ops.mood_outage":"{name} is watching the outage graphs and refreshing the status page. A lot.", "ops.mood_quiet":"{name} is quietly reading RFCs. The graphs are flat, which is how they like them.", -"ops.mood_sales":"{name} is walking a little taller: someone signed on their shift.", "ops.mood_snag":"{name} hit something odd, paused that order and left you a sticky note.", "ops.mood_tracy":"Tracy is three hops into a traceroute, with only one star so far.", -"ops.never":"never", "ops.no_cap":"no limit", "ops.no_clock":"No clock, no shifts: these rules have no days for an intern to work.", "ops.o_caches":"Accept free caches", @@ -3268,18 +3264,14 @@ "ops.o_repair_d":"Pay for the rush repair on every outage that has one, while the budget lasts.", "ops.o_routers":"Keep routers ahead", "ops.o_routers_d":"Add a router, or swap to the next generation where a second router carries the traffic, when load or ports pass a level.", -"ops.o_sales":"Handle sales", -"ops.o_sales_d":"Sign offers whose requirements are met with capacity to spare, and decline the ones that pay too little to bother.", "ops.o_transit":"Keep transit headroom", "ops.o_transit_d":"Keep transit at each POP above a multiple of its 30-day peak: add a LAG member, or move up a port size.", "ops.ops":"Ops", "ops.ops_name":"Ops · {name}", -"ops.p_acc":"Accept ready offers", "ops.p_at":"Above", "ops.p_g":"From", "ops.p_how":"How", "ops.p_keep":"Keep one spare", -"ops.p_min":"Decline below", "ops.p_paid":"Paid peering", "ops.p_pick":"Optics", "ops.p_prov":"Provider", @@ -3315,7 +3307,6 @@ "ops.w_line":"{name} {list}.", "ops.w_money":"Week total: {cost} up front, {mo}/mo.", "ops.w_oops":{"one":"made one small oops","other":"made {n} small oopses"}, -"ops.w_sales":{"one":"signed a customer ({rev}/mo)","other":"signed {n} customers ({rev}/mo)"}, "optic_counts.apply_price":"Apply · {price}", "optic_counts.count_for_model":"Number of {model} channels", "optic_counts.only_n_channels_free":"Only {n} channels are free on this fiber.", @@ -4082,6 +4073,7 @@ "requirements.n_400g_alien_wave_on_your":{"one":"{n}× 400G alien wave on your {a}–{b} fiber","other":"{n}× 400G alien waves on your {a}–{b} fiber"}, "requirements.needs_low_loss_reach_into_china":"Needs low-loss reach into China", "requirements.one_way_latency_within_max_ms":"One-way latency within {max} ms (best now: {best})", +"requirements.promised_a_full_sky":"Promised a full sky: a crust at least {p} in orbit", "requirements.refuses_cogentle_transit_anywhere_on":"Refuses Cogentle transit anywhere on your network (long story)", "requirements.their_ceo_hates_puns_please_do":"Their CEO hates puns. Please do not mention the network names.", "requirements.two_data_centers_in_every_metro":"Two data centers in every metro they touch", @@ -4287,8 +4279,15 @@ "rules.your_pager_never_sleeps":"Your pager never sleeps.", "sales.ask_vp":"Ask the board for a VP of Sales · {cost}", "sales.at_desk":"{name} runs sales", +"sales.auto":"Signs deals for you", +"sales.auto_ceo":"{name} signs the offers your network can serve today, one trial a day. He declines the ones under your minimum too, though now and then he has already shaken hands on one.", +"sales.auto_eng":"{name} signs the offers your network can serve today, after trying each one on the network first (one a day), and declines the ones that pay less than your minimum.", +"sales.auto_shark":"{name} signs every offer the moment it lands, promises and all, as long as you can pay the commission, and declines the ones that pay less than your minimum.", +"sales.by_hand":"Nobody runs sales, so you sign every deal by hand. Hire a salesperson, or let the CEO run it, and they can sign deals for you.", "sales.ceo_d":"Free, and sure of it. Every couple of months signs a huge deal on the golf course at 30% off, often with a promise nobody checked, and now and then signs an offer you declined. Has opinions. Cannot be fired.", "sales.ceo_golf":"The CEO signed {name} on the golf course: {bw} in {city} for {price}/mo, 30% off list.", +"sales.ceo_golf_skip":"The Founder skipped golf: the markets are too jumpy. The CEO played alone and signed nothing in orbit.", +"sales.ceo_golf_sky":"The CEO and the Founder signed {name} on the golf course: {bw} in orbit over {city} for {price}/mo, {p} off list.", "sales.ceo_n":"The CEO, who sells better than anyone", "sales.ceo_override":"You declined {name}, but the CEO had already shaken hands on it. They are now a customer.", "sales.ceo_promised":"He also promised: {req}.", @@ -4300,27 +4299,38 @@ "sales.ceo_say_napkin":"I priced the next deal on a napkin. Engineering can work out the details.", "sales.ceo_say_synergy":"We don't sell bandwidth, we sell synergy. Put that on the website.", "sales.ceo_says":"The CEO: “{say}”", +"sales.ceo_sky":"In orbit: every other golf game is with the Founder, for the biggest orbit deal that fits at 30% off. Jumpy markets cost him: lower orbit prices, and no golf at all when they are very jumpy.", "sales.ceo_took_over":"{name} has taken over sales personally. He is sure he sells better than anyone.", "sales.commission":"{name} signed. Commission for the shark: {cost}.", +"sales.decline_below":"Decline below", "sales.desk":"Sales desk", "sales.eng_booked":"{name} registered you for {conf} in {city} ({cost}). They already have the lanyard.", "sales.eng_d":"Was a network engineer, now has a lanyard for every NOG. Books you into each one (you pay the ticket), brings plenty of small and mid deals but never the really big ones, and only sells what the network can do, so customers stay. The nerds love Dave. Haggles badly.", "sales.eng_n":"The engineer turned salesdroid", "sales.eng_s":"Dave", +"sales.eng_sky":"In orbit: only sells where the landing dish has room to spare, and those customers stay like the nerds do.", "sales.fired":"{name} has cleared their desk. The sales desk is free.", "sales.hire_sales":"Hire sales", "sales.hired":"{name} joined sales. Expect deals in their style.", "sales.intro":"One person runs sales at a time. Each brings deals in their own way, and the customers they sign remember it when their contract comes up.", "sales.let_ceo":"Let the CEO run it", "sales.locked":"The sales desk opens at customer level {lv}.", +"sales.never":"never", "sales.one_at_a_time":"One at a time: let them go to hire someone else.", +"sales.p_sign":"Sign deals", "sales.pitch":"One salesperson brings in deals their own way. Pick who.", "sales.shark_d":"Lands the biggest deals at a quarter more, and takes a month of each deal as commission. Oversells: half of them come with a promise your network does not keep yet, and those customers leave sooner. Ignores the nerds: no technical customers, no meetings, and peering desks want a quarter more traffic from you. Wins most haggles.", "sales.shark_n":"The shark", "sales.shark_s":"Chad", +"sales.shark_sky":"In orbit: calls airlines and cruise lines first, at the biggest size and a quarter more, and promises half of them a full sky before you have one. They grumble until you do.", "sales.vp_arrived":"The VP of Sales has started, and the CEO has gone back to strategy. The sales desk is free: hire someone.", "sales.vp_asked":"The board agreed, after lunch. A VP of Sales starts in {n} days; until then the CEO keeps selling.", "sales.vp_coming":"A VP of Sales takes over in {n} days.", +"sales.w_anyway":{"one":"signed one of those anyway","other":"signed {n} of those anyway"}, +"sales.w_declined":{"one":"declined a tiny offer","other":"declined {n} tiny offers"}, +"sales.w_last":"Last week {name} {list}.", +"sales.w_now":"This week {name} {list}.", +"sales.w_signed":{"one":"signed a customer ({rev}/mo)","other":"signed {n} customers ({rev}/mo)"}, "save.cash_in_the_bank":"{cash} in the bank", "save.import_failed_err":"Import failed.
{err}", "save.load_name":"Load {name}?", diff --git a/tests/automation.test.js b/tests/automation.test.js index 7a8c05a..4cca19f 100644 --- a/tests/automation.test.js +++ b/tests/automation.test.js @@ -3,29 +3,29 @@ const assert = require('node:assert/strict'); const { load } = require('./harness'); const { lit } = require('../scripts/lib/js-literal'); -// #185's sales and repair engines now run as the NOC intern's standing orders, once per game day. +// #185's engines: the repair one is the NOC intern's standing order, the sales one belongs to the sales desk +// (39-sales-auto.js). Here the engineer, who signs only what the trial says the network can serve, as #185 did. function setup(ev) { - ev("ACT.start({});S.cash=1e8;S.offers=[];S.biz=[];S.nextFail=S.nextEvent=1e6;for(const g of GOALS)S.done[g.id]=0;S.pops.fra.rgen=3;ACT.buyTransit({city:'fra',net:'lvl',tier:1});S.lvl=2;S.ops.intern='kevin';S.ops.floor=0;S.rules=makeRules('freeze');compute()"); + ev("ACT.start({});S.cash=1e8;S.offers=[];S.biz=[];S.nextFail=S.nextEvent=1e6;for(const g of GOALS)S.done[g.id]=0;S.pops.fra.rgen=3;ACT.buyTransit({city:'fra',net:'lvl',tier:1});S.lvl=2;S.ops.intern='kevin';S.ops.floor=0;S.rules=makeRules('freeze');ACT.salesHire({id:'eng'});compute()"); } -const orders = (ev, on) => ev(`for(const k of ${lit(on)})S.ops.on[k]=true`); -const shift = ev => ev('opsDay(S.day)'); +const shift = ev => ev('slAutoDay(S.day);opsDay(S.day)'); function offer(ev, id, extra = {}) { ev(`S.offers.push(${lit({ id, city: 'fra', name: id, type: 'dia', bw: 1, rate: 600, reqs: [], exp: 30, ...extra })})`); } -test('the sales order signs ready offers once per shift, and pausing it stops it', () => { +test('the sales desk signs ready offers once a day, and switching it off stops it', () => { const { ev, dom, errors } = load(); setup(ev); offer(ev, 'first'); shift(ev); assert.equal(ev('S.biz.length'), 0, 'off by default'); - orders(ev, ['sales']); + ev('ACT.salesAuto()'); shift(ev); assert.equal(ev('S.biz[0].id'), 'first'); - ev("ACT.opsToggle({k:'sales'})"); + ev('ACT.salesAuto()'); offer(ev, 'off'); ev('dayTick()'); - assert.equal(ev('S.biz.length'), 1, 'a paused order signs nothing'); + assert.equal(ev('S.biz.length'), 1, 'switched off, it signs nothing'); assert.ok(ev("S.offers.some(o=>o.id==='off')")); assert.deepEqual(errors, []); dom.window.close(); @@ -41,7 +41,7 @@ test('the trial includes new bandwidth and later offers cannot overbook earlier assert.equal(ev('!!autoOffer(S.offers[0])'), true); assert.equal(ev('JSON.stringify(S)'), state); assert.equal(ev('S===beforeState&&R===beforeResult&&UI.hotMap===beforeHot'), true); - ev('S.ops.on.sales=true;opsDay(S.day)'); + ev('S.slAuto.on=true;slAutoDay(S.day)'); assert.equal(ev('S.biz.length'), 1); assert.equal(ev('S.offers[0].id'), 'two'); assert.ok(ev('bizSf(S.biz[0])') >= 0.95); @@ -49,7 +49,7 @@ test('the trial includes new bandwidth and later offers cannot overbook earlier dom.window.close(); }); -test('the sales order checks actual circuits, latency and NNI capacity', () => { +test('the sales desk checks actual circuits, latency and NNI capacity', () => { const { ev, dom, errors } = load(); setup(ev); ev("ACT.buildPop({city:'ams'});S.pops.ams.rgen=3;compute()"); @@ -65,7 +65,7 @@ test('the sales order checks actual circuits, latency and NNI capacity', () => { offer(ev, 'fabric-one', { type: 'fabip', prov, bw: bandwidth, reqs: ['nni'] }); offer(ev, 'fabric-two', { type: 'fabip', prov, bw: bandwidth, reqs: ['nni'] }); // Transit has enough headroom, so the second rejection is the shared NNI port. - ev("S.transit[0].tier=4;compute();S.ops.on.sales=true;opsDay(S.day)"); + ev("S.transit[0].tier=4;compute();S.slAuto.on=true;slAutoDay(S.day)"); assert.equal(ev('S.biz.length'), 1); assert.equal(ev('S.offers[0].id'), 'fabric-two'); assert.ok(ev("nniUsed('fra',fabric)<=NNI[0].g")); @@ -95,7 +95,7 @@ test('fiber sales check live equipment and free spectrum, and repeated carrier o assert.equal(ev('!!autoOffer(S.offers[0])'), false); ev("S.offers[0].slots=1;S.offers[0].name='Same Carrier';S.links[0].eqDown=10;compute()"); assert.equal(ev('!!autoOffer(S.offers[0])'), false, 'a broken amplifier prevents a wave sale'); - ev('S.links[0].eqDown=0;compute();S.ops.on.sales=true;opsDay(S.day)'); + ev('S.links[0].eqDown=0;compute();S.slAuto.on=true;slAutoDay(S.day)'); assert.equal(ev('S.biz.length'), 1); assert.equal(ev('S.biz[0].slots'), 2); assert.equal(ev('S.biz[0].rate'), 1600); @@ -111,7 +111,7 @@ test('capacity pair sales need completed infrastructure and reserve it for the a assert.equal(ev('!!autoOffer(S.offers[0])'), false); ev("ACT.buildPop({city:'ams'});S.links=[{id:'own',a:'fra',b:'ams',kind:'df',own:true,sys:'roadm',ch:[],km:450,sub:false,ready:0,cut:0,mo:1}];compute()"); assert.equal(ev('!!autoOffer(S.offers[0])'), true); - ev('S.ops.on.sales=true;opsDay(S.day)'); + ev('S.slAuto.on=true;slAutoDay(S.day)'); assert.equal(ev('S.biz[0].link'), 'own'); assert.equal(ev('capPend(S.biz[0])'), true, 'normal delivery handover still happens on a game day'); offer(ev, 'second-pairs', { type: 'capfib', city2: 'ams', slots: 2, win: 90 }); @@ -125,7 +125,7 @@ test('future event demand is tested before signing, with booked events reserving setup(ev); offer(ev, 'event', { type: 'event', bw: 80, rate: 0, start: 10, dur: 3, fee: 5000, exp: 9 }); assert.equal(ev('!!autoOffer(S.offers[0])'), true); - ev('S.ops.on.sales=true;opsDay(S.day)'); + ev('S.slAuto.on=true;slAutoDay(S.day)'); assert.equal(ev('S.biz[0].start'), 10, 'the trial does not move the actual event date'); assert.equal(ev('R.cityDem.fra'), 0); offer(ev, 'too-large', { bw: 30 }); @@ -184,7 +184,7 @@ test('the repair order rushes affordable repairs once, skips unaffordable and ex dom.window.close(); }); -test('the sales order leaves unready and expired offers alone without failure notifications', () => { +test('the sales desk leaves unready and expired offers alone without failure notifications', () => { const { ev, dom, errors } = load(); setup(ev); offer(ev, 'generator', { reqs: ['gen'] }); @@ -193,11 +193,11 @@ test('the sales order leaves unready and expired offers alone without failure no offer(ev, 'expired', { exp: 0 }); offer(ev, 'ipv6', { reqs: ['ipv6'] }); const log = ev('S.log.length'); - ev('S.ops.on.sales=true;opsDay(S.day)'); + ev('S.slAuto.on=true;slAutoDay(S.day)'); assert.equal(ev('S.biz.length'), 0); assert.equal(ev('S.offers.length'), 5); - assert.equal(ev('S.log.length'), log, 'no failed manual-action toasts and no shift line when nothing got done'); - ev('S.pops.fra.gen=true;compute();opsDay(S.day)'); + assert.equal(ev('S.log.length'), log, 'no failed manual-action toasts and no notice when nothing got done'); + ev('S.pops.fra.gen=true;compute();slAutoDay(S.day)'); assert.equal(ev('S.biz.length'), 1); assert.equal(ev('S.biz[0].id'), 'generator'); // Manual acceptance keeps its existing sign-now, provision-later behavior. @@ -207,15 +207,17 @@ test('the sales order leaves unready and expired offers alone without failure no dom.window.close(); }); -test('the #185 toggles in old saves become the sales and repair orders, malformed ones stay off', () => { +test('#185\'s auto-repair toggle in old saves becomes the repair order; its auto-accept, which never ran without an intern, goes', () => { const { ev, dom, errors } = load(); setup(ev); - ev("delete S.ops;S.autoSales=true;S.autoRepair=true;S=migrate(JSON.parse(JSON.stringify(S)))"); - assert.equal(ev('S.ops.on.sales&&S.ops.on.repair'), true); + ev("delete S.ops;delete S.slAuto;S.autoSales=true;S.autoRepair=true;S=migrate(JSON.parse(JSON.stringify(S)))"); + assert.equal(ev('S.ops.on.repair'), true); + assert.equal(ev("'sales' in S.ops.on"), false, 'the intern has no sales order any more'); + assert.equal(ev('S.slAuto.on'), false, 'nothing signs on its own that did not before'); assert.equal(ev("'autoSales' in S||'autoRepair' in S"), false); assert.equal(ev('S.ops.intern'), null, 'no intern until you hire one, so nothing runs yet'); ev("delete S.ops;S.autoSales='true';S.autoRepair=1;S=migrate(S)"); - assert.equal(ev('S.ops.on.sales||S.ops.on.repair'), false); + assert.equal(ev('S.ops.on.repair'), false); assert.deepEqual(errors, []); dom.window.close(); }); diff --git a/tests/sales-auto.test.js b/tests/sales-auto.test.js new file mode 100644 index 0000000..ac5a860 --- /dev/null +++ b/tests/sales-auto.test.js @@ -0,0 +1,275 @@ +// Deals belong to Sales: the NOC intern has no sales order any more, the sales desk signs deals for you in its own +// style (src/game/60-features/39-sales-auto.js), and orbit offers go through the desk too (99-pie-sales.js). +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); +const { lit } = require('../scripts/lib/js-literal'); + +// Frankfurt with 400G transit, level 4, nothing breaking, Change Freeze (no fat fingers). +const BASE = "ACT.start({});S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;S.lvl=4;S.nextFail=S.nextEvent=1e9;UI.speed=0;S.rules=makeRules('freeze');S.offers=[];S.biz=[];" + + "ACT.launchBB({city:'fra'});S.pops.fra.rgen=3;ACT.buyTransit({city:'fra',net:'lvl',tier:3});compute()"; +function game(t, who) { + const h = load(); + t.after(() => h.dom.window.close()); + h.ev(BASE); + if (who) h.ev(`ACT.salesHire({id:'${who}'});closeModal()`); + return h; +} +const offer = (ev, id, extra = {}) => ev(`S.offers.push(${lit({ id, city: 'fra', name: id, type: 'dia', bw: 1, rate: 6000, reqs: [], exp: 60, ...extra })})`); +const ids = (ev, k) => JSON.parse(ev(`JSON.stringify(S.${k}.map(x=>x.id))`)); +const desk = ev => ev('slAutoDay(S.day)'); + +test('an old save whose intern ran the sales order loads cleanly: the order is gone, its settings are at the sales desk', t => { + const { ev, dom, errors } = game(t); + ev("ACT.opsHire({id:'kevin'});closeModal()"); + // What 2.10 saved: the order on with its dials, a day that only signed and declined, a week's tally of it. + ev(`S.ops.on.sales=true;S.ops.p.sales={acc:true,min:5000};S.ops.on.repair=true; + S.ops.log=[{d:3,i:'kevin',r:[['sales',2,[]],['decline',5,[]]]},{d:2,i:'kevin',r:[['sales',1,[]],['repair',1,[]]]},{d:1,i:'kevin',r:[]}]; + S.ops.wk={w:0,i:'kevin',n:{sales:3,decline:5,repair:1},wh:{},up:0,mo:0,rev:18000,ff:0};S.ops.rep={w:0,i:'kevin',n:{sales:1},wh:{},up:0,mo:0,rev:6000,ff:0}; + delete S.slAuto;S=migrate(JSON.parse(JSON.stringify(S)))`); + assert.deepEqual(JSON.parse(ev('JSON.stringify(Object.keys(S.ops.on))')).includes('sales'), false, 'no sales order'); + assert.equal(ev("'sales' in S.ops.p"), false); + assert.equal(ev('S.ops.on.repair'), true, 'everything else the intern did stays'); + assert.equal(ev("JSON.stringify(S.ops.log)"), '[{"d":2,"i":"kevin","r":[["repair",1,[]]]},{"d":1,"i":"kevin","r":[]}]', 'a day of only deals has nothing left to say'); + assert.equal(ev("JSON.stringify(S.ops.wk)"), '{"w":0,"i":"kevin","n":{"repair":1},"wh":{},"up":0,"mo":0,"ff":0}'); + assert.equal(ev('S.ops.rep'), null, 'a report of only deals goes'); + assert.equal(ev('JSON.stringify(S.slAuto)'), '{"on":true,"min":5000,"wk":null,"rep":null}', 'the switch and the minimum moved to the sales desk'); + // Nobody runs sales in that save, so nothing signs on its own yet: the player signs by hand, as without the intern. + assert.equal(ev('slP()'), null); + offer(ev, 'tiny', { rate: 600 }); offer(ev, 'ready'); + ev('for(let i=0;i<3;i++)dayTick()'); + assert.deepEqual(ids(ev, 'offers').slice(0, 2), ['tiny', 'ready'], 'nothing declined, nothing signed'); + assert.equal(ev('S.biz.length'), 0); + ev("ACT.accept({id:'ready'})"); + assert.deepEqual(ids(ev, 'biz'), ['ready'], 'by hand, as before'); + // The Ops sheet has no sales order, and every order it shows still has a switch. + dom.window.innerWidth = 360; ev('opsModal()'); + const doc = dom.window.document, ks = [...doc.querySelectorAll('#modalCard [data-act="opsToggle"]')].map(b => JSON.parse(b.dataset.args).k); + assert.deepEqual(ks, JSON.parse(ev('JSON.stringify(OPS.map(o=>o.k))'))); + assert.ok(!ks.includes('sales')); + assert.doesNotMatch(doc.getElementById('modalCard').textContent, /Handle sales|signed|declined/); + // An intern who was not hired never ran the order: nothing to carry over. + ev("S.ops.intern=null;S.ops.on.sales=true;delete S.slAuto;S=migrate(JSON.parse(JSON.stringify(S)))"); + assert.equal(ev('S.slAuto.on||S.slAuto.min'), 0); + // Junk at the desk is repaired. + ev("S.slAuto={on:'yes',min:1234,wk:{w:'x',p:'pirate'},rep:{w:2,p:'eng',n:-4,rev:9e99,x:3,y:'a'}};S=migrate(S)"); + assert.equal(ev('JSON.stringify(S.slAuto)'), '{"on":false,"min":0,"wk":null,"rep":{"w":2,"p":"eng","n":0,"rev":10000000000,"x":3,"y":0}}'); + assert.deepEqual(errors, []); +}); + +test('nobody at the desk: nothing is signed for you, and the sheet says how to change that', t => { + const { ev, dom, errors } = game(t); + ev('S.slAuto.on=true;S.slAuto.min=5000'); + offer(ev, 'tiny', { rate: 600 }); offer(ev, 'ready'); + desk(ev); + assert.deepEqual(ids(ev, 'offers'), ['tiny', 'ready']); + ev('ACT.salesAuto();ACT.salesMin()'); + assert.equal(ev('S.slAuto.on&&S.slAuto.min===5000'), true, 'the switches need someone at the desk'); + ev('ACT.salesOpen()'); + assert.match(dom.window.document.getElementById('modalCard').textContent, /you sign every deal by hand/); + assert.equal(dom.window.document.querySelector('#modalCard [data-act="salesAuto"]'), null); + assert.deepEqual(errors, []); +}); + +test('the engineer signs only what the trial says the network can serve: one trial a day, a misfit waits a week', t => { + const { ev, errors } = game(t, 'eng'); + ev('ACT.salesAuto();ACT.salesMin();ACT.salesMin()'); + assert.equal(ev('S.slAuto.on&&S.slAuto.min'), 5000); + offer(ev, 'tiny', { rate: 600 }); offer(ev, 'gen', { reqs: ['gen'] }); offer(ev, 'huge', { bw: 1e5, rate: 600 }); offer(ev, 'ok'); + ev("window.__t=0;window.__a=autoOffer;autoOffer=o=>{__t++;return __a(o)}"); + desk(ev); + assert.equal(ev('__t'), 1, 'one routing trial a day'); + assert.deepEqual(ids(ev, 'offers'), ['gen', 'huge', 'ok'], 'the tiny one is declined; the unmet promise waits without a trial'); + ev('S.day++'); desk(ev); + assert.deepEqual(ids(ev, 'biz'), ['ok']); + assert.equal(ev("S.biz[0].by"), undefined, 'an offer nobody brought stays nobody\'s'); + assert.equal(ev('JSON.stringify([S.slAuto.wk.n,S.slAuto.wk.x])'), '[1,1]', 'the week\'s tally'); + ev('S.day++'); desk(ev); + assert.equal(ev('__t'), 2, 'the misfit is not tried again within the week'); + ev('S.day+=7'); desk(ev); + assert.equal(ev('__t'), 3); + ev('autoOffer=__a'); + assert.deepEqual(errors, []); +}); + +test('the shark signs every offer the moment it lands, promises and all, while the cash covers the commission', t => { + const { ev, errors } = game(t, 'shark'); + ev('ACT.salesAuto()'); + offer(ev, 'gen', { reqs: ['gen'], by: 'shark' }); offer(ev, 'a', { by: 'shark' }); offer(ev, 'b', { bw: 1e5, rate: 600 }); + ev("window.__t=0;window.__a=autoOffer;autoOffer=o=>{__t++;return __a(o)}"); + const c0 = ev('S.cash'); + desk(ev); + assert.equal(ev('__t'), 0, 'no trial: the shark does not ask the NOC'); + assert.deepEqual(ids(ev, 'biz'), ['gen', 'a', 'b'], 'all three, the one the network cannot carry too'); + assert.equal(c0 - ev('S.cash'), 12000, 'a month of each of his own deals as commission'); + ev('autoOffer=__a'); + ev('S.cash=1000'); offer(ev, 'c', { by: 'shark' }); + desk(ev); + assert.deepEqual(ids(ev, 'offers'), ['c'], 'no cash for the commission: it waits'); + assert.deepEqual(errors, []); +}); + +test('the CEO signs after a trial, and a decline is a handshake away; this week\'s and last week\'s tally in the sheet', t => { + const { ev, dom, errors } = game(t, 'ceo'); + ev('ACT.salesAuto();for(let i=0;i<5;i++)ACT.salesMin()'); + assert.equal(ev('S.slAuto.min'), 50000); + ev('window.__r=0;window.__r0=Math.random;Math.random=()=>{__r++;return __r0();}'); + ev("for(let i=0;i<60;i++)S.offers.push({id:'d'+i,city:'fra',name:'Deal '+i,type:'dia',bw:1,rate:600,reqs:[],exp:60})"); + desk(ev); + ev('Math.random=__r0'); + assert.equal(ev('__r'), 0, 'hashes, not the game\'s random stream'); + const y = ev('S.slAuto.wk.y'); + assert.equal(ev('S.offers.length'), 0, 'every tiny one declined'); + assert.ok(y >= 10 && y <= 30, `about one in three already shaken on (${y} of 60)`); + assert.equal(ev("S.biz.filter(b=>b.by==='ceo').length"), y); + const w = ev('S.slAuto.wk.w'); + ev('S.day=(S.slAuto.wk.w+1)*7'); desk(ev); + assert.equal(ev('S.slAuto.rep.w'), w, 'a new week: last week is the report'); + assert.match(ev('S.log[0].t'), new RegExp(`^Sales desk Last week the CEO declined 60 tiny offers, signed ${y} of those anyway\\.$`)); + ev('S.slAuto.min=0'); offer(ev, 'fit'); + desk(ev); + assert.ok(ids(ev, 'biz').includes('fit'), 'and signs what fits'); + dom.window.innerWidth = 360; ev('ACT.salesOpen()'); + const card = dom.window.document.getElementById('modalCard'); + assert.equal(card.querySelectorAll('.sl-auto .ops-rep').length, 2, 'last week, and this week so far'); + assert.match(card.querySelector('.sl-auto').textContent, /This week the CEO signed a customer \(\+\$6\.0k\/mo\)\./); + ev("UI.left='deals';renderLeft()"); + assert.match(dom.window.document.getElementById('left').textContent, /This week the CEO signed a customer/, 'and on the desk\'s card in Deals'); + assert.deepEqual(errors, []); +}); + +test('the sales sheet with signing for you works at 360 px in every language', t => { + for (const lang of ['en', 'de', 'es', 'fr', 'it', 'pt']) { + const h = load(lang === 'en' ? {} : { lang }); + const { ev, dom, errors } = h; + ev(BASE); dom.window.innerWidth = 360; + const doc = dom.window.document; + ev("ACT.phoneTab({t:'deals'})"); + doc.querySelector('#leftBody [data-act="salesOpen"]').click(); + doc.querySelector('#modalCard [data-act="salesHire"][data-args*="eng"]').click(); + doc.querySelector('#modalCard [data-act="salesAuto"]').click(); + assert.equal(doc.querySelector('#modalCard [data-act="salesAuto"]').getAttribute('aria-pressed'), 'true', lang); + doc.querySelector('#modalCard [data-act="salesMin"]').click(); + assert.equal(ev('S.slAuto.min'), 2000, lang); + assert.doesNotMatch(doc.getElementById('modalCard').textContent, /\b(sales|ops)\.[a-z_]+/, lang); + assert.deepEqual(errors, [], lang); + dom.window.close(); + } +}); + +/* ---------- orbit ---------- */ +// A sandbox with London, New York and Frankfurt, a company, a 16-antenna dish with landing rights at each POP and a +// lasered Shortcrust at cov (1: full). +function sky(t, who, cov = 1) { + const h = load(); + t.after(() => h.dom.window.close()); + const { ev } = h; + ev("ACT.modeSet({m:'sandbox'});ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.nextFail=1e9;S.nextEvent=1e9;S.pieV=1;S.lvl=13;S.offers=[];S.biz=[]"); + ev("for(const c of ['lon','nyc','fra'])if(!S.pops[c])ACT.buildPop({city:c});S.links=S.links.filter(l=>0);" + + "S.links.push({id:'ln',a:'lon',b:'nyc',kind:'wave',tier:3,km:5818,sub:true,cable:'grace',cut:0,mo:1},{id:'lf',a:'lon',b:'fra',kind:'wave',tier:3,km:640,sub:false,cut:0,mo:1});for(const c of ['lon','nyc','fra'])ACT.buyTransit({city:c,net:'cog',tier:1})"); + ev("ACT.pieFound();for(const c of ['lon','nyc','fra']){ACT.pieDish({city:c});S.pie.lic[CITY[c].cc]={state:'ok',until:1e6};}for(const x of S.pie.dishes)x.ant=PIE_ANT_MAX"); + ev(`S.pie.crusts.short.cohorts=[{n:Math.ceil(CRUSTS.short.full*${cov}),day:S.day,las:true}];compute()`); + if (who) ev(`ACT.salesHire({id:'${who}'});closeModal()`); + return h; +} +// n orbit offers as the day brings them (pieSpawn on an empty table, compute kept), by whoever is at the desk. +const spawn = (ev, n = 300) => JSON.parse(ev(`(()=>{const out=[];for(let i=0;i<${n};i++){S.offers=[];const t=pieOfferTypes();if(!t.length)break;pieSpawn(pick(pieSlTypes(t)));for(const o of S.offers)out.push({t:o.type,by:o.by||null,bw:o.bw,rate:o.rate,list:BIZ_T[o.type].rate,reqs:o.reqs.slice(),city:o.city});}S.offers=[];return JSON.stringify(out);})()`)); +const avg = (l, f) => l.reduce((a, x) => a + f(x), 0) / Math.max(1, l.length); + +test('orbit offers without a salesperson are what they were: nobody\'s, list price, no promises', t => { + const { ev, errors } = sky(t); + const o = spawn(ev); + assert.ok(o.length > 200); + assert.ok(o.every(x => x.by === null && x.rate === x.list && !x.reqs.length)); + assert.deepEqual(errors, []); +}); + +test('the engineer sells orbit only where the dish has room to spare, and those customers stay', t => { + const { ev, errors } = sky(t, 'eng'); + const o = spawn(ev); + assert.ok(o.length > 200 && o.every(x => x.by === 'eng' && x.rate === x.list && !x.reqs.length)); + // Every dish nearly full: the room left fits the smallest deal, but not with the engineer's headroom. + ev("S.biz=[];window.__room=()=>{const ds=pieDishes();return ds.map(d=>d.g)};for(const c of ['lon','nyc','fra'])S.biz.push({id:'fill'+c,type:'pizza',city:c,city2:null,bw:pieDishes().find(d=>d.city===c).g-30,rate:1,reqs:[],latMax:null,route:'normal',name:'Fill '+c,mood:100,since:0,sites:null});compute()"); + assert.ok(ev("pieOfferTypes().length") > 0, 'the market still has room'); + assert.equal(spawn(ev, 50).filter(x => x.t === 'flywifi').length, 0, 'not even a 20G airline where the dish has 30G left'); + ev("S.salesBak=S.sales.p;S.sales.p=null"); + assert.ok(spawn(ev, 50).some(x => x.t === 'flywifi'), 'without them, that airline is offered'); + ev('S.sales.p=S.salesBak;delete S.salesBak'); + assert.equal(ev("salesLeaveMul({by:'eng',type:'pizza'})"), 0.5, 'their orbit customers renew like the nerds'); + assert.equal(ev("salesLeaveMul({by:'eng',type:'dia'})"), 0.75); + assert.deepEqual(errors, []); +}); + +test('the shark sells airlines and cruise lines, the biggest that fits at a quarter more, and promises a full sky', t => { + const { ev, errors } = sky(t, 'shark', 0.7); + const plain = (() => { ev("S.sales.p=null"); const x = spawn(ev); ev("S.sales.p='shark'"); return x; })(); + const o = spawn(ev); + assert.ok(o.every(x => x.by === 'shark' && x.rate === Math.round(x.list * 1.25))); + assert.ok(o.every(x => ['flywifi', 'boat', 'marsorb'].includes(x.t)), 'no pizza homes while bigger fish are around'); + const size = l => avg(l, x => x.bw * x.rate); + assert.ok(size(o) > size(plain) * 1.5, `bigger deals (${Math.round(size(o))} vs ${Math.round(size(plain))} a month)`); + const over = o.filter(x => x.reqs.includes('skyfull')).length / o.length; + assert.ok(over > 0.35 && over < 0.65, `half of them promised a full sky at 70% (${Math.round(over * 100)}%)`); + // Signing one pays the commission; the promise makes them grumble, never cancel, until the sky is full. + ev("S.offers=[];for(let i=0;i<50&&!S.offers.some(o=>o.reqs.includes('skyfull'));i++){S.offers=[];pieSpawn('boat');}"); + const r = JSON.parse(ev("(()=>{const o=S.offers[0],c=S.cash;ACT.accept({id:o.id});const b=S.biz.find(b=>b.id===o.id);return JSON.stringify({paid:c-S.cash,mo:b.bw*b.rate,by:b.by});})()")); + assert.equal(r.by, 'shark'); + assert.equal(r.paid, r.mo, 'a month of the deal as commission'); + // One the sky serves in full (a full dish is the shark's other way to oversell), promised more than it has. + ev("S.biz=[{id:'cruise',type:'boat',city:'lon',city2:null,bw:50,rate:34375,reqs:['skyfull'],latMax:null,route:'normal',name:'Promised Cruises',mood:100,since:-100,sites:null,by:'shark'}];compute()"); + assert.ok(ev("bizSf(S.biz[0])") >= 0.95, 'served in full'); + ev("const b=S.biz[0];window.__m=[];for(let i=0;i<80;i++){dayTick();__m.push(Math.round(b.mood));}"); + const m = JSON.parse(ev('JSON.stringify(__m)')); + assert.ok(ev('S.biz.length') === 1 && m.at(-1) === ev('PIE_GRUMBLE'), `grumbles down to ${ev('PIE_GRUMBLE')} and stays (${m.slice(0, 5)}…${m.at(-1)})`); + ev("S.pie.crusts.short.cohorts=[{n:CRUSTS.short.full,day:S.day,las:true}];compute();for(let i=0;i<10;i++)dayTick()"); + assert.ok(ev('S.biz[0].mood') > m.at(-1), 'a full sky keeps the promise: happier again'); + assert.deepEqual(errors, []); +}); + +test('the CEO and the Founder sign a big orbit deal on the golf course at 30% off; jumpy markets cost him', t => { + const { ev, errors } = sky(t, 'ceo', 0.8); + const golfDay = ev("(()=>{for(let d=S.day+1;d{__r++;return __r0();}'); + ev(`S.day=${golfDay};salesGolf(S.day)`); + ev('Math.random=__r0'); + assert.equal(ev('__r'), 0, 'no draws from the game\'s random stream'); + const b = JSON.parse(ev("JSON.stringify(S.biz.at(-1))")); + assert.equal(b.type, 'marsorb', 'the Mars mission first'); + assert.equal(b.by, 'ceo'); + assert.equal(b.rate, Math.round(ev('BIZ_T.marsorb.rate') * 0.7), '30% off list'); + assert.deepEqual(b.reqs, ['skyfull'], 'with a promise nobody checked (the crust is at 80%)'); + assert.match(ev('S.log[0].t'), /The CEO and the Founder signed .+ on the golf course: .+ in orbit over .+, 30% off list\. He also promised: Promised a full sky/); + // Jitters: his own orbit offers get cheaper, a golf deal too, and from 0.6 the Founder does not show up. + ev('S.pie.founder.jit=0.5'); + const o = spawn(ev, 50); + assert.ok(o.every(x => x.by === 'ceo' && x.rate === Math.round(x.list * 0.8)), 'orbit prices 20% down at jitters 0.5'); + const n = ev('S.biz.length'); + ev(`salesGolf(${golfDay})`); + assert.equal(ev('S.biz.length'), n + 1); + assert.equal(ev('S.biz.at(-1).rate'), Math.round(ev(`BIZ_T.${ev('S.biz.at(-1).type')}.rate`) * 0.7 * 0.8), 'and the golf deal too'); + ev('S.pie.founder.jit=0.7'); + ev(`salesGolf(${golfDay})`); + assert.equal(ev('S.biz.length'), n + 1, 'the Founder skipped golf'); + assert.match(ev('S.log[0].t'), /The Founder skipped golf/); + // A golf day of the other kind is on the ground, as before. + const ground = ev("(()=>{for(let d=S.day+1;d=PIE_GOLF_SKY)return d;})()"); + ev(`salesGolf(${ground})`); + assert.equal(ev('BIZ_T[S.biz.at(-1).type].orbit'), undefined, 'on the ground'); + assert.deepEqual(errors, []); +}); + +test('the sales desk signs orbit offers where the dish has room, without a routing trial', t => { + const { ev, errors } = sky(t, 'eng'); + ev('ACT.salesAuto()'); + ev("S.offers=[];pieSpawn('pizza');pieSpawn('boat')"); + const want = ids(ev, 'offers'); + ev("window.__t=0;window.__a=autoOffer;autoOffer=o=>{__t++;return __a(o)}"); + ev('slAutoDay(S.day);autoOffer=__a'); + assert.equal(ev('__t'), 0); + assert.deepEqual(ids(ev, 'biz'), want, 'both signed in one day'); + assert.ok(ev("S.biz.every(b=>b.by==='eng')")); + // A full dish: an offer that does not fit waits. + ev("S.offers=[{id:'big',city:'lon',city2:null,name:'Big Boat',type:'boat',bw:1e5,rate:27500,reqs:[],exp:S.day+40,by:'eng'}];slAutoDay(S.day)"); + assert.deepEqual(ids(ev, 'offers'), ['big']); + assert.deepEqual(errors, []); +}); diff --git a/tests/sales-trial.test.js b/tests/sales-trial.test.js index 4b4e464..c74ef9f 100644 --- a/tests/sales-trial.test.js +++ b/tests/sales-trial.test.js @@ -5,7 +5,7 @@ const path = require('node:path'); const { load } = require('./harness'); const { lit } = require('../scripts/lib/js-literal'); -// The sales trial (#185, the intern's sales order) runs the pass with the offer first and skips the pass without +// The sales trial (#185, now the sales desk's signing for you) runs the pass with the offer first and skips the pass without // it when it cannot change the answer. It must sign exactly the offers the original two-pass trial signs. const ORIGINAL = `(function(o){if(!o||!own(BIZ_T,o.type)||!(o.exp>S.day)||!(o.bw>0)||o.rate<0||!bCities(o).length||!bCities(o).every(popUp)||!reqOk(o))return null; const T=BIZ_T[o.type],b=offerCustomer(o);if(T.event&&(!(o.start>S.day)||!(o.dur>0)))return null; diff --git a/tests/standing-orders.test.js b/tests/standing-orders.test.js index 1e7e99f..d5ed72a 100644 --- a/tests/standing-orders.test.js +++ b/tests/standing-orders.test.js @@ -141,18 +141,6 @@ test('PNI: weekly, big enough networks only, paid peering left out by default, a assert.deepEqual(errors, []); }); -test('sales: decline offers below the minimum, sign the ready ones with #185\'s trial', t => { - const { ev, errors } = game(t); - hire(ev); on(ev, 'sales', { acc: true, min: 5000 }); - ev('S.transit[0].tier=3;S.pops.fra.rgen=3;compute()'); - ev("S.offers=[{id:'tiny',city:'fra',name:'Tiny',type:'dia',bw:1,rate:600,reqs:[],exp:30},{id:'big',city:'fra',name:'Big',type:'dia',bw:10,rate:600,reqs:[],exp:30},{id:'gen',city:'fra',name:'Gen',type:'dia',bw:10,rate:600,reqs:['gen'],exp:30}]"); - shift(ev); - assert.deepEqual(JSON.parse(ev('JSON.stringify(S.biz.map(b=>b.id))')), ['big']); - assert.deepEqual(JSON.parse(ev('JSON.stringify(S.offers.map(o=>o.id))')), ['gen'], 'unmet requirements wait, the tiny one is gone'); - assert.match(ev('opsEntry(S.ops.log[0])'), /declined a tiny offer, signed a customer/); - assert.deepEqual(errors, []); -}); - test('repairs: rush what has a price, as the Rush repair button would', t => { twins(t, "S.links=[{id:'f',a:'fra',b:'ams',kind:'df',sys:'lite',ch:['zr4'],km:450,sub:false,ready:0,cut:0,eqDown:10,mo:1}];S.inc=[{id:'amp',type:'amp',ref:'f',until:10,cost:3000,msg:'amp'}];S.pops.ams={day:0,bb:null,boost:0,down:0,routers:1,gen:false}", ev => on(ev, 'repair'), "ACT.fixInc({id:'amp'})", 'S.inc.length'); @@ -235,26 +223,27 @@ test('the shift runs inside dayTick, respects a stopped clock, batches its work test('the NOC gets one notice a week, the shift report; the daily lines stay in the Ops sheet', t => { const { ev, errors } = game(t, "S.transit[0].hist=[600]"); ev('S.day=14'); - hire(ev); on(ev, 'transit', { x: 1.5 }); on(ev, 'sales', { acc: true, min: 5000 }); + hire(ev); on(ev, 'transit', { x: 1.5 }); ev('S.transit[0].tier=3;S.pops.fra.rgen=3;compute()'); const n0 = ev('S.log.length'); for (let d = 14; d < 21; d++) { - if (d === 15) ev("S.offers=[{id:'tiny',city:'fra',name:'Tiny',type:'dia',bw:1,rate:600,reqs:[],exp:60},{id:'big',city:'fra',name:'Big',type:'dia',bw:10,rate:600,reqs:[],exp:60}]"); + if (d === 15) ev('S.transit[0].hist=[6000]'); ev(`S.day=${d}`); shift(ev); } assert.equal(ev('S.log.length'), n0, 'a whole week of shifts: no NOC notice yet'); assert.ok(ev('S.ops.log.length') >= 2, 'the Ops sheet has the daily detail'); ev('S.day=21'); shift(ev); assert.equal(ev('S.log.length'), n0 + 1, 'one notice for the week'); - assert.match(ev('S.log[0].t'), /^Kevin's week Kevin signed a customer \(\+\$6\.0k\/mo\), topped up transit .*declined a tiny offer.*Week total: \$[\d.]+k up front, \+\$[\d.]+k\/mo\./); - assert.equal(ev('S.log[0].k'), 'good'); + assert.match(ev('S.log[0].t'), /^Kevin's week Kevin topped up transit .*Week total: \$[\d.]+k up front, \+\$[\d.]+k\/mo\./); + assert.doesNotMatch(ev('S.log[0].t'), /signed|declined/, 'deals are the sales desk\'s, not the intern\'s'); ev('S.day=22'); shift(ev); assert.equal(ev('S.log.length'), n0 + 1, 'and nothing more until the next week ends'); - // Only the sales order now: one tiny offer declined on day 23, reported when the week ends. - ev("for(const k in S.ops.on)S.ops.on[k]=false;S.ops.on.sales=true;S.offers=[{id:'t2',city:'fra',name:'T2',type:'dia',bw:1,rate:600,reqs:[],exp:60}];S.day=23");shift(ev); - ev("S.day=28");shift(ev); + // A week that only stopped at the budget, on day 23, reported when the week ends. + ev("S.ops.cap.transit=10000;S.ops.spent.transit=10000;S.ops.p.transit={x:3};S.day=23");shift(ev); + // A minute later in real time, so this one does not fold into last week's (both are plain notices now). + ev("S.log[0].at-=60000;for(const k in S.ops.on)S.ops.on[k]=false;S.day=28");shift(ev); assert.equal(ev('S.log.length'), n0 + 2); - assert.match(ev('S.log[0].t'), /declined a tiny offer\.$/, 'nothing spent: no money line'); + assert.match(ev('S.log[0].t'), /stopped at the budget for .*Keep transit headroom\)?\.$/, 'nothing spent: no money line'); assert.equal(ev('S.log[0].k'), ''); ev("S.day=35");shift(ev); assert.equal(ev('S.log.length'), n0 + 2, 'an idle week: no notice'); @@ -288,9 +277,7 @@ test('the mood follows the week, with no dice', t => { const quiet = ev('opsMood()'); assert.equal(ev('opsMood()'), quiet, 'the same day reads the same'); assert.ok([ev("tr('ops.mood_quiet',{name:'Kevin'})"), ev("tr('ops.mood_kevin')")].includes(quiet)); - ev("S.ops.wk=opsWkNew(Math.floor(S.day/7));S.ops.wk.n.sales=1"); - assert.equal(ev('opsMood()'), ev("tr('ops.mood_sales',{name:'Kevin'})")); - ev("S.ops.wk.n.broke=1;delete S.ops.wk.n.sales"); + ev("S.ops.wk=opsWkNew(Math.floor(S.day/7));S.ops.wk.n.broke=1"); assert.equal(ev('opsMood()'), ev("tr('ops.mood_broke',{name:'Kevin'})")); assert.deepEqual(errors, []); }); @@ -346,8 +333,8 @@ test('saves: old saves load with no intern and everything off, settings survive assert.equal(ev("JSON.stringify(S.ops.skip)"), '{"fra":["transit"]}'); assert.equal(ev("JSON.stringify(S.ops.log)"), '[{"d":1,"i":"kevin","r":[["transit",2,["fra +1×100G"]]]}]'); assert.equal(ev('S.ops.floor===50000&&S.ops.tpl.bb===true'), true); - ev(`S.ops.wk={w:3,i:'kevin',n:{sales:2,evil:9,transit:'x'},wh:{transit:['fra +1×100G','']},up:-5,mo:'a',rev:41000,ff:99};S.ops.rep={i:'mallory'};S=migrate(S)`); - assert.equal(ev("JSON.stringify(S.ops.wk)"), '{"w":3,"i":"kevin","n":{"sales":2},"wh":{"transit":["fra +1×100G"]},"up":0,"mo":0,"rev":41000,"ff":7}'); + ev(`S.ops.wk={w:3,i:'kevin',n:{sales:2,evil:9,transit:'x',repair:2},wh:{transit:['fra +1×100G','']},up:-5,mo:'a',rev:41000,ff:99};S.ops.rep={i:'mallory'};S=migrate(S)`); + assert.equal(ev("JSON.stringify(S.ops.wk)"), '{"w":3,"i":"kevin","n":{"repair":2},"wh":{"transit":["fra +1×100G"]},"up":0,"mo":0,"ff":7}', 'the retired sales order\'s tally goes'); assert.equal(ev('S.ops.rep'), null); assert.deepEqual(errors, []); }); @@ -381,22 +368,6 @@ test('the Ops sheet works at 360 px in every language, from the NOC tab and the } }); -test('sales trial at most one offer a shift, and an offer that did not fit waits a week', t => { - const { ev, errors } = game(t); - hire(ev); on(ev, 'sales', { acc: true, min: 0 }); - ev("S.offers=['a','b','c'].map(id=>({id,city:'fra',name:id,type:'dia',bw:1e5,rate:600,reqs:[],exp:60}));window.__t=0;window.__a=autoOffer;autoOffer=o=>{__t++;return __a(o)}"); - shift(ev); - assert.equal(ev('__t'), 1, 'one routing trial per shift'); - for (let i = 0; i < 2; i++) { ev('S.day++'); shift(ev); } - assert.equal(ev('__t'), 3, 'each offer once'); - ev('S.day++'); shift(ev); - assert.equal(ev('__t'), 3, 'too big for the network: not tried again within the week'); - ev('S.day+=7'); shift(ev); - assert.equal(ev('__t'), 4); - ev('autoOffer=__a'); - assert.deepEqual(errors, []); -}); - test('re-hiring in a later month starts on a fresh budget, not last month\'s spending', t => { const { ev, errors } = game(t); hire(ev); @@ -452,11 +423,11 @@ test('decommission keeps its spare in another trench than the big link', t => { assert.deepEqual(errors, []); }); -test('decommission sees the traffic of a customer signed earlier in the same shift', t => { +test('decommission sees the traffic of a customer the sales desk signed the same day', t => { const { ev, errors } = game(t, "S.pops.fra.bb.d=30;ACT.buildPop({city:'ams'});S.pops.ams.rgen=1;for(const [id,tier,tr] of [['big',2,'T1'],['s1',1,'T2'],['s2',1,'T3']])S.links.push({id,a:'fra',b:'ams',kind:'wave',tier,km:400,sub:false,cut:0,mo:1000,trench:tr});compute()"); - hire(ev); on(ev, 'sales', { acc: true, min: 0 }); on(ev, 'decom', { keep: false }); - ev("S.offers=[{id:'o1',city:'fra',city2:'ams',name:'Bulk Co',type:'l2vpn',bw:450,rate:20,reqs:[],exp:S.day+20}]"); - shift(ev); + hire(ev); on(ev, 'decom', { keep: false }); + ev("ACT.salesHire({id:'eng'});S.slAuto.on=true;closeModal();S.offers=[{id:'o1',city:'fra',city2:'ams',name:'Bulk Co',type:'l2vpn',bw:450,rate:20,reqs:[],exp:S.day+20}]"); + ev('slAutoDay(S.day)'); shift(ev); assert.deepEqual(JSON.parse(ev('JSON.stringify(S.biz.map(b=>b.id))')).length, 1, 'signed'); assert.equal(ev('S.links.length'), 3, 'its 450G needs every wave, so none goes'); ev('compute()'); @@ -464,13 +435,13 @@ test('decommission sees the traffic of a customer signed earlier in the same shi assert.deepEqual(errors, []); }); -test('no recompute on a shift that only declined offers or stopped at a budget', t => { +test('no recompute on a shift that only stopped at a budget', t => { const { ev, errors } = game(t); - hire(ev); on(ev, 'sales', { acc: false, min: 50000 }); on(ev, 'transit', { x: 3 }, 10000); - ev("S.ops.spent.transit=10000;S.transit[0].hist=[600];S.offers=[{id:'tiny',city:'fra',name:'Tiny',type:'dia',bw:1,rate:600,reqs:[],exp:30}]"); + hire(ev); on(ev, 'transit', { x: 3 }, 10000); + ev("S.ops.spent.transit=10000;S.transit[0].hist=[600]"); const n = ev("window.__c=compute;window.__n=0;compute=()=>{__n++;return __c()};opsDay(S.day);compute=__c;__n"); assert.equal(n, 0, 'nothing in the network changed'); - assert.match(ev('opsEntry(S.ops.log[0])'), /declined a tiny offer, stopped at the budget/); + assert.match(ev('opsEntry(S.ops.log[0])'), /stopped at the budget/); ev("S.ops.spent.transit=0"); assert.equal(ev("window.__n=0;compute=()=>{__n++;return __c()};opsDay(S.day);compute=__c;__n"), 1, 'a real job still recomputes once'); assert.deepEqual(errors, []); @@ -567,8 +538,8 @@ test('transit: the log line and budget line show the monthly cost a top-up adds' test('#226 the shift report\'s Open button in the NOC opens the Ops sheet, and survives a reload', t => { const { ev, errors, dom } = game(t); - ev('S.day=14'); hire(ev); on(ev, 'sales', { acc: false, min: 5000 }); - ev("S.offers=[{id:'t',city:'fra',name:'T',type:'dia',bw:1,rate:600,reqs:[],exp:60}];S.day=15"); shift(ev); + ev('S.day=14'); hire(ev); on(ev, 'transit', { x: 3 }, 10000); + ev("S.ops.spent.transit=10000;S.transit[0].hist=[600];S.day=15"); shift(ev); ev('S.day=21'); shift(ev); assert.match(ev('S.log[0].t'), /^Kevin's week/); ev("S=migrate(JSON.parse(JSON.stringify(S)));closeModal();ACT.leftTab({t:'noc'})"); From 9d64aa0144a83dea11cdff54eda758b8c51fae88 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Fri, 6 Nov 2026 10:02:28 +0100 Subject: [PATCH 09/10] Pie in the Sky, three charters and Sales runs the deals (3.0.0) --- CHANGELOG.md | 41 ++++++++++++++++++++++------------------- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b2a039..783e390 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,31 +6,34 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] -- A new game now asks what you are building before it starts, and there is a third answer: Cable broker. The broker lays fiber on land and cables under the sea from day one, at the usual prices, lights them and sells the capacity to other carriers; it has ten goals of its own, carriers call it with capacity deals, and its win is Glass Baron: your own cables land on five continents while carriers pay you $1M a month. The Global backbone and the Low-latency boutique play as before, and the choice is now a popup at the start instead of a card you could miss (#300). +## [3.0.0] — 2026-11-06 + +**Series of Tubes 3.0: Pie in the Sky.** You have wired up the planet with fiber, cables and routers. Now take your network to orbit: start your own rocket company, fill the sky with satellites (we call them pies) and sell internet to everyone your cables will never reach. + +**How to get there.** Become Tier 1 in a game started with 3.0, whatever your charter, and Pie Control opens from the NOC tab, right next to the NOC dashboard. Want to look around first? In Sandbox the rocket company is yours from day one. Games you started before 3.0 keep the rules they began with. + +**Rockets, pies and crusts.** Build a pie factory and a launch pad on the coast (the closer to the equator, the cheaper each launch), then fly rockets that carry pies into four orbital shells, the crusts. Once a crust is 40% full it starts carrying traffic: pie dishes at your POPs land it on your backbone, and homes and boats in the remotest places, airlines, cruise lines and even a Mars mission sign up. A town no cable reaches can join your network through orbit. You watch it all on a spinning cartoon globe, launches and fireballs included. + +**Space is not quiet.** Solar storms, food fights in orbit, failed launches and spats with governments over landing rights keep you busy, and the Founder of your rocket company does something daft every few months, so the markets get the jitters until it wears off. Governments pay for space too, in a new Government money section of the bank. Run it well and a full constellation pays for itself in about seven years. + +**Three charters.** A new game now starts by asking what you are building. **Global backbone** is the classic game: grow everywhere and become Tier 1. **Low-latency boutique** lives on speed: trading firms call more often and pay more, and you win Speed of Light by beating the fastest leased latency on finance routes with your own glass. **Cable broker** is new: lay fiber on land and cables under the sea from day one, light them and sell the capacity to other carriers, and win Glass Baron when your own cables land on five continents while carriers pay you $1M a month. Every charter can still become Tier 1, and so reach orbit. + +**Sales runs the deals.** Your salesperson can now sign deals for you, orbit customers included, each in their own style, while the NOC intern sticks to running the network. + +- Pie in the Sky: become Tier 1 and you can start your own rocket company, putting your network in orbit. Win Tier 1 in a game started from this version (any charter), and Pie Control opens from the NOC tab, next to the NOC dashboard; in Sandbox it is there from day one. Build a pie factory and a launch pad on the coast (near the equator, launches are cheaper), fly rockets that carry satellites ("pies") into four orbital shells ("crusts"), and watch it all on a spinning cartoon globe with a night side, laser links between pies and launches that either spill their pies into orbit or end in a fireball. +- A new game now starts by asking what you are building, with three charters to choose from (#300). Global backbone is the classic game: grow everywhere and become Tier 1. Low-latency boutique: trading firms and other latency customers call more often and pay more, and you win Speed of Light by beating the fastest leased latency on finance routes with your own glass. Cable broker is new: lay fiber on land and cables under the sea from day one, light them and sell the capacity to other carriers, with ten goals of its own and the Glass Baron win when your own cables land on five continents while carriers pay you $1M a month. Every charter can still become Tier 1, and with it reach Pie in the Sky. +- Your pies carry real traffic and earn money once a crust is 40% full. Pie dishes (ground stations) at your POPs land the traffic on your backbone, with landing rights bought country by country. Homes and boats in the remotest places (Pitcairn, the Arctic, the outer islands), airlines, cruise lines and even a Mars mission sign up, and a town no cable reaches can join your network through orbit. Before a crust carries anything, buoys and sensors that live with gaps in the sky pay a little; when it starts carrying traffic, a grand opening brings a month of daily calls. +- Space is not quiet, and neither is your Founder. Solar storms, food fights in orbit, rain over tropical dishes, failed launches and geopolitical spats over data and landing rights keep you busy, and the Founder of your rocket company does something daft every few months, so markets get the jitters until it wears off. A full constellation pays for itself in about seven years if you run it well. +- Deals belong to Sales now: your salesperson can sign deals for you, orbit customers included. The NOC intern sticks to the network. The engineer, the shark and the CEO each sign in their own style, and each sells orbit their own way, from careful deals where a pie dish has room to Mars missions agreed with the Founder on the golf course. +- Governments pay for space too, in a new Government money section of the bank (Cash · Bank): the Rural Digital Pie Fund auctions support for remote towns only your satellites reach, the Export-Import Pie Bank lends against launches with strings attached, and the UK pays a grant when Pitcairn is served from orbit. +- Pie Control helps you plan: the Launch tab says how long each crust takes to fill at your current pace and points to a better pad when your pads are the bottleneck, the Dishes tab tells you when dishes are worth building, and the Traffic tab shows who rides your satellites, how full each crust and dish is, and why a sky is still empty. Traceroute follows packets through orbit too. +- The NOC tab is tidier: Pie Control sits in its top row next to the NOC dashboard, traceroute moved into Routing & DDoS, and All connections lives in the NOC dashboard. - From customer level 9 you can lay your own subsea cable without being Tier 1 first (#300). - Traffic now leaves your network at the nearest peering, so a PNI in London no longer pulls New York's traffic across the Atlantic when the New York IX reaches the same network (#298). Where a PNI and an IX port reach a network in the same city, the PNI still goes first, and RouteScript's `prefer pni` still hauls everything to your PNIs. - Fabric (NNI) ports now grow like your other ports: buy them at 10G, 100G or 400G (as fast as your router takes), and bundle up to eight into a LAG when one is not enough (#140). A fabric customer is no longer accepted, by hand or automatically, when its bandwidth would not fit on the port as well (#307). - Pressing Space to play again after a pause now picks up at the speed you were playing, not always at 1× (#299). -- Become a Tier 1 in a new game and you can found your own rocket company: build a pie factory and launch pads, fly rockets, and fill four crusts of satellites (pies) around the planet, with pie dishes at your POPs and landing rights country by country. It costs billions, every launch has a party, and the Founder posts about all of it. Sandbox games have it from day 0. Games already won before this version stay as they are. -- Space is not quiet for long: three months after your rocket company starts, solar storms, food fights in orbit, rain over tropical pie dishes, backhoes, astronomers and the Founder's 3 a.m. posts come for your satellites. Countries join in too, with landing rights refused for a while, data that has to stay home, two neighbours claiming the same band, a kill switch for exam week, a jammed border, a rival filing for orbits first, a launch pad on offer and traffic that must avoid the neighbour's dishes. Each one asks you to pick one of two answers. A ruleset with no chaos keeps the sky calm. -- Your pies now carry traffic and earn money: homes and boats in the remotest places (Pitcairn, the Arctic, the outer islands), airlines, cruise ships and the Mars mission sign up once a baked crust and a pie dish can serve them. With laser links, trading circuits between cities more than 3,000 km apart take the faster path through space, where light runs about half again as fast as in glass; everything else stays on your fiber. A dish whose POP is cut off from your backbone serves only the customers next to it, and a full constellation takes years to pay for itself. -- Pie Control now shows what traffic rides your satellites: a new Traffic tab lists who is in orbit (homes, boats, airlines, the Mars mission and trading circuits), how many Gbps each one uses, what it pays, and how much faster orbit is than your fiber. Each crust and pie dish gets a load bar and a plain reason when it sits idle (half-baked, raining, jammed, cut off from your backbone, no landing rights, no lasers, no customers), and an empty sky gets a checklist of what is missing. The globe draws each customer's traffic as a glowing arc you can highlight from the list, dishes on the globe and the map get a load ring, and the traceroute shows a circuit's hops up to orbit, across space and back down. -- A town with no cable can now reach your network through your satellites: a pie dish at a POP your fiber does not reach sends all of that town's traffic up to a baked crust and down at one of your dishes on the backbone, nearby or, with laser links, anywhere. The pipe is small (the dishes' antennas and the crust's room) and adds the orbit's delay, so a big town fills it quickly and laying fiber stays the real fix; it never carries traffic between your other cities. Pie Control's Traffic tab shows each backhaul, how full it is, where it lands and how many ms it adds, or why it is missing, the globe draws it, and the traceroute shows its hops through space. -- 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 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 Founder of your rocket company now does something daft every few months, and the markets get jumpy every time: a sleepless posting spree that makes orbit customers nervous, a fight with a country's regulator, a launch date leaked early that makes launch insurance dearer, a promise of Mars by next year that costs a few customers when it slips, and worse. It always wears off: Pie Control's Company tab shows how jittery the market is and how soon it calms down. With no chaos in your ruleset he only posts. -- 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. -- Deals belong to Sales now: the NOC intern sticks to the network, and your salesperson can sign deals for you, orbit customers included. Open the sales desk in Deals, switch on Sign deals and pick a minimum below which offers are declined: the engineer signs only what your network can serve, the shark signs everything at once (promises and commission included), and the CEO signs what fits but now and then has already shaken hands on an offer you would have declined. If your intern used to handle sales, that setting moved to the sales desk; with nobody running sales you sign by hand, as before. -- Your salesperson now sells for your rocket company too. The engineer only sells where a pie dish has room to spare, and those customers stay longer; the shark goes after airlines and cruise lines at the biggest size and a quarter more, and promises half of them a full sky before you have one, so they grumble until you do; the CEO plays every other round of golf with the Founder and comes back with the biggest orbit deal that fits (the Mars mission first) at 30% off, unless the markets are jumpy, which costs him. ## [2.10.1] — 2026-11-05 diff --git a/package-lock.json b/package-lock.json index 23919c8..a5c7090 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "seriesoftubes", - "version": "2.10.1", + "version": "3.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "seriesoftubes", - "version": "2.10.1", + "version": "3.0.0", "license": "MIT", "devDependencies": { "@modelcontextprotocol/node": "2.1.2", diff --git a/package.json b/package.json index 80fbae3..4e6ade7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "seriesoftubes", - "version": "2.10.1", + "version": "3.0.0", "description": "A cartoon browser game about building the internet.", "private": true, "license": "MIT", From 1e7638c4b93af61a446949ee8a01d7d4e4c467a6 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Fri, 6 Nov 2026 17:19:17 +0000 Subject: [PATCH 10/10] The intern standardizes routers on a chosen model; Ops settings are lists Keep routers ahead gets a Model setting: the next generation when busy (as before), or a model to standardize on. With a model, every POP on a smaller one is swapped to it, the busiest first, within the monthly budget, through the same upRouter click: never a step down, only unlocked models that fit, and only where a second router carries the traffic or nothing runs yet. Busy POPs on it only get more routers. Every setting in the Standing orders sheet (each order's dials, budgets, the cash floor) is a dropdown instead of a button that steps through the values. The change handler passes a select's data-args, the actions take the picked position (v) and still step without one for the MCP tools, which now declare v as optional. --- CHANGELOG.md | 2 + site/i18n/de.js | 4 +- site/i18n/es.js | 4 +- site/i18n/fr.js | 4 +- site/i18n/it.js | 4 +- site/i18n/pt.js | 4 +- src/agent/20-commands.js | 12 +-- src/game/60-features/95-standing-orders.js | 23 ++++- src/game/90-actions/88-ops.js | 13 ++- src/game/93-ui/57-ops-panel.js | 11 +- src/game/96-map/95-clicks.js | 2 +- src/i18n/en.js | 4 +- src/styles/36-ops.css | 3 + tests/intern-optics.test.js | 10 +- tests/intern-router-model.test.js | 112 +++++++++++++++++++++ tests/standing-orders.test.js | 9 +- 16 files changed, 188 insertions(+), 33 deletions(-) create mode 100644 tests/intern-router-model.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 783e390..0fb4ce3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- Your intern can standardize your routers on a model you choose: pick it in Keep routers ahead, and every POP on a smaller model is swapped to it, the busiest first, within the monthly budget. Every setting in the Standing orders sheet is now a list to pick from instead of a button to tap through. + ## [3.0.0] — 2026-11-06 **Series of Tubes 3.0: Pie in the Sky.** You have wired up the planet with fiber, cables and routers. Now take your network to orbit: start your own rocket company, fill the sky with satellites (we call them pies) and sell internet to everyone your cables will never reach. diff --git a/site/i18n/de.js b/site/i18n/de.js index 2a9fa15..4374a2f 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -3237,6 +3237,7 @@ "ops.l_snag":{"one":"ist bei {where} hängen geblieben und hat den Auftrag pausiert, bis du draufschaust","other":"ist bei {n} Aufträgen hängen geblieben ({where}) und hat sie pausiert, bis du draufschaust"}, "ops.l_transit":{"one":"hat Transit in {where} aufgestockt","other":"hat {n}-mal Transit aufgestockt ({where})"}, "ops.locked":"Das NOC stellt ab Kundenlevel {lv} Praktikanten ein.", +"ops.model_next":"Nächste Generation, wenn ausgelastet", "ops.mood_annie":"Annie hat drei Fragen beantwortet, bevor du sie gestellt hast, vom nächstgelegenen Schreibtisch aus.", "ops.mood_broke":"{name} hat schon eine Einkaufsliste für das Budget des nächsten Monats.", "ops.mood_busy":"{name} hatte eine volle Woche und ist beim dritten Energydrink.", @@ -3264,7 +3265,7 @@ "ops.o_repair":"Reparaturen beschleunigen", "ops.o_repair_d":"Für jeden Ausfall mit Eil-Reparatur zahlen, solange das Budget reicht.", "ops.o_routers":"Router voraus halten", -"ops.o_routers_d":"Einen Router dazustellen oder auf die nächste Generation tauschen, wo ein zweiter Router den Traffic trägt, sobald Last oder Ports eine Grenze überschreiten.", +"ops.o_routers_desc":"Einen Router dazustellen oder auf die nächste Generation tauschen, wo ein zweiter Router den Traffic trägt, sobald Last oder Ports eine Grenze überschreiten. Wähl ein Modell, und jeder POP mit einem kleineren wird darauf getauscht, der am meisten ausgelastete zuerst, im Rahmen des Budgets.", "ops.o_transit":"Transit-Reserve halten", "ops.o_transit_d":"Transit an jedem POP über einem Vielfachen seiner 30-Tage-Spitze halten: ein LAG-Member dazu oder eine Portgröße hoch.", "ops.ops":"Ops", @@ -3273,6 +3274,7 @@ "ops.p_g":"Ab", "ops.p_how":"Wie", "ops.p_keep":"Einen in Reserve", +"ops.p_model":"Modell", "ops.p_paid":"Paid Peering", "ops.p_pick":"Optiken", "ops.p_prov":"Anbieter", diff --git a/site/i18n/es.js b/site/i18n/es.js index f6070ac..40ce8a0 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -3235,6 +3235,7 @@ "ops.l_snag":{"one":"se atascó con {where} y la pausó hasta que le eches un vistazo","other":"se atascó con {n} órdenes ({where}) y las pausó hasta que les eches un vistazo"}, "ops.l_transit":{"one":"amplió el tránsito en {where}","other":"amplió el tránsito {n} veces ({where})"}, "ops.locked":"El NOC contrata becarios a partir del nivel de clientes {lv}.", +"ops.model_next":"Siguiente generación, si va lleno", "ops.mood_annie":"Annie respondió tres preguntas antes de que las hicieras, desde la mesa más cercana.", "ops.mood_broke":"{name} ya tiene la lista de la compra para cuando llegue el presupuesto del mes que viene.", "ops.mood_busy":"{name} ha tenido una semana movida y va por la tercera bebida energética.", @@ -3262,7 +3263,7 @@ "ops.o_repair":"Acelerar reparaciones", "ops.o_repair_d":"Pagar la reparación urgente de cada caída que la tenga, mientras dure el presupuesto.", "ops.o_routers":"Routers por delante", -"ops.o_routers_d":"Añadir un router, o pasar a la siguiente generación donde un segundo router lleve el tráfico, cuando la carga o los puertos pasen de un nivel.", +"ops.o_routers_desc":"Añadir un router, o pasar a la siguiente generación donde un segundo router lleve el tráfico, cuando la carga o los puertos pasen de un nivel. Elige un modelo y cada POP con uno más pequeño se cambia a ese, primero el más cargado, dentro del presupuesto.", "ops.o_transit":"Margen de tránsito", "ops.o_transit_d":"Mantener el tránsito de cada POP por encima de un múltiplo de su pico de 30 días: un miembro LAG más o un tamaño de puerto mayor.", "ops.ops":"Ops", @@ -3271,6 +3272,7 @@ "ops.p_g":"Desde", "ops.p_how":"Cómo", "ops.p_keep":"Dejar uno de reserva", +"ops.p_model":"Modelo", "ops.p_paid":"Peering de pago", "ops.p_pick":"Ópticas", "ops.p_prov":"Proveedor", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index 1941da6..07a75e6 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -3235,6 +3235,7 @@ "ops.l_snag":{"one":"a calé sur {where} et l'a mis en pause en attendant que tu jettes un œil","other":"a calé sur {n} ordres ({where}) et les a mis en pause en attendant que tu jettes un œil"}, "ops.l_transit":{"one":"a renforcé le transit à {where}","other":"a renforcé le transit {n} fois ({where})"}, "ops.locked":"Le NOC recrute des stagiaires à partir du niveau clients {lv}.", +"ops.model_next":"Génération suivante, si chargé", "ops.mood_annie":"Annie a répondu à trois questions avant que tu les poses, depuis le bureau le plus proche.", "ops.mood_broke":"{name} a déjà sa liste de courses pour le budget du mois prochain.", "ops.mood_busy":"{name} a eu une semaine chargée et en est à sa troisième boisson énergisante.", @@ -3262,7 +3263,7 @@ "ops.o_repair":"Accélérer les réparations", "ops.o_repair_d":"Payer la réparation express de chaque panne qui en a une, tant que le budget suit.", "ops.o_routers":"Garder les routeurs en avance", -"ops.o_routers_d":"Ajouter un routeur, ou passer à la génération suivante là où un second routeur porte le trafic, quand la charge ou les ports dépassent un seuil.", +"ops.o_routers_desc":"Ajouter un routeur, ou passer à la génération suivante là où un second routeur porte le trafic, quand la charge ou les ports dépassent un seuil. Choisissez un modèle, et chaque POP équipé d’un plus petit passe à celui-ci, le plus chargé d’abord, dans la limite du budget.", "ops.o_transit":"Garder de la marge de transit", "ops.o_transit_d":"Garder le transit de chaque POP au-dessus d'un multiple de son pic sur 30 jours : un membre LAG de plus, ou une taille de port au-dessus.", "ops.ops":"Ops", @@ -3271,6 +3272,7 @@ "ops.p_g":"À partir de", "ops.p_how":"Comment", "ops.p_keep":"En garder un de secours", +"ops.p_model":"Modèle", "ops.p_paid":"Peering payant", "ops.p_pick":"Optiques", "ops.p_prov":"Fournisseur", diff --git a/site/i18n/it.js b/site/i18n/it.js index 20cf0c8..af05b1c 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -3235,6 +3235,7 @@ "ops.l_snag":{"one":"si è bloccato su {where} e l'ha messo in pausa finché non dai un'occhiata","other":"si è bloccato su {n} ordini ({where}) e li ha messi in pausa finché non dai un'occhiata"}, "ops.l_transit":{"one":"ha aumentato il transit a {where}","other":"ha aumentato il transit {n} volte ({where})"}, "ops.locked":"Il NOC assume stagisti dal livello clienti {lv}.", +"ops.model_next":"Generazione successiva, se carico", "ops.mood_annie":"Annie ha risposto a tre domande prima che tu le facessi, dalla scrivania più vicina.", "ops.mood_broke":"{name} ha già la lista della spesa per quando arriva il budget del mese prossimo.", "ops.mood_busy":"{name} ha avuto una settimana piena ed è alla terza bevanda energetica.", @@ -3262,7 +3263,7 @@ "ops.o_repair":"Accelera le riparazioni", "ops.o_repair_d":"Paga la riparazione urgente di ogni guasto che ce l'ha, finché il budget regge.", "ops.o_routers":"Router sempre avanti", -"ops.o_routers_d":"Aggiungi un router, o passa alla generazione successiva dove un secondo router regge il traffico, quando carico o porte superano una soglia.", +"ops.o_routers_desc":"Aggiungi un router, o passa alla generazione successiva dove un secondo router regge il traffico, quando carico o porte superano una soglia. Scegli un modello e ogni POP con uno più piccolo passa a quello, prima il più carico, nei limiti del budget.", "ops.o_transit":"Margine di transit", "ops.o_transit_d":"Tieni il transit di ogni POP sopra un multiplo del suo picco a 30 giorni: un membro LAG in più, o una porta più grande.", "ops.ops":"Ops", @@ -3271,6 +3272,7 @@ "ops.p_g":"Da", "ops.p_how":"Come", "ops.p_keep":"Tienine uno di scorta", +"ops.p_model":"Modello", "ops.p_paid":"Peering a pagamento", "ops.p_pick":"Ottiche", "ops.p_prov":"Fornitore", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 9c5555e..084cdaf 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -3235,6 +3235,7 @@ "ops.l_snag":{"one":"travou em {where} e pausou a ordem até você dar uma olhada","other":"travou em {n} ordens ({where}) e pausou-as até você dar uma olhada"}, "ops.l_transit":{"one":"reforçou o trânsito em {where}","other":"reforçou o trânsito {n} vezes ({where})"}, "ops.locked":"O NOC contrata estagiários a partir do nível de clientes {lv}.", +"ops.model_next":"Próxima geração, quando lotado", "ops.mood_annie":"Annie respondeu três perguntas antes de você fazê-las, da mesa mais próxima.", "ops.mood_broke":"{name} já tem a lista de compras para quando chegar o orçamento do mês que vem.", "ops.mood_busy":"{name} teve uma semana cheia e está na terceira bebida energética.", @@ -3262,7 +3263,7 @@ "ops.o_repair":"Acelerar reparos", "ops.o_repair_d":"Pagar o reparo urgente de cada queda que tenha um, enquanto o orçamento durar.", "ops.o_routers":"Roteadores à frente", -"ops.o_routers_d":"Adicionar um roteador, ou trocar para a próxima geração onde um segundo roteador segura o tráfego, quando a carga ou as portas passarem de um nível.", +"ops.o_routers_desc":"Adicionar um roteador, ou trocar para a próxima geração onde um segundo roteador segura o tráfego, quando a carga ou as portas passarem de um nível. Escolha um modelo e cada POP com um menor é trocado para ele, o mais carregado primeiro, dentro do orçamento.", "ops.o_transit":"Folga de trânsito", "ops.o_transit_d":"Manter o trânsito de cada POP acima de um múltiplo do seu pico de 30 dias: mais um membro LAG, ou um tamanho de porta acima.", "ops.ops":"Ops", @@ -3271,6 +3272,7 @@ "ops.p_g":"A partir de", "ops.p_how":"Como", "ops.p_keep":"Manter um de reserva", +"ops.p_model":"Modelo", "ops.p_paid":"Peering pago", "ops.p_pick":"Ópticas", "ops.p_prov":"Provedor", diff --git a/src/agent/20-commands.js b/src/agent/20-commands.js index 508872a..b575dcf 100644 --- a/src/agent/20-commands.js +++ b/src/agent/20-commands.js @@ -324,12 +324,12 @@ const API_CMD={ doc:'Let the intern go. The standing orders stop; the rest of the month\'s salary is lost.'}, opsToggle:{args:[['k','opsKey']],watch:['ops'], doc:'Pause or resume one standing order. Keys come from catalog(\'OPSK\'); the sheet in the game shows what each one does.'}, - opsParam:{args:[['k','opsKey'],['p','string']],watch:['ops'], - doc:'Step one of a standing order\'s settings to its next value (the provider to prefer, the port size to order, the load ceiling…). The sheet steps the same way.'}, - opsCap:{args:[['k','opsKey']],watch:['ops'], - doc:'Step the monthly budget of an order that has one: 10k, 25k, 50k, 100k, 250k, no limit.'}, - opsFloor:{args:[],watch:['ops'], - doc:'Step the floor under your cash that the intern keeps clear when paying for jobs: 0, 50k, 250k, 1M, 5M.'}, + opsParam:{args:[['k','opsKey'],['p','string'],['v','string',false]],watch:['ops'], + doc:'Step one of a standing order\'s settings to its next value (the provider to prefer, the port size to order, the load ceiling…). With v (a position in the list the sheet shows, 0 first) it picks that value instead, such as the model to standardize routers on.'}, + opsCap:{args:[['k','opsKey'],['v','string',false]],watch:['ops'], + doc:'Step the monthly budget of an order that has one: 10k, 25k, 50k, 100k, 250k, no limit. With v (a position in that list, 0 first) it picks that one.'}, + opsFloor:{args:[['v','string',false]],watch:['ops'], + doc:'Step the floor under your cash that the intern keeps clear when paying for jobs: 0, 50k, 250k, 1M, 5M. With v (a position in that list, 0 first) it picks that one.'}, opsPop:{args:[['k','opsPopKind'],['city','cityId']],watch:['ops'], doc:'Add or remove one POP as an exception to an order: the intern never touches the POPs you except.'}, opsTpl:{args:[['k','opsTplKey']],watch:['ops'], diff --git a/src/game/60-features/95-standing-orders.js b/src/game/60-features/95-standing-orders.js index f852910..8f9f78e 100644 --- a/src/game/60-features/95-standing-orders.js +++ b/src/game/60-features/95-standing-orders.js @@ -14,7 +14,9 @@ const INTERNS={ const OPS=[ {k:'transit',i:'📈',pop:1,cap:50000,t:N_('ops.o_transit'),d:N_('ops.o_transit_d'),p:{x:{d:1.5,v:[1.25,1.5,2,3],l:N_('ops.p_x'),f:v=>v+'×'},prov:{d:'cheap',ok:v=>v==='cheap'||v==='have'||(isNet(v)&&!!NET[v].price),l:N_('ops.p_prov')}}}, {k:'ports',i:'🔌',pop:1,cap:50000,t:N_('ops.o_ports'),d:N_('ops.o_ports_d'),p:{x:{d:1.5,v:[1.25,1.5,2,3],l:N_('ops.p_x'),f:v=>v+'×'}}}, - {k:'routers',i:'🧠',pop:1,cap:250000,t:N_('ops.o_routers'),d:N_('ops.o_routers_d'),p:{at:{d:80,v:[60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},how:{d:'auto',v:['auto','add','swap'],l:N_('ops.p_how'),f:v=>tr({auto:N_('ops.how_auto'),add:N_('ops.how_add'),swap:N_('ops.how_swap')}[v])}}}, + {k:'routers',i:'🧠',pop:1,cap:250000,t:N_('ops.o_routers'),d:N_('ops.o_routers_desc'),p:{at:{d:80,v:[60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},how:{d:'auto',v:['auto','add','swap'],l:N_('ops.p_how'),f:v=>tr({auto:N_('ops.how_auto'),add:N_('ops.how_add'),swap:N_('ops.how_swap')}[v])}, + // A model to standardize on: every POP on a smaller one is swapped to it, busiest first, within the budget. + model:{d:'next',ok:v=>v==='next'||(Number.isInteger(v)&&!!RG[v]),l:N_('ops.p_model'),f:v=>v==='next'?tr('ops.model_next'):RG[v].n}}}, {k:'caches',i:'📦',pop:1,cap:5000,mo:1,t:N_('ops.o_caches'),d:N_('ops.o_caches_d'),p:{g:{d:5,v:[1,5,10,25,50],l:N_('ops.p_g'),f:v=>fmtG(v)}}}, {k:'ix',i:'🔀',t:N_('ops.o_ix'),d:N_('ops.o_ix_d'),p:{}}, {k:'pni',i:'🤝',pop:1,cap:50000,t:N_('ops.o_pni'),d:N_('ops.o_pni_d'),p:{g:{d:25,v:[5,10,25,50,100],l:N_('ops.p_g'),f:v=>fmtG(v)},tier:{d:0,v:[0,1,2],l:N_('ops.p_tier'),f:v=>tr('ops.at_least_port',{port:PORT[v].n})},paid:{d:false,v:[false,true],l:N_('ops.p_paid'),f:v=>v?tr('common.on'):tr('common.off')}}}, @@ -35,6 +37,11 @@ const opsHired=()=>!!(S&&S.ops&&S.ops.intern&&own(INTERNS,S.ops.intern)); const opsCanHire=()=>lvl()>=2; const opsName=(long)=>{const I=INTERNS[S.ops.intern];return I?tr(long?I.n:I.s):'';}; function opsP(k,p){const P=OPSK[k].p[p],v=S.ops.p[k]&&S.ops.p[k][p];return v!==undefined&&(P.ok?P.ok(v):P.v.includes(v))?v:P.d;} +// Every value a setting can take, in the order its list shows them: providers that sell where you have POPs, and router +// models you can buy, smallest first. The current value is always on the list, so the list can show it. +function opsOpts(k,p){const cur=opsP(k,p),L=p==='prov'?['cheap','have',...NETS.filter(n=>n.price&&Object.keys(S.pops).some(c=>sellsAt(n,c))).map(n=>n.id)] + :p==='model'?['next',...RG.map((r,i)=>i).filter(i=>rgOpen(i)).sort((a,b)=>RG[a].cls-RG[b].cls||RG[a].cap-RG[b].cap||a-b)]:OPSK[k].p[p].v.slice(); + if(!L.includes(cur))L.push(cur);return L;} const opsCaps=k=>OPSK[k].mo?OPS_CAPS_MO:OPS_CAPS; function opsCap(k){const c=S.ops.cap[k];return opsCaps(k).includes(c)?c:OPSK[k].cap||0;} const opsHere=(k,c)=>!(S.ops.skip[c]||[]).includes(k); @@ -127,12 +134,20 @@ const opsProv=c=>{const pv=opsP('transit','prov'),n=isNet(pv)?NET[pv]:null;retur // The orders. Each takes the shift and does its jobs through the player's own actions. const OPS_RUN={ repair(X){purgeInc();for(const i of S.inc.slice())if(i.type!=='ddos'&&i.until>S.day&&i.cost>0&&!(i.slow&&i.rushed)&&X.can('repair',i.cost)&&X.pay('repair',()=>ACT.fixInc({id:i.id})))X.did('repair');}, - routers(X){const at=opsP('routers','at')/100,how=opsP('routers','how'); + routers(X){const at=opsP('routers','at')/100,how=opsP('routers','how'),m=opsP('routers','model'),fix=m!=='next', + load=c=>Math.max((R.nodeLoad[c]||0)/(R.nodeCap[c]||nodeCap(c)||1),portsUsed(c)/Math.max(1,portsMax(c))); + // A chosen model: swap every POP still on a smaller one to it, the busiest first, while the budget lasts. Never a + // step down, never a model that is not unlocked or does not fit, and only with a second router or no traffic there. + if(fix&&rgOpen(m))for(const c of opsPops('routers').sort((a,b)=>load(b)-load(a))){const p=S.pops[c],g=p.rgen||0; + if(p.rupDay===S.day||g===m||RG[m].cap<=RG[g].cap||modelFits(c,m)||!((p.routers||1)>1||popIdle(c)))continue; + const cost=swapCost(c,m);if(!X.can('routers',cost))continue; + if(X.pay('routers',()=>ACT.upRouter({city:c,g:m})))X.did('routers',c+' ⇧'+RG[m].pn);} for(const c of opsPops('routers')){const p=S.pops[c];if(p.rupDay===S.day)continue; - const ld=Math.max((R.nodeLoad[c]||0)/(R.nodeCap[c]||nodeCap(c)||1),portsUsed(c)/Math.max(1,portsMax(c)));if(ld=0&&rgOpen(nx)&&!modelFits(c,nx)&&(rt>1||popIdle(c)),add=rt=0&&rgOpen(nx)&&!modelFits(c,nx)&&(rt>1||popIdle(c)),add=rt=4||!add);if(!doSwap&&(how==='swap'||!add))continue; const cost=doSwap?swapCost(c,nx):routerCost(g,rt);if(!X.can('routers',cost))continue; if(X.pay('routers',()=>doSwap?ACT.upRouter({city:c,g:nx}):ACT.addRouter({city:c})))X.did('routers',c+(doSwap?' ⇧'+RG[nx].pn:' +1'));}}, diff --git a/src/game/90-actions/88-ops.js b/src/game/90-actions/88-ops.js index 1f1c77d..719dd85 100644 --- a/src/game/90-actions/88-ops.js +++ b/src/game/90-actions/88-ops.js @@ -1,5 +1,9 @@ // Standing orders: hiring the intern, the switches and dials, and a new POP from the template. const opsCycle=(a,v)=>a[(a.indexOf(v)+1)%a.length]; +// A pick from a list (v: its position, as the sheet's dropdown sends it), or without v the next value (the MCP tools step). +const opsPick=(a,cur,v)=>{if(v===undefined)return opsCycle(a,cur);const i=Number(v);return Number.isInteger(i)&&i>=0&&i{opsModal();const j=JSON.stringify(args);for(const el of $('modalCard').querySelectorAll(`[data-chg="${act}"]`))if(el.dataset.args===j){el.focus();break;}}; Object.assign(ACT,{ opsOpen:()=>{if(S)opsModal();}, opsHire:({id})=>{if(!S||opsHired()||!own(INTERNS,id)||!opsCanHire()||!rule('clock'))return;if(!spend(INTERN_MO))return;const O=opsO(),m=monthIdx(S.day);O.intern=id;O.hired=S.day;O.wk=null; @@ -9,11 +13,10 @@ Object.assign(ACT,{ opsFire:()=>{if(!opsHired())return;if(UI.confirm!=='opsFire'){UI.confirm='opsFire';opsModal();return;}UI.confirm=null;const nm=opsName();S.ops.intern=null; toast(esc(tr('ops.fired',{name:nm})),'');after();opsModal();}, opsToggle:({k})=>{if(!opsHired()||!own(OPSK,k))return;S.ops.on[k]=!S.ops.on[k];sfx('click');after();opsModal();}, - opsParam:({k,p})=>{if(!opsHired()||!own(OPSK,k)||!own(OPSK[k].p,p))return;const P=OPSK[k].p[p];let v; - if(p==='prov'){const ids=['cheap','have',...NETS.filter(n=>n.price&&Object.keys(S.pops).some(c=>sellsAt(n,c))).map(n=>n.id)];v=opsCycle(ids,opsP(k,p));}else v=opsCycle(P.v,opsP(k,p)); - (S.ops.p[k]||(S.ops.p[k]={}))[p]=v;sfx('click');after();opsModal();}, - opsCap:({k})=>{if(!opsHired()||!own(OPSK,k)||!OPSK[k].cap)return;S.ops.cap[k]=opsCycle(opsCaps(k),opsCap(k));sfx('click');after();opsModal();}, - opsFloor:()=>{if(!opsHired())return;S.ops.floor=opsCycle(OPS_FLOORS,S.ops.floor);sfx('click');after();opsModal();}, + opsParam:({k,p,v})=>{if(!opsHired()||!own(OPSK,k)||!own(OPSK[k].p,p))return;const P=OPSK[k].p[p],x=opsPick(opsOpts(k,p),opsP(k,p),v);if(x===undefined||!(P.ok?P.ok(x):P.v.includes(x)))return; + (S.ops.p[k]||(S.ops.p[k]={}))[p]=x;sfx('click');after();opsRedraw('opsParam',{k,p});}, + opsCap:({k,v})=>{if(!opsHired()||!own(OPSK,k)||!OPSK[k].cap)return;const x=opsPick(opsCaps(k),opsCap(k),v);if(x===undefined)return;S.ops.cap[k]=x;sfx('click');after();opsRedraw('opsCap',{k});}, + opsFloor:({v})=>{if(!opsHired())return;const x=opsPick(OPS_FLOORS,S.ops.floor,v);if(x===undefined)return;S.ops.floor=x;sfx('click');after();opsRedraw('opsFloor',{});}, opsCity:({v})=>{if(!S||!S.pops[v])return;UI.opsCity=v;opsModal();}, opsPop:({k,city})=>{if(!opsHired()||!OPS_POP.includes(k)||!S.pops[city])return;const sk=S.ops.skip,a=sk[city]||[];sk[city]=a.includes(k)?a.filter(x=>x!==k):[...a,k];if(!sk[city].length)delete sk[city]; UI.opsCity=city;sfx('click');after();opsModal();}, diff --git a/src/game/93-ui/57-ops-panel.js b/src/game/93-ui/57-ops-panel.js index 89f4a3f..3570d58 100644 --- a/src/game/93-ui/57-ops-panel.js +++ b/src/game/93-ui/57-ops-panel.js @@ -5,12 +5,15 @@ function opsCard(){if(!S)return '';const last=opsHired()&&S.ops.log[0];
${opsHired()?esc(last?opsEntry(last):tr('ops.l_quiet',{name:opsName()})):opsCanHire()?tr('ops.hire_pitch_short'):tr('ops.locked',{lv:2})}
${btn(opsHired()?tr('ops.standing_orders'):tr('ops.hire_an_intern'),'opsOpen',{},opsHired()?'sm':'pink sm',!opsHired()&&!opsCanHire())}
`;} const opsEntry=e=>(e.f!==undefined?opsFFLine(e)+' ':'')+(e.r.length||e.f===undefined?opsLine(e):''); -function opsVal(k,p){const P=OPSK[k].p[p],v=opsP(k,p);return p==='prov'?(v==='cheap'?tr('ops.cheapest'):v==='have'?tr('ops.already_connected'):NET[v].name):P.f(v);} +function opsVal(k,p,v=opsP(k,p)){const P=OPSK[k].p[p];return p==='prov'?(v==='cheap'?tr('ops.cheapest'):v==='have'?tr('ops.already_connected'):NET[v].name):P.f(v);} +// A setting as a list to pick from: the option values are positions in the list the action reads again. +const opsSel=(lab,act,args,vals,cur,name)=>``; +const opsCapName=(k,v)=>v?tr('common.price_mo',{price:(OPSK[k].mo?'+':'')+fmt$(v)}):tr('ops.no_cap'); function opsOrderHtml(d){const k=d.k,on=S.ops.on[k],cap=d.cap?opsCap(k):0,sp=S.ops.spent[k]||0,am=Math.round(S.ops.addMo[k]||0); return `
${tr(d.t)}
${tr(d.d)}${k==='caches'?' '+tr('ops.caches_rent',{price:fmt$(CACHE_MO),big:fmt$(CACHE_BIG_MO)}):''}
- ${on?`
${Object.keys(d.p).map(p=>btn(`${tr(d.p[p].l)}: ${esc(opsVal(k,p))}`,'opsParam',{k,p},'ghost sm')).join('')} - ${d.cap?btn(`${d.mo?tr('ops.budget_running'):tr('ops.budget')}: ${cap?tr('common.price_mo',{price:(d.mo?'+':'')+fmt$(cap)}):tr('ops.no_cap')}`,'opsCap',{k},'ghost sm'):''}
+ ${on?`
${Object.keys(d.p).map(p=>opsSel(tr(d.p[p].l),'opsParam',{k,p},opsOpts(k,p),opsP(k,p),v=>opsVal(k,p,v))).join('')} + ${d.cap?opsSel(d.mo?tr('ops.budget_running'):tr('ops.budget'),'opsCap',{k},opsCaps(k),cap,v=>opsCapName(k,v)):''}
${sp||am?`
${tr('ops.spent_and_mo',{price:fmt$(sp),mo:opsMo$(am)})}
`:''} ${k==='ix'&&ppol()!=='open'?`

${tr('link_panels.off_while_your_peering_policy_is',{pol:tr(PPOL_N[ppol()])})}

`:''}`:''}
`;} function opsModal(){if(!S)return;const hired=opsHired();let h=`
${tr('ops.ops')}

${tr('ops.standing_orders')}

`; @@ -24,7 +27,7 @@ function opsModal(){if(!S)return;const hired=opsHired();let h=`
${esc(opsMood())}

${opsReportHtml()} ${O.log.length?`
${O.log.slice(0,6).map(e=>esc(tr('ops.day_d',{d:e.d})+': '+opsEntry(e))).join('\n')}
`:''} -
${btn(`${tr('ops.floor')}: ${O.floor?fmt$(O.floor):tr('ops.no_cap')}`,'opsFloor',{},'ghost sm')}
`; +
${opsSel(tr('ops.floor'),'opsFloor',{},OPS_FLOORS,O.floor,v=>v?fmt$(v):tr('ops.no_cap'))}
`; h+=`

${tr('ops.how_it_works',{name:opsName()})}

`+OPS.map(opsOrderHtml).join(''); // Per POP: switch single orders off where the player wants to decide by hand. const cities=Object.keys(S.pops).sort((a,b)=>CITY[a].name.localeCompare(CITY[b].name)),c=S.pops[UI.opsCity]?UI.opsCity:cities[0]; diff --git a/src/game/96-map/95-clicks.js b/src/game/96-map/95-clicks.js index dd6bd7c..c10b794 100644 --- a/src/game/96-map/95-clicks.js +++ b/src/game/96-map/95-clicks.js @@ -3,7 +3,7 @@ let pressing=false; document.addEventListener('pointerdown',e=>{if(e.target.closest('#panel,#left,#dash,#bankBox,#modal,#tabbar,#toasts,#pzBox'))pressing=true;}); addEventListener('pointerup',()=>setTimeout(()=>pressing=false,0)); addEventListener('pointercancel',()=>{pressing=false;});addEventListener('blur',()=>{pressing=false;}); -document.addEventListener('change',e=>{const el=e.target.closest('[data-chg]');if(!el||(!S&&!['langSet','pickHome'].includes(el.dataset.chg)))return;const fn=ACT[el.dataset.chg];if(fn)fn({v:el.value});}); +document.addEventListener('change',e=>{const el=e.target.closest('[data-chg]');if(!el||(!S&&!['langSet','pickHome'].includes(el.dataset.chg)))return;const fn=ACT[el.dataset.chg];if(!fn)return;let a={};try{a=el.dataset.args?JSON.parse(el.dataset.args):{};}catch(err){}fn({...(a&&typeof a==='object'?a:{}),v:el.value});}); /* Taps that land on the wrong thing (#44): a real tap only fires the button it went down on, never something that appeared or moved under the finger, nothing behind a menu that opened or closed mid-tap, and no toast button in the first half second after the toast popped up. Synthetic clicks (keyboard, tests) are not affected. */ diff --git a/src/i18n/en.js b/src/i18n/en.js index 3e441b0..6f9778d 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -3236,6 +3236,7 @@ "ops.l_snag":{"one":"got stuck on {where} and paused it until you have a look","other":"got stuck on {n} orders ({where}) and paused them until you have a look"}, "ops.l_transit":{"one":"topped up transit in {where}","other":"topped up transit {n} times ({where})"}, "ops.locked":"The NOC hires interns from customer level {lv}.", +"ops.model_next":"Next generation, when busy", "ops.mood_annie":"Annie answered three questions before you asked them, from whichever desk was closest.", "ops.mood_broke":"{name} has a shopping list ready for when next month's budget comes in.", "ops.mood_busy":"{name} has had a busy week and is on their third energy drink.", @@ -3263,7 +3264,7 @@ "ops.o_repair":"Rush repairs", "ops.o_repair_d":"Pay for the rush repair on every outage that has one, while the budget lasts.", "ops.o_routers":"Keep routers ahead", -"ops.o_routers_d":"Add a router, or swap to the next generation where a second router carries the traffic, when load or ports pass a level.", +"ops.o_routers_desc":"Add a router, or swap to the next generation where a second router carries the traffic, when load or ports pass a level. Pick a model, and every POP on a smaller one is swapped to it, the busiest first, within the budget.", "ops.o_transit":"Keep transit headroom", "ops.o_transit_d":"Keep transit at each POP above a multiple of its 30-day peak: add a LAG member, or move up a port size.", "ops.ops":"Ops", @@ -3272,6 +3273,7 @@ "ops.p_g":"From", "ops.p_how":"How", "ops.p_keep":"Keep one spare", +"ops.p_model":"Model", "ops.p_paid":"Paid peering", "ops.p_pick":"Optics", "ops.p_prov":"Provider", diff --git a/src/styles/36-ops.css b/src/styles/36-ops.css index fcd9486..e00dd87 100644 --- a/src/styles/36-ops.css +++ b/src/styles/36-ops.css @@ -10,6 +10,9 @@ .ops-i{font-size:22px;line-height:1;flex:none} .ops-p{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px} .ops-p .b{white-space:normal;text-align:left;min-height:36px} +/* A setting is a list to pick from: two to a row on a phone, the list as wide as its column. */ +.ops-sel{display:flex;flex-direction:column;gap:2px;flex:1 1 140px;min-width:0;font:800 12px Nunito,sans-serif;color:var(--ink2)} +.ops-sel select{width:100%;min-height:36px;font:700 14px Nunito,sans-serif;color:var(--ink);background:var(--paper);padding:4px 6px;border:2px solid var(--ink);border-radius:8px} .ops-log{white-space:pre-wrap;font-size:11.5px;max-height:160px;overflow:auto} .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} diff --git a/tests/intern-optics.test.js b/tests/intern-optics.test.js index bc45159..1de4a00 100644 --- a/tests/intern-optics.test.js +++ b/tests/intern-optics.test.js @@ -51,10 +51,12 @@ test('#262 the setting is saved, an unknown value falls back, and it shows on th dom.window.innerWidth = 360; ev("ACT.phoneTab({t:'noc'})"); dom.window.document.querySelector('#leftBody [data-act="opsOpen"]').click(); - const btn = [...dom.window.document.querySelectorAll('#modalCard [data-act="opsParam"]')].find((b) => b.dataset.args.includes('pick')); - assert.ok(btn, 'the Optics button is in the sheet'); - assert.match(btn.textContent, /Optics: biggest on new fiber/); - btn.click(); + const sel = [...dom.window.document.querySelectorAll('#modalCard select[data-chg="opsParam"]')].find((s) => s.dataset.args.includes('pick')); + assert.ok(sel, 'the Optics list is in the sheet'); + assert.match(sel.closest('label').textContent, /Optics/); + assert.equal(sel.options[sel.selectedIndex].textContent, 'biggest on new fiber'); + sel.value = [...sel.options].find((o) => o.textContent !== 'biggest on new fiber').value; + sel.dispatchEvent(new dom.window.Event('change', { bubbles: true })); assert.equal(ev("opsP('optics','pick')"), 'cheap'); assert.deepEqual(errors, []); }); diff --git a/tests/intern-router-model.test.js b/tests/intern-router-model.test.js new file mode 100644 index 0000000..a28ef92 --- /dev/null +++ b/tests/intern-router-model.test.js @@ -0,0 +1,112 @@ +// The intern standardizes routers on a chosen model within the budget, and every setting in the Ops sheet is a list. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); + +// Frankfurt (one router, broadband), Amsterdam (two routers, broadband) and Paris (one router, nothing on it yet), +// all on the Edge Lord 400. Change Freeze: no fat fingers. +const BASE = "ACT.start({});S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;S.lvl=3;S.nextFail=S.nextEvent=1e9;UI.speed=0;S.rules=makeRules('freeze');" + + "ACT.launchBB({city:'fra'});S.pops.fra.rgen=1;ACT.buyTransit({city:'fra',net:'cog',tier:1});" + + "for(const c of ['ams','par'])ACT.buildPop({city:c});ACT.launchBB({city:'ams'});S.pops.ams.rgen=1;S.pops.ams.routers=2;S.pops.par.rgen=1;compute();" + + "ACT.opsHire({id:'kevin'});S.ops.floor=0;closeModal()"; +const MODEL = "RG.findIndex(r=>r.n==='Arrrhipster 7800R')"; +function game(t) { + const h = load(); + t.after(() => h.dom.window.close()); + h.ev(BASE); + return h; +} +const gens = ev => JSON.parse(ev("JSON.stringify(['fra','ams','par'].map(c=>S.pops[c].rgen))")); + +test('a chosen model: every POP on a smaller one is swapped to it, at the price of the swap, never as an outage', t => { + const { ev, errors } = game(t); + const m = ev(MODEL); + assert.ok(m > 0 && ev(`rgOpen(${m})`), 'the model is unlocked at level 3'); + ev(`S.ops.on.routers=true;S.ops.p.routers={at:90,how:'auto',model:${m}};S.ops.cap.routers=0;compute();for(const c in R.nodeLoad)R.nodeLoad[c]=0`); + const want = ev(`swapCost('ams',${m})+swapCost('par',${m})`), c0 = ev('S.cash'); + ev('opsDay(S.day)'); + assert.deepEqual(gens(ev), [1, m, m], 'Amsterdam (a second router) and Paris (no traffic yet) are swapped; Frankfurt has one busy router, so no'); + assert.equal(c0 - ev('S.cash'), want, 'the shift paid exactly what the two swaps cost'); + assert.equal(ev("S.inc.some(i=>i.type==='maint')"), false, 'no outage'); + assert.match(ev('opsLine(S.ops.log[0])'), /Amsterdam ⇧800G/); + // Frankfurt gets its turn once it has a second router. + ev('S.pops.fra.routers=2;S.day++;compute();opsDay(S.day)'); + assert.deepEqual(gens(ev), [m, m, m]); + // Busy POPs on the chosen model get more routers, never a swap to another one. + ev("S.ops.p.routers.how='swap';S.day++;compute();R.nodeLoad.ams=R.nodeCap.ams*0.95;opsDay(S.day)"); + assert.equal(ev('S.pops.ams.rgen'), m, 'no swap away from the chosen model'); + ev("S.ops.p.routers.how='add';S.day++;compute();R.nodeLoad.ams=R.nodeCap.ams*0.95;opsDay(S.day)"); + assert.equal(ev('S.pops.ams.routers'), 3, 'a busy POP gets a third router'); + assert.deepEqual(errors, []); +}); + +test('the budget decides how far it gets, the busiest POP first; a smaller model is never a downgrade', t => { + const { ev, errors } = game(t); + const m = ev(MODEL); + ev(`S.ops.on.routers=true;S.ops.p.routers={at:90,how:'auto',model:${m}};compute();for(const c in R.nodeLoad)R.nodeLoad[c]=0;R.nodeLoad.par=R.nodeCap.par*0.5`); + // A budget for one swap: Paris is the busier, so it goes first and Amsterdam waits for next month. + const one = ev(`swapCost('par',${m})`); + ev(`S.ops.cap.routers=OPS_CAPS.filter(c=>c>=${one}).sort((a,b)=>a-b)[0]`); + assert.ok(ev('S.ops.cap.routers') < one + ev(`swapCost('ams',${m})`), 'the budget is too small for both'); + ev('opsDay(S.day)'); + assert.deepEqual(gens(ev), [1, 1, m], 'Paris first'); + assert.ok(ev("S.ops.log[0].r.some(x=>x[0]==='broke')"), 'the log says the budget ran out'); + // Next month, a new budget: Amsterdam. + ev('{const m0=monthIdx(S.day);while(monthIdx(S.day)===m0)S.day++;}compute();for(const c in R.nodeLoad)R.nodeLoad[c]=0;opsDay(S.day)'); + assert.deepEqual(gens(ev), [1, m, m]); + // Choosing a smaller model swaps nothing back. + ev("S.ops.cap.routers=0;S.ops.p.routers.model=RG.findIndex(r=>r.n==='Edge Lord 400');S.day++;compute();opsDay(S.day)"); + assert.deepEqual(gens(ev), [1, m, m]); + assert.deepEqual(errors, []); +}); + +test('the setting is saved; an unknown model falls back to the next generation', t => { + const { ev, errors } = game(t); + const back = v => ev(`(()=>{const s=JSON.parse(JSON.stringify(S));s.ops.p.routers=${v};sanitize(s);return JSON.stringify(s.ops.p.routers);})()`); + assert.deepEqual(JSON.parse(back(`{model:${ev(MODEL)}}`)), { model: ev(MODEL) }); + assert.deepEqual(JSON.parse(back('{model:999}')), {}); + assert.deepEqual(JSON.parse(back("{model:'7'}")), {}); + assert.deepEqual(JSON.parse(back('undefined')), {}, 'an old save without it'); + assert.equal(ev("opsP('routers','model')"), 'next'); + assert.deepEqual(errors, []); +}); + +test('every setting in the Ops sheet is a list to pick from, on a phone too', t => { + const { ev, dom, errors } = game(t); + dom.window.innerWidth = 360; + const doc = dom.window.document; + ev("for(const k in S.ops.on)S.ops.on[k]=true;ACT.phoneTab({t:'noc'})"); + doc.querySelector('#leftBody [data-act="opsOpen"]').click(); + assert.equal(doc.querySelectorAll('#modalCard [data-act="opsParam"],#modalCard [data-act="opsCap"],#modalCard [data-act="opsFloor"]').length, 0, 'no buttons that step through values'); + const sel = (act, args) => [...doc.querySelectorAll(`#modalCard select[data-chg="${act}"]`)].find(s => s.dataset.args === JSON.stringify(args)); + const pick = (s, text) => { + const o = [...s.options].find(o => o.textContent === text); + assert.ok(o, `${text} is on the list`); + s.value = o.value; + s.dispatchEvent(new dom.window.Event('change', { bubbles: true })); + }; + // Every setting of every order, every budget and the floor. + const n = ev('OPS.reduce((a,d)=>a+Object.keys(d.p).length+(d.cap?1:0),0)+1'); + assert.equal(doc.querySelectorAll('#modalCard .ops-p select').length, n); + // The model list: the next generation, then the models you can buy, smallest first. + const model = sel('opsParam', { k: 'routers', p: 'model' }); + assert.ok(model, 'the routers order has a model list'); + assert.equal(model.options[0].textContent, 'Next generation, when busy'); + assert.ok([...model.options].some(o => o.textContent === 'Arrrhipster 7800R')); + assert.ok(![...model.options].some(o => o.textContent === 'Absolute Unit 3.2T'), 'only models unlocked at your level'); + pick(model, 'Arrrhipster 7800R'); + assert.equal(ev("opsP('routers','model')"), ev(MODEL)); + assert.equal(doc.activeElement && doc.activeElement.dataset.args, JSON.stringify({ k: 'routers', p: 'model' }), 'the keyboard stays on the list'); + pick(sel('opsParam', { k: 'transit', p: 'prov' }), 'Already connected'); + assert.equal(ev("opsP('transit','prov')"), 'have'); + pick(sel('opsCap', { k: 'routers' }), 'no limit'); + assert.equal(ev("opsCap('routers')"), 0); + pick(sel('opsFloor', {}), ev('fmt$(1e6)')); + assert.equal(ev('S.ops.floor'), 1e6); + // A value from nowhere changes nothing; the MCP tools still step without a value. + ev("ACT.opsParam({k:'routers',p:'model',v:'99'});ACT.opsCap({k:'routers',v:'-1'});ACT.opsFloor({v:'x'})"); + assert.deepEqual([ev("opsP('routers','model')"), ev("opsCap('routers')"), ev('S.ops.floor')], [ev(MODEL), 0, 1e6]); + ev("ACT.opsParam({k:'routers',p:'how'})"); + assert.equal(ev("opsP('routers','how')"), 'add'); + assert.deepEqual(errors, []); +}); diff --git a/tests/standing-orders.test.js b/tests/standing-orders.test.js index d5ed72a..c871ca6 100644 --- a/tests/standing-orders.test.js +++ b/tests/standing-orders.test.js @@ -356,7 +356,9 @@ test('the Ops sheet works at 360 px in every language, from the NOC tab and the assert.ok(ev('opsHired()'), lang); doc.querySelector('#modalCard [data-act="opsToggle"]').click(); assert.equal(doc.querySelector('#modalCard [data-act="opsToggle"]').getAttribute('aria-pressed'), 'true', lang); - doc.querySelector('#modalCard [data-act="opsParam"]').click(); + const sel = doc.querySelector('#modalCard select[data-chg="opsParam"]'); + sel.value = String((sel.selectedIndex + 1) % sel.options.length); + sel.dispatchEvent(new dom.window.Event('change', { bubbles: true })); const txt = doc.getElementById('modalCard').textContent; assert.doesNotMatch(txt, /\bops\.[a-z_]+/, lang); assert.ok(doc.querySelector('#modalCard select[data-chg="opsCity"]'), lang); @@ -495,7 +497,7 @@ test('the fat-fingered LAG member respects a paused transit order and per-POP ex }); test('caches: the cash floor and a running-cost budget hold; the panel and the log show what a month costs', t => { - const { ev, errors } = game(t); + const { ev, dom, errors } = game(t); hire(ev); on(ev, 'caches', { g: 1 }); ev('S.pops.fra.rgen=0;compute()'); // 100G ports: 100G boxes at $400/mo const add = () => ev("utilityCaches('fra').add.filter(x=>(R.cityDem.fra||0)*NSH[x.net]>=1).length"); @@ -515,7 +517,8 @@ test('caches: the cash floor and a running-cost budget hold; the panel and the l ev('opsModal()'); const txt = ev("document.getElementById('modalCard').textContent"); assert.match(txt, /each box costs \$400\/mo/); - assert.match(txt, /Adds at most: \+\$1\.0k\/mo/); + const capSel = [...dom.window.document.querySelectorAll('#modalCard select[data-chg="opsCap"]')].find(x => x.dataset.args === '{"k":"caches"}'); + assert.equal(capSel.closest('label').firstChild.textContent + ': ' + capSel.options[capSel.selectedIndex].textContent, 'Adds at most: +$1.0k/mo'); assert.match(txt, /This month: \$0 up front, \+\$800\/mo on the bill/); ev('S.day+=monLen(S.day);S.ops.cap.caches=0'); shift(ev); assert.equal(ev('S.ops.addMo.caches'), (ev('S.caches.length') - 2) * 400, 'a new month counts from zero');