${tr('hud_and_panels.your_network_operations_center_every')}
`; h+=opsCard()+mkCard()+ddosPanel(); // Incidents come first, the ones you can fix with one click at the top (#63): no scrolling past hot ports to replace an optic. - for(const i of S.inc.filter(i=>i.type!=='ddos').sort((a,b)=>(b.cost?1:0)-(a.cost?1:0)||(b.impact||0)-(a.impact||0))){h+=`🚢 ${esc(t)}
`:'';}; +// Building your own subsea cable: survey and factory first, then the lay ship at sea; a second one can be booked. +function layPanel(l){const d=S.day,st=layStart(l),q=layQuote(l),km=Math.round(layDone(l,d)*l.km),two=l.ship2?tr('cable_ships.ship_and_ship',{a:layName(l),b:layName(l,1)}):layName(l); + let h=d${tr('link_panels.only_a_few_dozen_cable_ships')}
`; + else if(!l.ship2&&d${tr('link_panels.only_a_few_dozen_cable_ships')}
`:''}`:''}${tr('link_panels.you_can_pre_install_optics_now')}
`;} - else if(inc&&linkDown(l))h+=`${esc(inc.msg)}
${inc.cost?btn(`${esc(inc.fix||tr('common.rush_repair'))} ${fmt$(inc.cost)}`,'fixInc',{id:inc.id},'red',S.cash${tr('link_panels.you_can_pre_install_optics_now')}
`;} + else if(inc&&linkDown(l))h+=`${esc(inc.msg)}
${shipNote(inc)}${inc.cost?btn(`${esc(inc.fix||tr('common.rush_repair'))} ${fmt$(inc.cost)}`,'fixInc',{id:inc.id},'red',S.cash${tr('link_panels.this_fiber_is_dark_add_optics')}
`:''}${inc?esc(inc.msg):''} ${tr('link_panels.back_in_n_days',{n:l.cut-S.day})}
${inc&&inc.cost?btn(`${esc(inc.fix||tr('common.rush_repair'))} ${fmt$(inc.cost)}`,'fixInc',{id:inc.id},'red',S.cash${inc?esc(inc.msg):''} ${inc&&shipSea(inc)?'':tr('link_panels.back_in_n_days',{n:l.cut-S.day})}
${shipNote(inc)}${inc&&inc.cost?btn(`${esc(inc.fix||tr('common.rush_repair'))} ${fmt$(inc.cost)}`,'fixInc',{id:inc.id},'red',S.cash${tr('link_panels.congested_upgrade_it_or_add_a')}
`:''} diff --git a/src/game/96-map/60-draw.js b/src/game/96-map/60-draw.js index 67b4452..067aafb 100644 --- a/src/game/96-map/60-draw.js +++ b/src/game/96-map/60-draw.js @@ -94,6 +94,8 @@ function drawFrame(now){ if(ly===null&&(prio(v)===0||(prio(v)===1&&(v.C.id===S.home||UI.hover===v.C.id)))){ly=below;const r={x:v.sx-tw/2,y:below-10,w:tw,h:21};rects.push(r);labs.push(r);} v.ly=ly;} if(pzOn()){for(const v of vis.slice().reverse())pzDrawCity(v,csc,now);}else for(const v of vis.slice().reverse())drawCity(v.C,v.sx,v.sy,csc,now,v.ly,v.dem); + // cable ships at sea (88-cable-ships.js), over the city labels so a ship leaving port stays in sight + drawShips(ks,now); // Architect runs: what the tubes between two cities are (one trench, or separate paths), above the cities. for(const [x,y,t,one] of AR_PILLS){ctx.font='800 11px "Baloo 2", sans-serif';const tw=ctx.measureText(t).width+12;ctx.fillStyle=one?'#FFE3C2':'#DDF7E7';ctx.strokeStyle=one?'#FF8A3D':'#16A866';ctx.lineWidth=2;rr(x-tw/2,y-9,tw,17,8);ctx.fill();ctx.stroke();ctx.fillStyle='#1E2640';ctx.textAlign='center';ctx.textBaseline='middle';ctx.fillText(t,x,y+1);} // the chaos monkey (woken here after a reload, wherever it last snipped) diff --git a/src/game/96-map/88-cable-ships.js b/src/game/96-map/88-cable-ships.js new file mode 100644 index 0000000..7a6a6fa --- /dev/null +++ b/src/game/96-map/88-cable-ships.js @@ -0,0 +1,49 @@ +/* Cable ships on the map (85-incidents/50-cable-ships.js): club ships at anchor off their ports, sailing out to a cut, + splicing on site and sailing home; lay ships along a cable you are building. Where they are comes from S.fleet and + the clock, so nothing here is saved; their routes are worked out once per voyage and kept in SHIP_PATH. */ +const SHIP_PATH=new Map(),SHIP_HITS=[]; +// Off the port: the first point of a cable leaving it, so a ship rides at anchor at sea and not in town. +function shipHomePt(s){const k='h:'+s.id;let p=SHIP_PATH.get(k);if(p)return p;const C=CITY[s.home];p=[C.x,C.y]; + for(const cp of CABLE_PAIRS){if(cp.a===s.home){p=cp.pts[1].slice();break;}if(cp.b===s.home){p=cp.pts[cp.pts.length-2].slice();break;}} + const n=SHIPS.filter(x=>x.home===s.home).indexOf(s);p[0]+=n*7;p[1]+=n*4;SHIP_PATH.set(k,p);return p;} +// Out along the cable routes to the cable's end, then along the cable to the fault. +function shipRoute(s,f){const key=s.id+'|'+f.dep+'|'+f.link+'|'+f.e+'|'+f.t;let r=SHIP_PATH.get(key);if(r)return r;if(SHIP_PATH.size>300)SHIP_PATH.clear(); + const pts=[shipHomePt(s).slice()],push=q=>{const b=pts[pts.length-1];pts.push([q[0]+W*Math.round((b[0]-q[0])/W),q[1]]);},l=S.links.find(x=>x.id===f.link); + if(l){const end=f.e==='b'?l.b:l.a,D=shipDij({[end]:0});let c=s.home; + for(let n=0;n<999&&c!==end;n++){const p=D.prev.get(c);if(!p)break;const cp=CABLE_PAIRS[p.e.i],q=cp.a===c?cp.pts:cp.pts.slice().reverse();for(let j=1;j