The build standard owns the router model and the line system; one owner per fiber
The routers order reads its model from the build standard (bstd().g, 'keep' is the old next-model-up rule) and the optical upgrade order its line system (bstd().sys). The Ops sheet shows "From the build standard: X" with a button to the sheet. Old saves move a model or line system from an order that was running into the standard when it has none of its own; a paused order's or an unhired intern's setting is dropped. opsParam refuses model/sys and points at bstdSet. The build standard's order is a generator now: every first job that takes a fiber dark goes through the optical order's routing test (opsDark, in the route worker in play), under one shared budget of dark swaps a night (two for Kevin) and the week-long memory for a failed fiber. A fiber one order worked on is the other's no more that shift, and decom keeps waves the standard just upgraded. The plan is checked at every job, since the shift rests between them: a POP gone or changed by hand meanwhile is skipped. The button still runs the whole plan at once on the page.
This commit is contained in:
parent
032470f486
commit
fbae6fc3ed
22 changed files with 573 additions and 138 deletions
|
|
@ -18,20 +18,19 @@ const OPS_AHEAD=1.1,opsIs=id=>!!S&&!!S.ops&&S.ops.intern===id,opsAhead=()=>opsIs
|
|||
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_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}}},
|
||||
// The model to standardize on is the build standard's, set in its sheet (96-pop-standard.js): none of its own here.
|
||||
{k:'routers',i:'🧠',pop:1,cap:250000,t:N_('ops.o_routers'),d:N_('ops.o_routers_std_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])}}},
|
||||
// The build standard (96-pop-standard.js): its targets are set in their own sheet, so here it has only the budget.
|
||||
{k:'std',i:'📐',pop:1,cap:250000,t:N_('ops.o_std'),d:N_('ops.o_std_d'),p:{}},
|
||||
{k:'std',i:'📐',pop:1,cap:250000,t:N_('ops.o_std'),d:N_('ops.o_std_around_d'),p:{}},
|
||||
{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')}}},
|
||||
{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])}}},
|
||||
// Line systems up to a bigger one, and optics swapped for bigger ones, on fiber that is full and runs hot, or every fiber up to
|
||||
// a chosen line system. A line system swap is a day without that fiber: only where the traffic gets around it.
|
||||
{k:'optup',i:'🔭',cap:250000,t:N_('ops.o_optup'),d:N_('ops.o_optup_d'),p:{at:{d:80,v:[60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},
|
||||
sys:{d:'next',v:['next','roadm','cl'],l:N_('ops.p_sys'),f:v=>v==='next'?tr('ops.sys_next'):DF_SYS[v].n},swap:{d:true,v:[true,false],l:N_('ops.p_swap'),f:v=>v?tr('common.on'):tr('common.off')}}},
|
||||
// the build standard's line system. A line system swap is a day without that fiber: only where the traffic gets around it.
|
||||
{k:'optup',i:'🔭',cap:250000,t:N_('ops.o_optup'),d:N_('ops.o_optup_std_d'),p:{at:{d:80,v:[60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},
|
||||
swap:{d:true,v:[true,false],l:N_('ops.p_swap'),f:v=>v?tr('common.on'):tr('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);
|
||||
|
|
@ -47,10 +46,9 @@ 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();
|
||||
// Every value a setting can take, in the order its list shows them, providers that sell where you have POPs as well.
|
||||
// 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)]: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;}
|
||||
|
|
@ -64,6 +62,10 @@ function opsSanitize(s){const o=s.ops&&typeof s.ops==='object'&&!Array.isArray(s
|
|||
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;
|
||||
const on=ob(o.on),p=ob(o.p),cap=ob(o.cap),sp=ob(o.spent);
|
||||
// The routers order's model and the optical order's line system moved to the build standard (bstdAdopt()), each only
|
||||
// from an order that ran: one paused, or with nobody hired, did nothing, and a standard's model costs every new POP.
|
||||
const ran=k=>!!n.intern&&on[k]===true;
|
||||
bstdAdopt(s,ran('routers')?ob(p.routers).model:undefined,ran('optup')?ob(p.optup).sys:undefined);
|
||||
for(const d of OPS){const k=d.k;n.on[k]=on[k]===true;const q=ob(p[k]),r={};
|
||||
for(const pk of Object.keys(d.p)){const P=d.p[pk];if(own(q,pk)&&(P.ok?P.ok(q[pk]):P.v.includes(q[pk])))r[pk]=q[pk];}n.p[k]=r;
|
||||
if(d.cap&&opsCaps(k).includes(cap[k]))n.cap[k]=cap[k];if(d.cap)n.spent[k]=Math.max(0,num(sp[k],0));
|
||||
|
|
@ -122,8 +124,10 @@ function opsQuiet(fn){const a=after,t=toast,s=sfx,f=floater,sel=UI.sel,cf=UI.con
|
|||
// 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: what this shift paid up front and added to the monthly bill.
|
||||
// dk: the night's fibers taken dark (n) and routings to test one (t), shared by the orders that do it (opsDarkRoom()).
|
||||
// fib: the fibers and waves an order worked on this shift, by order: one owner per fiber a shift.
|
||||
function opsShift(){const r=new Map(),broke=new Set();
|
||||
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);},
|
||||
return {r,broke,dirty:false,up:0,mo:0,dk:{n:0,t:0},fib:new Map(),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;
|
||||
|
|
@ -145,14 +149,15 @@ const opsProv=c=>{const pv=opsP('transit','prov'),n=isNet(pv)?NET[pv]:null;retur
|
|||
// after a job is only a place where a long shift may let a frame through (opsRun()), nothing changes there.
|
||||
const OPS_RUN={
|
||||
// Bring POPs, ports and fiber up to the build standard: the busiest first, a few jobs a shift (96-pop-standard.js).
|
||||
std(X){bstdShift(X);},
|
||||
*std(X){yield* bstdShift(X);},
|
||||
*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');yield;}},
|
||||
*routers(X){const at=opsP('routers','at')/100,how=opsP('routers','how'),m=opsP('routers','model'),fix=m!=='next',
|
||||
*routers(X){const at=opsP('routers','at')/100,how=opsP('routers','how'),G=bstd().g,fix=G!=='keep',
|
||||
load=c=>Math.max((R.nodeLoad[c]||0)*opsAhead()/(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;
|
||||
// The build standard's model: swap every POP still on a smaller one to the model the standard gives it (bstdModel():
|
||||
// the best unlocked one no bigger, never a step down, never one that does not fit or cannot run the core), the
|
||||
// busiest first, while the budget lasts, and only with a second router or no traffic there.
|
||||
if(fix)for(const c of opsPops('routers').sort((a,b)=>load(b)-load(a))){const p=S.pops[c];
|
||||
if(p.rupDay===S.day||!((p.routers||1)>1||popIdle(c)))continue;const m=bstdModel(G,c);if(m<0)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);yield;}}
|
||||
for(const c of opsPops('routers')){const p=S.pops[c];if(p.rupDay===S.day)continue;
|
||||
|
|
@ -222,19 +227,20 @@ const OPS_RUN={
|
|||
const n=(cnt[o]||0)+1,cost=opticCountCost(l,o,n),before=(l.ch||[]).length;if(!X.can('optics',cost))break;
|
||||
X.pay('optics',()=>{ACT.setChCount({id:l.id,o,n});return (l.ch||[]).length>before;});if((l.ch||[]).length<=before)break;
|
||||
cap+=optG(o,l);X.did('optics',l.a+'|'+l.b);yield;}}},
|
||||
*optup(X){const at=opsP('optup','at')/100,goal=opsP('optup','sys'),swap=opsP('optup','swap');let ups=0,tries=0;
|
||||
*optup(X){const at=opsP('optup','at')/100,sys=bstd().sys,goal=sys==='keep'?'next':sys,swap=opsP('optup','swap');
|
||||
const hot=l=>{const c=dfCap(l);return c>0&&((R.load&&R.load[l.id])||0)*opsAhead()>=c*at;},full=l=>freeCh(l)<=0,u=l=>((R.load&&R.load[l.id])||0)/Math.max(1,dfCap(l));
|
||||
const ls=S.links.filter(l=>l.kind==='df'&&!l.seat&&l.ready<=S.day&&!(l.eqDown>S.day)&&!(l.cut>S.day)).sort((a,b)=>u(b)-u(a));
|
||||
// A fiber the build standard's order worked on this shift is that order's until tomorrow.
|
||||
const ls=S.links.filter(l=>l.kind==='df'&&!l.seat&&l.ready<=S.day&&!(l.eqDown>S.day)&&!(l.cut>S.day)&&(X.fib.get(l.id)||'optup')==='optup').sort((a,b)=>u(b)-u(a));
|
||||
for(const l of ls){
|
||||
// The line system: one step at a time up to the chosen one, or the next one where the fiber is full and hot.
|
||||
// The line system: one step at a time up to the build standard's, or the next one where the fiber is full and hot.
|
||||
const want=goal==='next'?(full(l)&&hot(l)?sysNext(l):null):SYS_RANK[l.sys]<SYS_RANK[goal]?goal:null;
|
||||
if(want&&ups<OPTUP_MAX*(opsIs('kevin')?2:1)&&tries<OPTUP_TRY*(opsIs('kevin')?2:1)){const to=sysNext(l),cost=sysUpCost(l);
|
||||
if(to&&techOk('sys',to,DF_SYS[to].lvl)&&!(OPTUP_NO.get(l.id)>S.day)&&X.can('optup',cost)){tries++;const ok=yield* opsDark(l,X);if(!ok)OPTUP_NO.set(l.id,S.day+OPTUP_WAIT);
|
||||
if(want&&opsDarkRoom(X)){const to=sysNext(l),cost=sysUpCost(l);
|
||||
if(to&&techOk('sys',to,DF_SYS[to].lvl)&&!(OPTUP_NO.get(l.id)>S.day)&&X.can('optup',cost)){const ok=yield* opsDark(l,X);if(!ok)OPTUP_NO.set(l.id,S.day+OPTUP_WAIT);
|
||||
if(ok){const s0=l.sys,top=goal==='next'?to:goal;
|
||||
for(let k=0;k<2&&sysNext(l)&&SYS_RANK[l.sys]<SYS_RANK[top];k++){const nx=sysNext(l);
|
||||
if(!techOk('sys',nx,DF_SYS[nx].lvl)||!X.can('optup',sysUpCost(l))||!X.pay('optup',()=>{const s=l.sys;ACT.upSys({id:l.id});return l.sys!==s;}))break;}
|
||||
// The fiber is dark until tomorrow: its optics wait.
|
||||
if(l.sys!==s0){ups++;X.did('optup',l.a+'|'+l.b+' ⇧'+SYS_TAG[l.sys]);yield;continue;}}}}
|
||||
if(l.sys!==s0){X.dk.n++;X.fib.set(l.id,'optup');X.did('optup',l.a+'|'+l.b+' ⇧'+SYS_TAG[l.sys]);yield;continue;}}}}
|
||||
// Optics: a full, hot fiber trades its smallest channels for the biggest optic that fits, one at a time. Hitless, and
|
||||
// the old optics go on the shelf as spares.
|
||||
if(!swap)continue;
|
||||
|
|
@ -248,7 +254,7 @@ const OPS_RUN={
|
|||
const was=dfCap(l);
|
||||
X.pay('optup',()=>{ACT.setChCount({id:l.id,o:o1,n:cnt[o1]-1});ACT.setChCount({id:l.id,o:o2,n:n2});
|
||||
if((l.ch||[]).filter(k=>k===o2).length===n2)return true;ACT.setChCount({id:l.id,o:o1,n:cnt[o1]});return false;});
|
||||
if(!(dfCap(l)>was))break;X.did('optswap',l.a+'|'+l.b+' '+fmtCap(optG(o1,l))+'→'+fmtCap(optG(o2,l)));yield;}}},
|
||||
if(!(dfCap(l)>was))break;X.fib.set(l.id,'optup');X.did('optswap',l.a+'|'+l.b+' '+fmtCap(optG(o1,l))+'→'+fmtCap(optG(o2,l)));yield;}}},
|
||||
*caches(X){const g=opsP('caches','g');
|
||||
for(const c of opsPops('caches')){const q=utilityCaches(c);if(!q||!q.add.length)continue;
|
||||
const want=q.add.filter(x=>cacheDem(c,x.net)>=g),free=()=>portsMax(c)-portsUsed(c)+1e-9;
|
||||
|
|
@ -269,23 +275,34 @@ const OPS_RUN={
|
|||
const q=pniRequote(q0);if(!q)continue;if(!X.can('pni',q.cost))break;if(X.pay('pni',()=>{if(!spend(q.cost))return false;pniPlace(q);return true;}))X.did('pni',q.city+' '+q.net);yield;}},
|
||||
// Hand back smaller waves once a bigger link between the same cities carries the pair with a quarter to spare (#102).
|
||||
// Loads must include what this shift already did (a customer just signed, a repair): opsRun() routes first if a
|
||||
// job changed the network and anything could go (opsDecomWaits()).
|
||||
*decom(X){for(const ls of opsPairs().values())for(const l of opsDecomPick(ls)){UI.confirm=l.id;X.pay('decom',()=>ACT.rmLink({id:l.id}));if(!S.links.includes(l))X.did('decom',l.a+'|'+l.b);yield;}},
|
||||
// job changed the network and anything could go (opsDecomWaits()). A wave another order worked on today stays.
|
||||
// (Left out of what the pick hands back, not out of the pick: it may still be the spare the pick keeps.)
|
||||
*decom(X){for(const ls of opsPairs().values())for(const l of opsDecomPick(ls).filter(l=>!X.fib.has(l.id))){UI.confirm=l.id;X.pay('decom',()=>ACT.rmLink({id:l.id}));if(!S.links.includes(l))X.did('decom',l.a+'|'+l.b);yield;}},
|
||||
};
|
||||
// Line system swaps per shift, and how many fibers a shift may test for one: each test routes the whole network once,
|
||||
// so a shift costs at most one routing more, and only on a night with a fiber to try. A fiber that failed the test is not tested again for a week
|
||||
// Line system swaps per shift, and how many fibers a shift may test for one with a routing: each test routes the whole
|
||||
// network once, so a shift costs at most one routing more, and only on a night with a fiber to try. The build standard's
|
||||
// order and this one share them (X.dk). A fiber that failed the test is not tested again for a week
|
||||
// (not saved: after a reload it is simply tested again).
|
||||
const OPTUP_MAX=1,OPTUP_TRY=1,OPTUP_WAIT=7,OPTUP_NO=new Map(),SYS_RANK={lite:0,roadm:1,cl:2},SYS_TAG={roadm:'ROADM',cl:'C+L'};
|
||||
// Room tonight for one more fiber going dark. Kevin does maintenance: twice the swaps, and twice the tests.
|
||||
const opsDarkRoom=X=>{const k=opsIs('kevin')?2:1;return X.dk.n<OPTUP_MAX*k&&X.dk.t<OPTUP_TRY*k;};
|
||||
// Another live path between the fiber's two cities, without it: a plain walk, no routing.
|
||||
function opsAround(l){const adj={};for(const x of S.links){if(x===l||linkDown(x))continue;(adj[x.a]=adj[x.a]||[]).push(x.b);(adj[x.b]=adj[x.b]||[]).push(x.a);}
|
||||
const seen=new Set([l.a]),q=[l.a];while(q.length){const u=q.pop();if(u===l.b)return true;for(const v of adj[u]||[])if(!seen.has(v)){seen.add(v);q.push(v);}}return false;}
|
||||
// A day without this fiber: does every gigabit still get where it went today, and every circuit stay whole? Today's routing
|
||||
// is the yardstick (routed again first if this shift already changed the network). Both routings are steps the day
|
||||
// answers (OPS_ROUTE, then {dark}: opsDarkTrial(), in play in the route worker).
|
||||
// Nothing rides the fiber: no traffic of its own (customers' circuits are in it), none on an express through it (#58).
|
||||
const opsUnused=l=>{const L=(R&&R.load)||{};return !(L[l.id]>1e-6)&&!xpOver(l.id).some(x=>L[x.id]>1e-6);};
|
||||
// What a day dark comes to, said without routing: false (a customer rides it, or it carries traffic with no other way
|
||||
// between its cities), true (nothing rides it, so nothing is lost), null (a routing decides: opsDarkTrial()).
|
||||
function opsDarkPre(l){if(S.biz.some(b=>b.link===l.id))return false;return opsUnused(l)?true:opsAround(l)?null:false;}
|
||||
const OPS_ROUTE={route:true};
|
||||
function* opsDark(l,X){if(S.biz.some(b=>b.link===l.id)||!opsAround(l))return false;if(X.dirty){yield OPS_ROUTE;X.dirty=false;}
|
||||
return !!(yield {dark:l.id,s0:R.served,L0:R.l2||{}});}
|
||||
// The test itself, on the game it is given: R is put back after.
|
||||
// X.dk.t counts the tests that route.
|
||||
function* opsDark(l,X){let k=opsDarkPre(l);if(k===false)return false;if(X.dirty){yield OPS_ROUTE;X.dirty=false;k=opsDarkPre(l);}
|
||||
if(k!==null)return k;X.dk.t++;return !!(yield {dark:l.id,s0:R.served,L0:R.l2||{}});}
|
||||
// The test itself, on the game it is given: R is put back after. The fiber's line system is down for the day (eqDown),
|
||||
// and every express riding it with it (xpDown()): their traffic has to get around too.
|
||||
function opsDarkTrial(y){const l=S.links.find(x=>x.id===y.dark);if(!l)return false;const R0=R,e0=l.eqDown,s0=y.s0,L0=y.L0;
|
||||
try{l.eqDown=S.day+1;compute();return R.served>=s0-1e-6*Math.max(1,s0)&&Object.keys(L0).every(id=>(R.l2[id]||0)>=L0[id]-1e-6);}
|
||||
finally{if(e0===undefined)delete l.eqDown;else l.eqDown=e0;R=R0;}}
|
||||
|
|
@ -300,8 +317,8 @@ function opsDecomPick(ls,cf=capOf){if(!ls||ls.length<2)return [];const live=ls.f
|
|||
for(const l of small.reverse()){if(cap-cf(l)<load*1.25)break;if(!opsDecomSafe(l,out))continue;cap-=cf(l);out.push(l);}
|
||||
return out;}
|
||||
// The same test overtaken by an action: its checks, and today's routing as the yardstick, as the game is now.
|
||||
function opsDarkAgain(y){const l=S.links.find(x=>x.id===y.dark);if(!l||S.biz.some(b=>b.link===l.id)||!opsAround(l))return false;
|
||||
return opsDarkTrial({dark:l.id,s0:R.served,L0:R.l2||{}});}
|
||||
function opsDarkAgain(y){const l=S.links.find(x=>x.id===y.dark);if(!l)return false;const k=opsDarkPre(l);
|
||||
return k!==null?k:opsDarkTrial({dark:l.id,s0:R.served,L0:R.l2||{}});}
|
||||
// A wave can carry a promise: diverse paths, no subsea, a latency budget. Try the network without it (and gone) first.
|
||||
function opsDecomSafe(l,gone=[]){const bz=S.biz.filter(b=>(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);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,13 @@ function bstd(d=S&&S.popStd){const o={},ob=d&&typeof d==='object'&&!Array.isArra
|
|||
// Back to the saved form: the model and router count, and any other target that is not "keep". Nothing set: null.
|
||||
function bstdPut(o){const d={};for(const x of BSTD)if(x.k==='rt'||o[x.k]!==x.d)d[x.k]=o[x.k];return Object.keys(d).length>1||d.rt>1?d:null;}
|
||||
function popStdSanitize(s){s.popStd=s.popStd&&typeof s.popStd==='object'&&!Array.isArray(s.popStd)?bstdPut(bstd(s.popStd)):null;}
|
||||
// Saves from when the intern's orders had their own router model (routers) and line system (optup): the standard takes
|
||||
// them where it has none of its own; one that names its own keeps it. 'next' was no choice at all: nothing moves.
|
||||
// opsSanitize() passes only what an order that was running used (undefined otherwise): the rest is dropped.
|
||||
function bstdAdopt(s,g,sys){const D=bstd(s.popStd);let n=0;
|
||||
if(D.g==='keep'&&Number.isInteger(g)&&bstdOk(BSTDK.g,g)){D.g=g;n++;}
|
||||
if(D.sys==='keep'&&sys!=='keep'&&bstdOk(BSTDK.sys,sys)){D.sys=sys;n++;}
|
||||
if(n)s.popStd=bstdPut(D);}
|
||||
// A bank that forbids generators (Stormy Weather's covenant): the standard never installs one while that loan runs.
|
||||
const bstdNoGen=()=>(S.loans||[]).some(l=>(l.covs||[]).includes('nogen'));
|
||||
// The model a POP should get: the standard's if you can buy it, else the best main-line model that is unlocked and no
|
||||
|
|
@ -80,12 +87,14 @@ function bstdPlan(intern){const J=[];J.held=[];if(!S||!S.popStd||pzOn())return J
|
|||
const take=(c,n,dry)=>{if(n<=0)return true;if(room(c)<n)return false;if(!dry)rmn[c]-=n;return true;};
|
||||
const job=(grp,k,ch,w,cost,mo,go,x)=>{const j={grp,k,ch,w,cost,mo,go,...x};J.push(j);return j;};
|
||||
for(const c of cs){const p=S.pops[c],ch='p:'+c;let g=p.rgen||0,rt=p.routers||1,sw=null,s2=null;
|
||||
const add=()=>{const g0=g,r0=rt;job('pop','rt',ch,c+' +1',routerCost(g0,r0),routerMo(g0)+cageMo(r0+1)-cageMo(r0),()=>{const n=S.pops[c].routers||1;ACT.addRouter({city:c});return (S.pops[c].routers||1)>n;},{c});rt++;};
|
||||
// A router job checks the POP still has what the plan counted on: the intern's shift rests between jobs, and the player
|
||||
// may click meanwhile (the button, a router by hand). So does a PNI job: one ordered meanwhile is not upgraded.
|
||||
const add=()=>{const g0=g,r0=rt;job('pop','rt',ch,c+' +1',routerCost(g0,r0),routerMo(g0)+cageMo(r0+1)-cageMo(r0),()=>{const n=S.pops[c].routers||1;if(n!==r0)return false;ACT.addRouter({city:c});return (S.pops[c].routers||1)>n;},{c});rt++;};
|
||||
const m=p.rupDay===S.day?-1:bstdModel(D.g,c);
|
||||
if(m>=0){
|
||||
// One router carrying traffic: a second goes in first, so the swap rolls through with no maintenance window.
|
||||
if(rt===1&&!popIdle(c))add();
|
||||
const old=g,r=rt;sw=job('pop','g',ch,c+' ⇧'+RG[m].pn,swapCostOf(m,old,r),r*(RG[m].mo-RG[old].mo),()=>{ACT.upRouter({city:c,g:m});return (S.pops[c].rgen||0)===m;},{c});g=m;}
|
||||
const old=g,r=rt;sw=job('pop','g',ch,c+' ⇧'+RG[m].pn,swapCostOf(m,old,r),r*(RG[m].mo-RG[old].mo),()=>{if((S.pops[c].rgen||0)!==old)return false;ACT.upRouter({city:c,g:m});return (S.pops[c].rgen||0)===m;},{c});g=m;}
|
||||
while(rt<D.rt&&rt<RMAX)add();
|
||||
// A building and a generator do not wait for the routers, nor for each other.
|
||||
if(D.site2&&!p.site2)s2=job('pop','site2','s:'+c,c,SITE2_COST,SITE2_MO,()=>{ACT.addSite({city:c});return !!S.pops[c].site2;},{c});
|
||||
|
|
@ -108,7 +117,7 @@ function bstdPlan(intern){const J=[];J.held=[];if(!S||!S.popStd||pzOn())return J
|
|||
const opts=NET[net].pops.filter(c=>S.pops[c]&&here(c)&&!by[net].has(c)).map(c=>({c,v:pniVal(net,c)})).filter(o=>o.v.worth).sort((a,b)=>b.v.want-a.v.want||(a.c<b.c?-1:1));
|
||||
for(const {c,v} of opts){if(k<=0)break;let q=null;for(let t=Math.max(v.tier,pniMin(net));t>=pniMin(net)&&!q;t--){const x=pniQuote(c,net,t,resv(c));if(x&&!x.why)q=x;}
|
||||
if(!q||!take(c,q.slots))continue;const tier=q.tier;k--;
|
||||
job('port','pni','n:'+net+'@'+c,c+' '+net,q.cost,pniMo({net,tier,n:1},0),()=>{const x=pniQuote(c,net,tier,resv(c));if(!x||x.why||!spend(x.cost))return false;pniPlace(x);return true;},{c});}}}
|
||||
job('port','pni','n:'+net+'@'+c,c+' '+net,q.cost,pniMo({net,tier,n:1},0),()=>{const x=pniQuote(c,net,tier,resv(c));if(!x||x.why||x.ex||!spend(x.cost))return false;pniPlace(x);return true;},{c});}}}
|
||||
// Fiber and waves, hottest first. A POP excepted from the order keeps its links as they are too.
|
||||
if(D.sys!=='keep'||D.opt!=='keep'||D.wv!=='keep'){const sp={...(S.spares||{})},dk=new Map(),wv=new Map();
|
||||
const ls=S.links.filter(l=>(l.kind==='df'||l.kind==='wave')&&here(l.a)&&here(l.b)&&S.pops[l.a]&&S.pops[l.b]).map(l=>({l,u:(R.load[l.id]||0)/Math.max(1e-9,capOf(l))})).sort((a,b)=>b.u-a.u||(a.l.id<b.l.id?-1:1));
|
||||
|
|
@ -124,10 +133,12 @@ function bstdPlan(intern){const J=[];J.held=[];if(!S||!S.popStd||pzOn())return J
|
|||
let sys=l.sys;const lit=l.ready<=S.day,nx=D.sys!=='keep'&&BSTD_SYS[sys]<BSTD_SYS[D.sys]&&sysNext({sys});
|
||||
// A lit fiber goes dark for a day. Busy with nothing parallel to carry it: it keeps its line system for now, and
|
||||
// gets the best optics that one takes. A parallel fiber goes dark first in this plan: it waits for next time.
|
||||
// The intern's plan leaves the rest to the shift's own test (opsDark(): a routing without the fiber), as the optical
|
||||
// order does: here only what is known without one (opsDarkPre()), and a fiber that failed the test this week.
|
||||
if(nx&&techOk('sys',nx,DF_SYS[nx].lvl)){
|
||||
if(lit&&!bstdDarkOk(l))J.held.push(l);
|
||||
else if(lit&&!bstdDarkOk(l,dk)){J.held.push(l);continue;}
|
||||
else{const busy=lit&&bstdBusy(l);
|
||||
if(lit&&!(intern?!(OPTUP_NO.get(l.id)>S.day)&&opsDarkPre(l)!==false:bstdDarkOk(l)))J.held.push(l);
|
||||
else if(lit&&(intern?pairLinks(l.a,l.b).some(x=>x!==l&&dk.get(x.id)):!bstdDarkOk(l,dk))){J.held.push(l);continue;}
|
||||
else{const busy=lit&&(intern?!opsUnused(l):bstdBusy(l));
|
||||
while(BSTD_SYS[sys]<BSTD_SYS[D.sys]){const to=sysNext({sys});if(!to||!techOk('sys',to,DF_SYS[to].lvl))break;
|
||||
const s0=sys;job('fiber','sys',ch,l.a+'|'+l.b,sysCost(to)*(to==='cl'&&l.own?Math.max(1,l.pairs|0):1),0,()=>{if(l.sys!==s0)return false;ACT.upSys({id:l.id});return l.sys===to;},{l,dark:lit,busy});sys=to;}
|
||||
if(lit)dk.set(l.id,busy);}}
|
||||
|
|
@ -178,25 +189,32 @@ function bstdOptJobs(l,sys,sp,V,take,ch){const rg=c=>V[c]?V[c].g:(S.pops[c].rgen
|
|||
// The new ones could not go in (ports, cash): the old optics go back in from the shelf.
|
||||
(l.ch=l.ch||[]).push(...Array(k).fill(o0));S.spares[o0]-=k;return false;}});}
|
||||
return out;}
|
||||
// A line-system swap darkens the fiber for a day: only while it carries little, or its parallel links can take its load.
|
||||
// The button's test of a line-system swap, which darkens the fiber for a day: only while it carries little, or its
|
||||
// parallel links can take its load. No routing, so the quote is what the click does. (The intern routes: opsDark().)
|
||||
// ex: fibers already going dark today (id → whether they carry traffic): they carry nothing for this one, and one whose
|
||||
// traffic leans on its parallel links keeps them lit.
|
||||
const bstdBusy=l=>((R.load&&R.load[l.id])||0)>Math.max(1,capOf(l)*0.1);
|
||||
// Express lightpaths (#58) ride the fiber's glass: its own load says nothing about them, and its parallel links do not
|
||||
// carry them, so an express with any traffic at all keeps the fiber lit (the line system waits, as for a busy fiber).
|
||||
// The intern's routing test needs no such rule: an express goes dark with its fiber there (opsDarkTrial()).
|
||||
const bstdXpBusy=l=>xpSlots(l)>0&&xpOver(l.id).some(x=>((R.load&&R.load[x.id])||0)>1e-6);
|
||||
function bstdDarkOk(l,ex){if(bstdXpBusy(l))return false;const P=pairLinks(l.a,l.b).filter(x=>x!==l);if(ex&&P.some(x=>ex.get(x.id)))return false;if(!bstdBusy(l))return true;
|
||||
return P.filter(x=>!linkDown(x)&&!x.standby&&!(ex&&ex.has(x.id))).reduce((a,x)=>a+Math.max(0,capOf(x)-((R.load&&R.load[x.id])||0)),0)>=((R.load&&R.load[l.id])||0);}
|
||||
// Do the plan's jobs in order. can(j): may it be paid for (budget, floor, cash); pay(j): run it, true if it took.
|
||||
// one: at most one fiber goes dark (the intern's shift); max: at most that many jobs tried, done or failed, so a shift's
|
||||
// work stays bounded whatever goes wrong. Returns what was done.
|
||||
function bstdDo(J,can,pay,one,max=1e9){const stop=new Set(),done=new Set(),dark=new Map();let n=0;
|
||||
/* Do the plan's jobs in order. can(j): may it be paid for (budget, floor, cash); pay(j): run it, true if it took.
|
||||
dark(j, ex): may the first job that darkens a fiber go ahead (ex: fibers gone dark so far, as bstdDarkOk() takes them),
|
||||
a generator, so a test can route (yields included); done1(j, first): after each job done (first: it took a fiber dark).
|
||||
max: at most that many jobs tried, done or failed, so a shift's work stays bounded whatever goes wrong. A bare yield
|
||||
after each job is a place to let a frame through. Returns what was done. */
|
||||
function* bstdRun(J,can,pay,dark,done1,max=1e9){const stop=new Set(),done=new Set(),dk=new Map();let n=0;
|
||||
for(const j of J){if(n>=max)break;if(stop.has(j.ch))continue;if(j.dep&&!j.dep.every(d=>done.has(d))){stop.add(j.ch);continue;}
|
||||
if(j.dark&&!dark.has(j.l.id)&&((one&&dark.size)||!bstdDarkOk(j.l,dark))){stop.add(j.ch);continue;}
|
||||
if(!can(j)){stop.add(j.ch);continue;}n++;
|
||||
// The money first: no fiber is tested for a job the budget cannot pay, and asked again after a test that routed.
|
||||
const first=!!j.dark&&!dk.has(j.l.id);
|
||||
if(!can(j)||first&&(!(yield* dark(j,dk))||!can(j))){stop.add(j.ch);continue;}n++;
|
||||
if(!pay(j)){stop.add(j.ch);continue;}
|
||||
if(j.dark)dark.set(j.l.id,!!j.busy);done.add(j);}
|
||||
if(j.dark)dk.set(j.l.id,!!j.busy);done.add(j);if(done1)done1(j,first);yield;}
|
||||
return [...done];}
|
||||
// The button: the whole plan at once, on the page, every fiber judged as the plan judged it.
|
||||
function bstdDo(J,can,pay){const g=bstdRun(J,can,pay,function*(j,ex){return bstdDarkOk(j.l,ex);});for(;;){const s=g.next();if(s.done)return s.value;}}
|
||||
// What a job costs as it runs (an optics swap is priced again then: see bstdOptJobs).
|
||||
const bstdPrice=j=>j.price?j.price():j.cost;
|
||||
// The sheet's summary and the MCP quote: how much is below the standard, and what bringing it all up costs. The plan is
|
||||
|
|
@ -206,5 +224,14 @@ function bstdQuote(intern){const J=bstdPlan(intern),P=new Set(),Q=new Set(),L=ne
|
|||
return {cost:Math.round(cost),mo:Math.round(mo),pops:P.size,ports:Q.size,links:L.size,n:J.length,held:J.held.map(l=>l.a+'|'+l.b)};}
|
||||
// The optics order lights the standard's fastest optics while this order keeps to a standard that wants them.
|
||||
const bstdFast=()=>!!(S.popStd&&opsHired()&&S.ops.on.std&&bstd().opt==='fast');
|
||||
// The intern's shift: the same plan, every job through the budget and the cash floor at what it costs then, a few at a time.
|
||||
function bstdShift(X){bstdDo(bstdPlan(true),j=>X.can('std',bstdPrice(j),j.mo),j=>X.pay('std',()=>j.go())&&(X.did('std',j.w),true),true,BSTD_MAX);}
|
||||
/* The intern's shift: the same plan, every job through the budget and the cash floor at what it costs then, a few at a
|
||||
time. A fiber goes dark only on the optical order's test (opsDark(): a routing without it, in play in the route
|
||||
worker), within the night's dark swaps that order shares (opsDarkRoom()), and a fiber that fails waits a week. One
|
||||
owner per fiber: a fiber or wave the optical order worked on this shift is left alone, and what this order works on
|
||||
is its own until tomorrow (X.fib: that order and decom leave it alone). The plan is made once a shift, and the shift
|
||||
rests between jobs: a POP decommissioned or a link given up meanwhile is not worked on (the links last: a walk of them,
|
||||
only for a job the budget lets through). */
|
||||
function* bstdShift(X){const mine=j=>(!j.c||!!S.pops[j.c])&&(!j.l||(X.fib.get(j.l.id)||'std')==='std');
|
||||
yield* bstdRun(bstdPlan(true),j=>mine(j)&&X.can('std',bstdPrice(j),j.mo)&&(!j.l||S.links.includes(j.l)),j=>X.pay('std',()=>j.go())&&(X.did('std',j.w),true),
|
||||
function*(j){const l=j.l;if(OPTUP_NO.get(l.id)>S.day||!opsDarkRoom(X))return false;const ok=yield* opsDark(l,X);if(!ok)OPTUP_NO.set(l.id,S.day+OPTUP_WAIT);return ok;},
|
||||
(j,first)=>{if(j.l)X.fib.set(j.l.id,'std');if(first)X.dk.n++;},BSTD_MAX);}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Object.assign(ACT,{
|
|||
// The same jobs, in the same order and through the same gates as the intern's order, while the cash lasts. One
|
||||
// recompute at the end, and one toast: what got done, and what still waits.
|
||||
bstdApply:()=>{if(!S||pzOn()||!S.popStd)return;const J=bstdPlan(false);if(!J.length)return;const c0=S.cash;let n=0;
|
||||
opsQuiet(()=>{n=bstdDo(J,j=>{const c=bstdPrice(j);return c<=0||S.cash>=c;},j=>!!j.go(),false).length;});
|
||||
opsQuiet(()=>{n=bstdDo(J,j=>{const c=bstdPrice(j);return c<=0||S.cash>=c;},j=>!!j.go()).length;});
|
||||
after();const q=bstdQuote(false),left=q.pops+q.ports+q.links;
|
||||
toast((n?trn('bstd.applied',n,{cost:fmt$(c0-S.cash)}):tr('bstd.applied_none'))+(left?' '+trn('bstd.left',left):''),n?'good':'bad');sfx(n?'build':'err');
|
||||
if(bstdShown())bstdModal();},
|
||||
|
|
|
|||
|
|
@ -9,11 +9,15 @@ function opsVal(k,p,v=opsP(k,p)){const P=OPSK[k].p[p];return p==='prov'?(v==='ch
|
|||
// 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)=>`<label class="ops-sel"><span>${lab}</span><select data-chg="${act}" data-args="${esc(JSON.stringify(args))}">${vals.map((v,i)=>`<option value="${i}"${v===cur?' selected':''}>${esc(name(v))}</option>`).join('')}</select></label>`;
|
||||
const opsCapName=(k,v)=>v?tr('common.price_mo',{price:(OPSK[k].mo?'+':'')+fmt$(v)}):tr('ops.no_cap');
|
||||
// The router model and the line system are the build standard's, chosen in its sheet only: in their place, what it says
|
||||
// and the way there. "Keep as is" leaves each order to its own rule: the next model or line system up, when needed.
|
||||
const OPS_BSTD={routers:{k:'g',l:N_('ops.p_model'),f:v=>v==='keep'?tr('ops.model_next'):RG[v].n},optup:{k:'sys',l:N_('ops.p_sys'),f:v=>v==='keep'?tr('ops.sys_next'):DF_SYS[v].n}};
|
||||
function opsFromStd(k){const x=OPS_BSTD[k];return x?`<div class="ops-from"><span>${tr(x.l)}</span><b>${esc(tr('ops.from_bstd',{x:x.f(bstd()[x.k])}))}</b>${pzOn()?'':btn(tr('bstd.edit'),'bstdOpen',{},'ghost sm')}</div>`:'';}
|
||||
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 `<div class="ops-o${on?' on':''}"><div class="ops-h"><span class="ops-i" aria-hidden="true">${d.i}</span><div class="grow"><div class="nm">${tr(d.t)}</div><div class="meta">${tr(d.d)}${k==='caches'?' '+tr('ops.caches_rent',{price:fmt$(CACHE_MO),big:fmt$(CACHE_BIG_MO)}):''}</div></div>
|
||||
<button class="b sm ${on?'green':'ghost'}" data-act="opsToggle" data-args='{"k":"${k}"}' aria-pressed="${on}" aria-label="${esc(tr(d.t))}">${on?tr('common.on'):tr('ops.paused')}</button></div>
|
||||
${k==='std'?`<div class="meta">${tr('bstd.now_line',{list:S.popStd?esc(bstdLine(bstd())):tr('pop_std.none')})}</div><div class="btns">${btn(tr('bstd.edit'),'bstdOpen',{},'ghost sm')}</div>`:''}
|
||||
${on?`<div class="ops-p">${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('')}
|
||||
${on?`<div class="ops-p">${opsFromStd(k)}${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)):''}</div>
|
||||
${sp||am?`<div class="meta">${tr('ops.spent_and_mo',{price:fmt$(sp),mo:opsMo$(am)})}</div>`:''}
|
||||
${k==='ix'&&ppol()!=='open'?`<p class="why">${tr('link_panels.off_while_your_peering_policy_is',{pol:tr(PPOL_N[ppol()])})}</p>`:''}`:''}</div>`;}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ function bstdModal(){if(!S||pzOn())return;const D=bstd(),q=bstdQuote(false),hire
|
|||
let h=`<div data-sheet="bstd" style="display:flex;align-items:center"><div><div class="eyebrow">${tr('ops.ops')}</div><h2 style="font-size:26px">${tr('bstd.title')}</h2></div><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div>
|
||||
<p class="tagline">${tr('bstd.tagline')}</p>`;
|
||||
for(const [g,lab] of BSTD_GRP)h+=`<section><h3>${tr(lab)}</h3><div class="ops-p">${BSTD.filter(x=>x.grp===g).map(x=>opsSel(tr(x.l),'bstdSet',{k:x.k},bstdOpts(x.k),D[x.k],v=>bstdVal(x.k,v))).join('')}</div>
|
||||
<p class="note">${g==='pop'?tr('bstd.new_pops_note'):g==='port'?tr('bstd.port_note'):tr('bstd.fiber_note')}</p></section>`;
|
||||
<p class="note">${g==='pop'?tr('bstd.new_pops_note'):g==='port'?tr('bstd.port_note'):tr('bstd.fiber_note_two')}</p></section>`;
|
||||
// What is below it today, and what bringing it all up costs: a quote, nothing changes until the button. A fiber whose
|
||||
// line system has to wait is below it too, but not on the bill.
|
||||
const n={pop:q.pops,port:q.ports,fiber:q.links},w=q.held.length;
|
||||
|
|
@ -30,7 +30,7 @@ function bstdModal(){if(!S||pzOn())return;const D=bstd(),q=bstdQuote(false),hire
|
|||
+(w?`<p class="meta">${trn('bstd.held',w)}</p>`:'')
|
||||
:`<p class="meta">${S.popStd?tr('bstd.all_up'):tr('bstd.none_set')}</p>`}</section>`;
|
||||
// The intern keeps it there: the order's switch and budget, or a word on hiring one.
|
||||
h+=`<section><h3>${tr('ops.o_std')}</h3>${hired?`<div class="ops-o${on?' on':''}"><div class="ops-h"><span class="ops-i" aria-hidden="true">${INTERNS[S.ops.intern].i}</span><div class="grow"><div class="nm">${esc(tr('bstd.intern_keeps',{name:opsName()}))}</div><div class="meta">${tr('ops.o_std_d')}</div></div>
|
||||
h+=`<section><h3>${tr('ops.o_std')}</h3>${hired?`<div class="ops-o${on?' on':''}"><div class="ops-h"><span class="ops-i" aria-hidden="true">${INTERNS[S.ops.intern].i}</span><div class="grow"><div class="nm">${esc(tr('bstd.intern_keeps',{name:opsName()}))}</div><div class="meta">${tr('ops.o_std_around_d')}</div></div>
|
||||
<button class="b sm ${on?'green':'ghost'}" data-act="opsToggle" data-args='{"k":"std"}' aria-pressed="${on}" aria-label="${esc(tr('ops.o_std'))}">${on?tr('common.on'):tr('ops.paused')}</button></div>
|
||||
${on?`<div class="ops-p">${opsSel(tr('ops.budget'),'opsCap',{k:'std'},opsCaps('std'),opsCap('std'),v=>opsCapName('std',v))}</div>`:''}</div>`
|
||||
:`<p class="meta">${tr('bstd.hire_note')}</p><div class="btns">${btn(tr('ops.hire_an_intern'),'opsOpen',{},'ghost sm',!opsCanHire()||!rule('clock'))}</div>`}</section>`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue