A POP in a retired city says why it can't open
buildPop returned without a word for a city that is off the map (the small
Brazilian towns retired in 3d469d9), so the agent API reported no_effect
with no toast. It now toasts that the city is off the map and names the
nearest open city in its country to build in instead, and its dry run
reports that as blocked. An old save that kept a POP there is unchanged.
This commit is contained in:
parent
3fd44908af
commit
4b554f2ecb
11 changed files with 50 additions and 5 deletions
|
|
@ -9,6 +9,7 @@ All notable changes to this project are documented here. The project follows
|
|||
- The map zooms in twice as far, for crowded regions like New England or around Washington.
|
||||
- Cable ships at anchor sit a little further out from their port, and a tap on a city picks the city even with a ship close by.
|
||||
- Agents playing through the Agent API can no longer start a link in a city where you have no POP, just as on the map. Before, an agent could sign a dark fiber IRU, lease a wave or lay a cable from such a city; now it is told why, and so is its dry run.
|
||||
- An agent that tries to open a POP in one of the small cities that are off the map is now told why it can't, and which city nearby to build in instead. Before, nothing happened and nothing was said.
|
||||
|
||||
## [2.8.0] — 2026-11-04
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
// Style: informal "du"; networking terms stay English (Peering, Transit, Dark Fiber, Wave, Port, POP, IX…), but
|
||||
// plain "fiber" is "Glasfaser" and "fiber pair" is "Faserpaar". The add-strings skill has the full style notes.
|
||||
(window.I18N=window.I18N||{}).de={
|
||||
"action_helpers.city_is_off_the_map_small":"<b>{city} ist nicht mehr auf der Karte.</b><br>Kleine Städte so nah an einer größeren gibt es in neuen Spielen nicht mehr. Bau stattdessen in {near}.",
|
||||
"action_helpers.light_fiber_pair_n_price":"Faserpaar {n} beleuchten <small>{price}</small>",
|
||||
"action_helpers.light_fiber_pair_n_price_mo":"Faserpaar {n} beleuchten <small>{price} + {mo}/Monat</small>",
|
||||
"action_helpers.n_fiber_pairs_lit_the_trench":"{n} Faserpaare beleuchtet, der Graben ist voll",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Spanish: the translation of every label in src/i18n/en.js. One entry per line, sorted by label; plurals are
|
||||
// {"one":…,"other":…}. Add or change entries with scripts/i18n-add.js, check with npm run i18n:check.
|
||||
(window.I18N=window.I18N||{}).es={
|
||||
"action_helpers.city_is_off_the_map_small":"<b>{city} ya no está en el mapa.</b><br>Las ciudades pequeñas tan cerca de una más grande ya no aparecen en partidas nuevas. Construye en {near}.",
|
||||
"action_helpers.light_fiber_pair_n_price":"Iluminar el par de fibra {n} <small>{price}</small>",
|
||||
"action_helpers.light_fiber_pair_n_price_mo":"Iluminar el par de fibra {n} <small>{price} + {mo}/mes</small>",
|
||||
"action_helpers.n_fiber_pairs_lit_the_trench":"{n} pares de fibra iluminados, la zanja está llena",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// French: the translation of every label in src/i18n/en.js. One entry per line, sorted by label; plurals are
|
||||
// {"one":…,"other":…}. Add or change entries with scripts/i18n-add.js, check with npm run i18n:check.
|
||||
(window.I18N=window.I18N||{}).fr={
|
||||
"action_helpers.city_is_off_the_map_small":"<b>{city} n’est plus sur la carte.</b><br>Les petites villes aussi proches d’une plus grande ne figurent plus dans les nouvelles parties. Construis plutôt à {near}.",
|
||||
"action_helpers.light_fiber_pair_n_price":"Allumer la paire {n} <small>{price}</small>",
|
||||
"action_helpers.light_fiber_pair_n_price_mo":"Allumer la paire {n} <small>{price} + {mo}/mois</small>",
|
||||
"action_helpers.n_fiber_pairs_lit_the_trench":"{n} paires de fibres allumées, la tranchée est pleine",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Italian: the translation of every label in src/i18n/en.js. One entry per line, sorted by label; plurals are
|
||||
// {"one":…,"other":…}. Add or change entries with scripts/i18n-add.js, check with npm run i18n:check.
|
||||
(window.I18N=window.I18N||{}).it={
|
||||
"action_helpers.city_is_off_the_map_small":"<b>{city} non è più sulla mappa.</b><br>Le città piccole così vicine a una più grande non ci sono più nelle nuove partite. Costruisci invece a {near}.",
|
||||
"action_helpers.light_fiber_pair_n_price":"Accendi la coppia {n} <small>{price}</small>",
|
||||
"action_helpers.light_fiber_pair_n_price_mo":"Accendi la coppia {n} <small>{price} + {mo}/mese</small>",
|
||||
"action_helpers.n_fiber_pairs_lit_the_trench":"{n} coppie di fibre accese, il cavidotto è pieno",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Portuguese (Brazil). Keys are the English text exactly as passed to tr()/trn()/N_() in src/ (or as it stands
|
||||
// in its data-i18n markup, aria-label or title); sorted; check with: npm run i18n:check, add with scripts/i18n-add.js
|
||||
(window.I18N=window.I18N||{}).pt={
|
||||
"action_helpers.city_is_off_the_map_small":"<b>{city} saiu do mapa.</b><br>Cidades pequenas tão perto de uma maior não entram mais em jogos novos. Construa em {near}.",
|
||||
"action_helpers.light_fiber_pair_n_price":"Acender par {n} <small>{price}</small>",
|
||||
"action_helpers.light_fiber_pair_n_price_mo":"Acender par {n} <small>{price} + {mo}/mês</small>",
|
||||
"action_helpers.n_fiber_pairs_lit_the_trench":"{n} pares de fibras acesos, a vala está cheia",
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ const API_CMD={
|
|||
downP:{args:[['id','entityId']],watch:['pni.#id'],doc:'Step a PNI down one size. Not while an augment is on order.'},
|
||||
/* ---------- footprint: buildings, routers, POPs ---------- */
|
||||
buildPop:{args:[['city','cityId']],
|
||||
quote:a=>({setup:popCost(a.city),blocked:cnCity(a.city)&&!cnOk()?[tr('pops_transit_ix.you_need_a_license_first_foreign')]:[]}),
|
||||
doc:'Open a POP in a city you do not have one in. Costs popCost(city).'},
|
||||
quote:a=>({setup:popCost(a.city),blocked:[cityOn(a.city)?'':popOffWhy(a.city),cnCity(a.city)&&!cnOk()?tr('pops_transit_ix.you_need_a_license_first_foreign'):''].filter(Boolean)}),
|
||||
doc:'Open a POP in a city you do not have one in. Costs popCost(city). Not in a retired small city (off the map in new games).'},
|
||||
launchBB:{args:[['city','cityId']],watch:['pops.#city'],
|
||||
quote:a=>({setup:bbCost(a.city)}),
|
||||
doc:'Launch broadband to the eyeballs of a city you have a POP in. The core revenue source; one per POP.'},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Object.assign(ACT,{
|
||||
buildPop:({city})=>{if(S.pops[city]||!cityOn(city))return;const flipNote=CITY[city]&&CITY[city].au;if(cnCity(city)&&!cnOk()){toast(tr('pops_transit_ix.you_need_a_license_first_foreign'),'bad');sfx('err');return;}if(!spend(popCost(city)))return;S.pops[city]={day:S.day,bb:null,boost:0,down:0,routers:1,gen:false};popStdApply(city);floater(CITY[city].x,CITY[city].y-30,tr('common.new_pop'),'#FF4F9A');if(flipNote)toast(pick([tr('pops_transit_ix.router_installed_in_city_upside_down',{city:CITY[city].name}),tr('pops_transit_ix.router_installed_in_city_the_vendor',{city:CITY[city].name})]),'good',[],{a:'city',v:city});UI.tab='cust';after();},
|
||||
buildPop:({city})=>{if(S.pops[city]||!CITY[city])return;if(!cityOn(city)){toast(popOffWhy(city),'bad');sfx('err');return;}const flipNote=CITY[city]&&CITY[city].au;if(cnCity(city)&&!cnOk()){toast(tr('pops_transit_ix.you_need_a_license_first_foreign'),'bad');sfx('err');return;}if(!spend(popCost(city)))return;S.pops[city]={day:S.day,bb:null,boost:0,down:0,routers:1,gen:false};popStdApply(city);floater(CITY[city].x,CITY[city].y-30,tr('common.new_pop'),'#FF4F9A');if(flipNote)toast(pick([tr('pops_transit_ix.router_installed_in_city_upside_down',{city:CITY[city].name}),tr('pops_transit_ix.router_installed_in_city_the_vendor',{city:CITY[city].name})]),'good',[],{a:'city',v:city});UI.tab='cust';after();},
|
||||
launchBB:({city})=>{const p=S.pops[city];if(!p||p.bb)return;const C=CITY[city];if(!spend(bbCost(city)))return;p.bb={d:bbStart(city)};floater(C.x,C.y-30,tr('common.eyeballs_online'),'#16A866');after();},
|
||||
ad:({city})=>{const p=S.pops[city];if(!p||!p.bb)return;if(!spend(8000))return;p.boost=S.day+30;floater(CITY[city].x,CITY[city].y-30,tr('common.ad_campaign'),'#FF8A3D');after();},
|
||||
buyTransit:({city,net,tier})=>{tier=+tier;if(scnRule('noTransit')){toast(tr('pops_transit_ix.no_transit_in_this_scenario_peering'),'bad');sfx('err');return;}if(!S.pops[city]||!NET[net]||!sellsAt(NET[net],city)||!PORT[tier])return;if(!portOk(city,tier)){toast(tr('actions.your_router_can_t_take_a',{port:PORT[tier].n}),'bad');sfx('err');return;}const ex=S.transit.find(t=>t.city===city&&t.net===net);if(ex&&tier<=ex.tier)return;if(!portGate(city,ex?(PORT_SLOT(tier)-PORT_SLOT(ex.tier))*(ex.n||1):PORT_SLOT(tier)))return;if(!spend(PORT[tier].setup*(ex&&ex.n||1)))return;if(ex)ex.tier=tier;else S.transit.push({id:uid(),city,net,tier,down:0,...(premOnlyAt(NET[net],city)?{premium:true}:{})});toast(tr('pops_transit_ix.net_transit_is_live_in_city',{net:esc(NET[net].name),city:CITY[city].name}),'good');after();},
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ function dfAllowed(a,b){if(isSub(a,b))return !!subDfCable(a,b);return cnCity(a)=
|
|||
// A link starts at one of your POPs. The map only drags one from a POP, but a typed order (the agent API) names both ends.
|
||||
function linkFromWhy(a){return S.pops[a]?'':tr('action_helpers.you_have_no_pop_in_city',{city:CITY[a].name});}
|
||||
function linkFromOk(a){const w=linkFromWhy(a);if(w){toast(w,'bad');sfx('err');}return !w;}
|
||||
// A retired small city (off: true) takes no new POP; the nearest open city in its country stands in for it.
|
||||
function popOffWhy(c){const C=CITY[c],near=CITIES.filter(o=>!o.off&&o.cc===C.cc).sort((x,y)=>kmBetween(c,x.id)-kmBetween(c,y.id))[0];
|
||||
return tr('action_helpers.city_is_off_the_map_small',{city:C.name,near:near?near.name:''});}
|
||||
/* Optics you unplug go on a spares shelf instead of in the bin (#45): the next channel of that type uses a spare
|
||||
for free (only the regen sites' transponders are new), or you sell it on eBuy for part of the price. */
|
||||
const SPARE_RESALE=0.4,spareN=o=>(S&&S.spares&&S.spares[o])|0,spareValue=o=>Math.round(optCost(o)*SPARE_RESALE);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// Inlined into the page at build. One entry per line, sorted by label; plurals are {"one":…,"other":…}.
|
||||
// Add or change text with scripts/i18n-add.js, check with npm run i18n:check.
|
||||
(window.I18N=window.I18N||{}).en={
|
||||
"action_helpers.city_is_off_the_map_small":"<b>{city} is off the map.</b><br>Small cities this close to a bigger one are retired from new games. Build in {near} instead.",
|
||||
"action_helpers.light_fiber_pair_n_price":"Light fiber pair {n} <small>{price}</small>",
|
||||
"action_helpers.light_fiber_pair_n_price_mo":"Light fiber pair {n} <small>{price} + {mo}/mo</small>",
|
||||
"action_helpers.n_fiber_pairs_lit_the_trench":"{n} fiber pairs lit, the trench is full",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
// Typed orders (the MCP act tool) name both ends of a link, where the map only drags one from a POP of yours.
|
||||
// A link from a city with no POP is refused, with a toast that says why and a dry run that reports it as blocked.
|
||||
// Typed orders (the MCP act tool) name both ends of a link and any city for a POP, where the map only offers what
|
||||
// a player can reach: a link dragged from one of your POPs, a POP in a city that is on the map. These hold the same
|
||||
// lines: a link from a city with no POP is refused, and so is a POP in a retired small city, each with a toast that
|
||||
// says why and a dry run that reports it as blocked.
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { createSession, TOOLS } = require('../scripts/lib/mcp-game');
|
||||
|
|
@ -54,3 +56,36 @@ test('from one of your POPs the same orders still go through and open a POP at t
|
|||
assert.ok(ev('!!S.pops.cwb'));
|
||||
assert.deepEqual(s.errors(), []);
|
||||
});
|
||||
|
||||
test('a POP in a retired small city is refused with a toast naming an open city nearby, and its dry run is blocked', () => {
|
||||
const { s, ev, act, pops } = sandbox();
|
||||
const q = act('buildPop', { city: 'aju' }, true);
|
||||
assert.deepEqual(q.quote.blocked, [ev("apiText(popOffWhy('aju'))")]);
|
||||
assert.match(q.quote.blocked[0], /Aracaju is off the map/);
|
||||
const r = act('buildPop', { city: 'aju' });
|
||||
assert.equal(r.outcome, 'rejected');
|
||||
assert.ok(r.toasts.some((t) => /Aracaju is off the map.*\n.*Build in Salvador instead/s.test(t)), JSON.stringify(r.toasts));
|
||||
assert.equal(r.charged, 0);
|
||||
// every retired city names an open city in its own country to build in instead
|
||||
const near = JSON.parse(ev(`JSON.stringify(CITIES.filter(c=>c.off).map(c=>{const m=popOffWhy(c.id).match(/Build in (.+) instead/);
|
||||
const o=m&&CITIES.find(x=>x.name===m[1]);return {c:c.id,ok:!!o&&!o.off&&o.cc===c.cc};}))`));
|
||||
assert.ok(near.length > 0, 'there are retired cities');
|
||||
assert.deepEqual(near.filter((x) => !x.ok), []);
|
||||
// an open city still takes a POP; an unknown id does nothing and says nothing
|
||||
assert.equal(act('buildPop', { city: 'ssa' }).outcome, 'applied');
|
||||
ev("ACT.buildPop({city:'nope'})");
|
||||
assert.deepEqual(pops(), ['sao', 'ssa']);
|
||||
assert.deepEqual(s.errors(), []);
|
||||
});
|
||||
|
||||
test('an old save that kept a POP in a retired city keeps it, and buildPop there stays quiet', () => {
|
||||
const { s, ev, act } = sandbox();
|
||||
ev("S.pops.aju={day:0,bb:null,boost:0,down:0,routers:1,gen:false};S=migrate(JSON.parse(JSON.stringify(S)));compute()");
|
||||
assert.ok(ev("!!S.pops.aju&&cityOn('aju')"));
|
||||
const r = act('buildPop', { city: 'aju' });
|
||||
assert.equal(r.outcome, 'no_effect');
|
||||
assert.deepEqual(r.toasts, []);
|
||||
// and a link may start there, since it is one of your POPs
|
||||
assert.equal(act('orderDf', { a: 'aju', b: 'rec', source: 'lease', system: 'roadm' }).outcome, 'applied');
|
||||
assert.deepEqual(s.errors(), []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue