Island Wi-Fi for 18 groups of outer islands, by satellite and spur cable (#83)
Each zone (Vanua Levu & Taveuni off Suva, the Out Islands off Nassau, and 16 more) is a pool of island homes at your POP in its city: no node and no link on the map, its Gbps join the city's demand. Rent backhaul at the city's teleport (about 35% sign up over GEO, 75% over MEO, 90% over Starblink from a gateway there) or, from level 3, lay a spur cable and everyone may sign up. The first order brings the island kit. Islanders pay island prices, their homes are IPv6-only in the NAT64 pool, and investors on a revenue share take their cut. A spur can be cut for weeks (failure 'wspur', chaos only): a satellite kept beside it carries the islands. Zones are off in puzzles, the Architect, scenarios and below level 2. The satellite geometry works on points now (satSeesAt, satPairAt, satKmAt; the city functions wrap them, with the same answers). Starblink serves a zone only from a gateway in its own city (16 of 18; a gateway anywhere in reach would serve the same 16), with its storm and rival rule; Nunavut and Southeast Alaska stay on GEO. Rules W6 and F12.
This commit is contained in:
parent
7967a29083
commit
6f0c080875
44 changed files with 1087 additions and 65 deletions
63
src/game/93-ui/73-wisp-panels.js
Normal file
63
src/game/93-ui/73-wisp-panels.js
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
// Island Wi-Fi on screen (#83): a city's fact chip and teaser, the zones in its Customers tab, their rows at the teleport.
|
||||
// Rows are laid out as the teleport section's (name, meta, a bar, small buttons that wrap), so they fit a phone at 360 px.
|
||||
const wispFact=c=>{if(!wispOn())return '';const n=wispAt(c).length;return n?`<span class="fact">🏝️ ${trn('wisp.n_zones',n)}</span>`:'';};
|
||||
// A city without a POP of yours: what its islands are, and that a POP comes first.
|
||||
function wispNoPop(c){if(!wispOn()||S.pops[c])return '';const zs=wispAt(c);if(!zs.length)return '';
|
||||
return `<section><h3>🏝️ ${tr('wisp.section')}</h3><p class="lead">${tr('wisp.no_pop',{list:zs.map(z=>`<b>${esc(WISP[z].n)}</b> (${tr('wisp.pool',{g:fmtG(wispPool(z))})})`).join(', ')})}</p></section>`;}
|
||||
// A zone's status: what carries it today, or why nothing does.
|
||||
function wispStatus(z,Z){if(!Z)return {t:tr('wisp.st_none'),k:'st'};if(wispLit(Z))return wispCut(z)?{t:tr('wisp.st_cut'),k:'restrictive'}:{t:tr('wisp.st_spur'),k:'open'};
|
||||
const o=Z.sat;if(o&&!(o.ready>S.day))return {t:SAT_ORB[wispOrb(o)].n,k:''};return o||Z.sp?{t:tr('wisp.st_soon'),k:'st'}:{t:tr('wisp.st_none'),k:'st'};}
|
||||
// In a POP's Customers tab, after Home broadband: one row per zone, one of them open at a time (UI.wz).
|
||||
function wispHtml(c){if(!wispOn()||!S.pops[c])return '';const zs=wispAt(c);if(!zs.length)return '';
|
||||
return `<section><h3>🏝️ ${tr('wisp.section')}</h3><p class="lead">${tr('wisp.lead',{rate:fmt$(wispRate(zs[0]))})}</p>${zs.map(wispRow).join('')}</section>`;}
|
||||
function wispRow(z){const W=WISP[z],Z=wispZ(z),r=R.wisp&&R.wisp[z],P=wispPool(z),st=wispStatus(z,Z),open=UI.wz===z,d=Z?Z.d:0,sf=r?r.sf:0;
|
||||
let h=`<div class="row"><div class="grow"><div class="nm">${esc(W.n)} <span class="tag ${st.k}">${st.t}</span></div><div class="meta">${tr('wisp.pool',{g:fmtG(P)})}${Z?' · '+tr('pie_gov.served',{p:pct(sf)}):''}</div>${Z?`<div class="bar me"><i style="width:${Math.min(100,d/P*100)}%"></i></div>`:''}</div>${btn(open?tr('common.close'):tr('common.open'),'wispOpen',{z},'ghost sm')}</div>`;
|
||||
return open?h+wispOpenHtml(z,Z,r):h;}
|
||||
// The open zone: its homes and money, its backhaul (the circuit, the birds to order on), the spur, closing it.
|
||||
function wispOpenHtml(z,Z,r){const K=Z?wispK(z,Z):0,k=Z?wispLink(z,Z):null;let h='';
|
||||
if(Z){const sf=r?r.sf:0,cl=sf<0.9?'var(--tx-red,var(--bad))':'var(--eye)';
|
||||
h+=`<div class="kv"><span>${tr('wisp.homes_online')}</span><b>${tr('city_panel.a_of_b',{a:fmtG(Z.d),b:fmtG(K)})}</b></div>
|
||||
<div class="kv"><span>${tr('wisp.served')}</span><b style="color:${cl}">${pct(sf)}</b></div>
|
||||
<div class="kv"><span>${tr('common.revenue')}</span><b>${tr('common.price_mo',{price:fmt$(r?r.d*r.sf*wispRate(z):0)})}</b></div>
|
||||
<div class="kv"><span>${tr('wisp.upkeep')}</span><b>${tr('common.price_mo',{price:fmt$(wispUpMo(z)+(wispLit(Z)?wispSpurMo(z):0))})}</b></div>
|
||||
${k&&r&&r.d>=k.g*0.98?`<p class="why">${tr('wisp.full')}</p>`:''}`;}
|
||||
h+=`<p class="note">${tr('wisp.take',{geo:pct(SAT_ORB.geo.wisp),meo:pct(SAT_ORB.meo.wisp),leo:pct(SAT_ORB.leo.wisp)})}</p>${ip4On()?`<p class="note">${tr('wisp.ipv6')}</p>`:''}`;
|
||||
return `<div class="wisp">${h}${wispBackhaul(z,Z,k)}${wispSpurHtml(z,Z)}${Z?`<div class="btns">${btn(UI.confirm==='wz:'+z?tr('satellites.really_close_it'):tr('wisp.close'),'wispRm',{z},'ghost sm')}</div>`:''}</div>`;}
|
||||
// Backhaul: the circuit (and a move under way), then a row per bird that sees both the city and the islands.
|
||||
function wispBackhaul(z,Z,k){const W=WISP[z],c=W.c,C=CITY[c].name,t=teleOf(c);
|
||||
let h=`<h4 class="sub4">${tr('wisp.backhaul')}</h4>`;
|
||||
if(satOnly(c))h+=`<p class="why">${tr('wisp.double_hop',{city:C})}</p>`;
|
||||
const o=Z&&Z.sat,run=(x,now)=>{const O=SAT_ORB[wispOrb(x)],P=SAT_PROV[SATS[x.bird].p],car=now&&k===x&&R.wisp&&R.wisp[z]?R.wisp[z].car:0,u=x.g?car/x.g:0,sb=now&&k&&k.sp;
|
||||
return `<div class="row">${satLogo(P)}<div class="grow"><div class="nm">${esc(SATS[x.bird].n)} <span class="tag">${O.n}</span>${sb?` <span class="tag st">${tr('common.standby')}</span>`:''}</div><div class="meta">${fmtCap(x.g)} · ${tr('satellites.ms_round_trip',{ms:Math.round(2*wispMs(z,x.bird))})} · ${tr('common.price_mo',{price:fmt$(x.mo)})}${x.ready>S.day?' · '+tr('city_panel.ready_in_n_d',{n:x.ready-S.day}):''}</div>
|
||||
${now&&wispOrb(x)==='leo'&&leoStorm()?`<p class="why">${trn('satellites.leo_safe_mode_n_days',S.ev.sky-S.day)}</p>`:''}${now?`<div class="bar ${barCls(u)}"><i style="width:${Math.min(100,u*100)}%"></i></div>`:''}</div></div>`;};
|
||||
if(o){const G=SAT_ORB[wispOrb(o)].g;h+=run(o,true)+`<div class="btns">${G.filter(g=>g!==o.g).map(g=>btn(`${g>o.g?tr('satellites.grow_to',{cap:fmtCap(g)}):tr('satellites.shrink_to',{cap:fmtCap(g)})} <small>${tr('common.price_mo',{price:fmt$(wispSatMo(o.bird,g))})}</small>`,'wispSatSize',{z,g},'sm',g>o.g&&S.cash<wispSatMo(o.bird,g))).join('')}${btn(UI.confirm==='wsat:'+z?tr('common.really_cancel'):tr('common.cancel_circuit'),'wispSatRm',{z},'ghost sm')}</div>`;}
|
||||
if(Z&&Z.nxt)h+=run(Z.nxt,false);
|
||||
if(!t){h+=`<p class="note">${tr('wisp.no_teleport',{city:C})}</p><div class="btns">${btn(tr('satellites.build_a_teleport_cost_mo',{cost:fmt$(TPORT_COST),mo:fmt$(TPORT_MO)}),'teleBuild',{city:c},'sm',S.cash<TPORT_COST||!!teleWhy(c))}</div>`;return h;}
|
||||
if(Z&&Z.nxt)return h;
|
||||
h+=o?`<p class="note">${tr('wisp.move_note')}</p>`:Z?'':`<p class="note">${tr('wisp.kit',{cost:fmt$(wispKit(z))})}</p>`;
|
||||
const kit=Z?0:wispKit(z);
|
||||
for(const id of wispBirds(z)){if(o&&o.bird===id)continue;const B=SATS[id],O=SAT_ORB[B.orb],P=SAT_PROV[B.p];if(lvl()<O.lv)continue;
|
||||
// The teleport's own upgrade, where the bird needs one: tracking antennas for MEO, a Starblink gateway for LEO (and why
|
||||
// that cannot go up, when it cannot).
|
||||
const trk=B.orb==='meo'&&t<2,gw=B.orb==='leo'&&!leoGw(c),why=(trk?trkWhy(c):gw?leoGwWhy(c):'')||wispSatWhy(z,id);
|
||||
const up=trk?btn(tr('satellites.add_tracking_antennas_cost_mo',{cost:fmt$(TRK_COST),mo:fmt$(TRK_MO)}),'teleTrk',{city:c},'sm',S.cash<TRK_COST||!!trkWhy(c))
|
||||
:gw?btn(tr('satellites.host_leo_gateway_cost_mo',{cost:fmt$(LEO_GW_COST),mo:fmt$(LEO_GW_MO)}),'teleLeo',{city:c},'sm',S.cash<LEO_GW_COST||!!leoGwWhy(c)):'';
|
||||
h+=`<div class="row">${satLogo(P)}<div class="grow"><div class="nm">${esc(B.n)} <span class="tag">${O.n}</span></div><div class="meta">${esc(P.n)} · ${tr('satellites.ms_round_trip',{ms:Math.round(2*wispMs(z,id))})} · ${trn('satellites.up_in_n_days',leadDays(O.days))}</div>${why?`<div class="why">${esc(why)}</div>`:''}
|
||||
<div class="btns">${up||O.g.map(g=>btn(`${fmtCap(g)} <small>${tr('common.price_mo',{price:fmt$(wispSatMo(id,g))})}</small>`,'wispSat',{z,bird:id,g},'sm',!!why||S.cash<wispSatMo(id,g)+kit)).join('')}</div></div></div>`;}
|
||||
return h;}
|
||||
// The spur: what it costs and takes, laying it, lit, or cut (with the incident's own rush button).
|
||||
function wispSpurHtml(z,Z){const W=WISP[z],c=W.c;let h=`<h4 class="sub4">${tr('wisp.spur')}</h4>`;
|
||||
if(!W.km)return h+`<p class="note">${tr('wisp.spur_none')}</p>`;
|
||||
const sp=Z&&Z.sp;
|
||||
if(!sp){const why=wispSpurWhy(z),cost=wispSpurCost(z)+(Z?0:wispKit(z));
|
||||
return h+`<p class="lead">${tr('wisp.spur_lead',{km:W.km.toLocaleString(),city:CITY[c].name})}</p><div class="meta">${tr('common.price_mo',{price:fmt$(wispSpurMo(z))})} · ${trn('satellites.up_in_n_days',wispSpurDays(z))}</div>
|
||||
${why?`<div class="why">${esc(why)}</div>`:''}${lvl()<WISP_SPUR_LV?'':`<div class="btns">${btn(tr('wisp.lay_spur',{cost:fmt$(cost)}),'wispSpur',{z},'pink sm',!!why||S.cash<cost)}</div>`}`;}
|
||||
if(sp.ready>S.day){const tot=Math.max(1,sp.ready-sp.day),done=clamp((S.day-sp.day)/tot,0,1);
|
||||
return h+`<div class="kv"><span>${tr('wisp.spur_laying')}</span><b>${tr('common.n_days_left',{n:sp.ready-S.day})}</b></div><div class="bar me"><i style="width:${done*100}%"></i></div>`;}
|
||||
const cut=wispCut(z);if(!cut)return h+`<div class="kv"><span>${tr('wisp.spur_lit',{cap:fmtCap(WISP_SPUR_G)})}</span><b>${W.km.toLocaleString()} km</b></div>`;
|
||||
const i=S.inc.filter(x=>x.type==='wspur'&&x.z===z).sort((a,b)=>b.until-a.until)[0],up=!!Z.sat&&!(Z.sat.ready>S.day);
|
||||
return h+`<p class="why">${trn('wisp.spur_cut',cut-S.day)}</p>${i&&i.cost?`<div class="btns">${btn(`${esc(i.fix||tr('common.rush_repair'))} ${fmt$(i.cost)}`,'fixInc',{id:i.id},'red sm',S.cash<i.cost)}</div>`:''}${up?'':`<p class="note">${tr('wisp.spur_trap')}</p>`}`;}
|
||||
// In the teleport section: the zones' circuits from here, each opening its zone.
|
||||
function wispTeleRows(c){const zs=wispSats(c);if(!zs.length)return '';
|
||||
return `<div class="meta">${tr('wisp.tele_reaches')}</div>`+zs.map(z=>{const Z=wispZ(z),o=Z.sat||Z.nxt,k=wispLink(z,Z),car=R.wisp&&R.wisp[z]&&k===Z.sat?R.wisp[z].car:0,u=Z.sat&&Z.sat.g?car/Z.sat.g:0;
|
||||
return `<div class="row"><div class="grow"><div class="nm">🏝️ ${esc(WISP[z].n)}${k&&k.sp&&Z.sat?' <span class="tag st">'+tr('common.standby')+'</span>':''}</div><div class="meta">${fmtCap(o.g)} · ${esc(SATS[o.bird].n)}${o.ready>S.day?' · '+tr('city_panel.ready_in_n_d',{n:o.ready-S.day}):''} · ${tr('common.price_mo',{price:fmt$(o.mo)})}</div><div class="bar ${barCls(u)}"><i style="width:${Math.min(100,u*100)}%"></i></div></div>${btn(tr('common.open'),'wispOpen',{z},'ghost sm')}</div>`;}).join('');}
|
||||
Loading…
Add table
Add a link
Reference in a new issue