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.
This commit is contained in:
parent
9d74873edb
commit
2243280aff
17 changed files with 510 additions and 21 deletions
|
|
@ -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.day<life);
|
||||
if(!c.bk&&pieBaked(id)){c.bk=1;pieFounder(N_('pie.fp_baked'),{c:id});toast(tr('pie.t_baked_all',{crust:tr(CRUSTS[id].n)}),'goal');piePromise();}}
|
||||
{const F=P.founder;if(F.due.length&&F.due[0]<=d){F.due.shift();F.broken++;pieFounder(N_('pie.fp_slip'),{n:pieYear(d+360)});}}
|
||||
{const F=P.founder;if(F.due.length&&F.due[0]<=d){const x=F.due.shift();F.broken++;if(F.mars&&x===F.mars)pieMarsSlip(d);else pieFounder(N_('pie.fp_slip'),{n:pieYear(d+360)});}}
|
||||
// Running costs are billed with the rest each day (compute()); the book keeps the tally, and the sandbox its shame.
|
||||
{const mo=pieMo()/30;if(mo){if(pieSand())P.book.wouldHave+=mo;else P.book.spent+=mo;}}
|
||||
pieSpatDay(d);for(const f of PIE_ON.day)f(d);}
|
||||
|
|
@ -142,7 +142,7 @@ function pieSanitize(s){s.pieV=int(s.pieV,0,1,0);pieEximFix(s);const p=s.pie,ob=
|
|||
for(const L of o.q)o.crusts[L.cr].queued+=L.n;
|
||||
if(ob(p.founder)){const F=p.founder;o.founder.promises=n(F.promises,1e6);o.founder.broken=n(F.broken,o.founder.promises);
|
||||
o.founder.posts=(Array.isArray(F.posts)?F.posts:[]).filter(x=>ob(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);
|
||||
|
|
|
|||
68
src/game/60-features/99-pie-jitters.js
Normal file
68
src/game/60-features/99-pie-jitters.js
Normal file
|
|
@ -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).length<PIE_SPAT_MAX){const cs=[...new Set([...pieDishCc(),...Object.keys(P.lic).filter(pieLicOk)])].sort(),o=cs.length?Math.floor(Math.random()*cs.length):0;
|
||||
for(const id of ['lic'])for(let i=0;i<cs.length;i++)if(!P.spat[id]&&pieSpatStart(id,cs[(o+i)%cs.length]))return tr('pie_ant.reg');}
|
||||
return tr('pie_ant.reg_none');}},
|
||||
leak:{w:2,j:0.3,ok:()=>true,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(`<b>😱 ${tr('pie_ant.gasp')}</b><br>${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(`<b>😱 ${tr('pie_ant.gasp')}</b><br>${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=`<p class="meta pie-jit">${tr('pie_ant.jit_calm')}</p>`;
|
||||
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=`<p class="meta pie-jit">${trn('pie_ant.jit_line',Math.ceil(j*PIE_JIT_DAYS),{lvl:l})}</p><div class="bar ${j>=0.6?'bad':'warn'} pie-jit-bar"><i style="width:${Math.round(j*100)}%"></i></div>`;}
|
||||
if(pieBillOff())h+=`<p class="note pie-jit">${tr('pie_ant.bill_paused',{d:dateStr(F.bill),kid:esc(K?K.n:'')})}</p>`;
|
||||
return h;}
|
||||
|
|
@ -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<PIE_OPEN_DAYS)on=true;}return on;}
|
||||
// Orbit has its own sales desk, so the ground's offers keep their odds: about one call every three days, two on the table at most.
|
||||
PIE_ON.day.push(()=>{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_OFFER_RATE))pieSpawn(pick(t));});
|
||||
PIE_ON.day.push(()=>{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_OFFER_RATE*pieOfferMul()))pieSpawn(pick(t));});
|
||||
|
|
|
|||
|
|
@ -109,7 +109,9 @@ function pieMoney(X,R2,V){let rev=0;const sf={},flows=[];
|
|||
for(const o of X.bhNo)bh.push({city:o.city,land:null,g:0,cap:0,why:o.why});
|
||||
// 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)};
|
||||
// The billing database is down (the Founder's antics, 99-pie-jitters.js): the sky carries on, nobody is invoiced.
|
||||
const billOff=pieBillOff()?rev:0;if(billOff)rev=0;
|
||||
V.orbit=rev;R2.pie={rev,billOff,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.
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pi
|
|||
:`<p class="note pie-nudge">${tr('pie.pace_pad_none')}</p>`;}
|
||||
return x;})()}
|
||||
<div class="ops-p">${Object.keys(ROCKETS).filter(pieRkOk).map(rk=>{const q=pieQuote(rk,id,{ins:!!UI.pieIns,las:!!UI.pieLas});return btn(`${tr(ROCKETS[rk].n)} <small>${q.ok?(q.test?tr('pie.test_flight')+' · ':'')+fmt$(q.cost):esc(q.why)}</small>`,'pieLaunch',{rk,cr:id},'ghost sm',!q.ok);}).join('')}</div></div>`;}).join('');
|
||||
h+=`<div class="ops-p">${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')}</div>`;
|
||||
h+=`<div class="ops-p">${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')}</div>`;
|
||||
h+=`<p class="meta">${tr('pie.stock_line',{n:Math.floor(P.stock)})}</p>`;
|
||||
if(P.q.length)h+=`<h3 style="font-size:15px;margin:10px 0 4px">${tr('pie.queue')}</h3>`+P.q.slice().sort((a,b)=>a.day-b.day).map(L=>`<div class="kv"><span>${esc(tr(ROCKETS[L.rk].n))} → ${esc(tr(CRUSTS[L.cr].n))}</span><b>${L.test?tr('pie.test_flight'):L.n} · ${esc(CITY[L.pad].name)} · ${dateStr(L.day)}</b></div>`).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=>`<div class="ops-rep"><div class="eyebrow">${esc(dateStr(p.d))}</div><div>${esc(pieFpText(p))}</div></div>`,top=F.posts.slice(0,PIE_FEED_TOP),more=F.posts.slice(PIE_FEED_TOP);
|
||||
return `<div class="pie-feed"><h3>${tr('pie.founder_feed')}</h3><div class="kv"><span>${tr('pie.promises')}</span><b>${tr('pie.promises_line',{n:F.promises,b:F.broken})}</b></div>`
|
||||
return `<div class="pie-feed"><h3>${tr('pie.founder_feed')}</h3><div class="kv"><span>${tr('pie.promises')}</span><b>${tr('pie.promises_line',{n:F.promises,b:F.broken})}</b></div>`+pieJitHtml(F)
|
||||
+(top.length?top.map(post).join(''):`<p class="meta">${tr('pie.feed_empty')}</p>`)
|
||||
+(more.length?`<details><summary>${trn('pie.feed_older',more.length)}</summary>${more.map(post).join('')}</details>`:'')+'</div>';}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue