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
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue