vibes
This commit is contained in:
@@ -71,6 +71,26 @@ export function fleetView(ctx) {
|
||||
}
|
||||
}
|
||||
|
||||
async function scrap(ship) {
|
||||
const dlg = customDialog({
|
||||
title: `SCRAP SHIP #${ship.id}`,
|
||||
content: [
|
||||
h('p', null, 'THE SHIP IS BROKEN UP ON THE NEXT DAILY RUN AND LEAVES THE BELT. A NEW SHIP WITH NO PROGRAM APPEARS ON YOUR DOCK.'),
|
||||
h('p', { class: 'warn' }, 'ITS FUEL AND PROGRAM ARE LOST, AND CONTAINERS IT TOWS ARE LEFT ADRIFT. THIS CANNOT BE UNDONE.'),
|
||||
],
|
||||
confirmText: 'SCRAP',
|
||||
danger: true,
|
||||
});
|
||||
if (!(await dlg.result)) return;
|
||||
try {
|
||||
await api.scrap(ship.id);
|
||||
toast(`SHIP #${ship.id} WILL BE SCRAPPED ON THE NEXT DAILY RUN. A NEW SHIP JOINS YOUR DOCK THEN.`);
|
||||
await ctx.refresh();
|
||||
} catch (e) {
|
||||
toast(`SCRAP FAILED: ${e.message}`, 'err');
|
||||
}
|
||||
}
|
||||
|
||||
const btn = (label, onclick, opts = {}) =>
|
||||
h('button', { class: `btn small ${opts.cls ?? ''}`, type: 'button', onclick, disabled: opts.disabled, title: opts.title }, label);
|
||||
|
||||
@@ -81,6 +101,7 @@ export function fleetView(ctx) {
|
||||
out.push(btn('LAUNCH', () => launch(s), { cls: 'primary', title: 'Choose a code slot and launch on the next daily run' }));
|
||||
}
|
||||
if (s.status === 'launching' || s.status === 'active') out.push(btn('UPLINK', () => ctx.selectShip(s.id, 'uplink')));
|
||||
if (s.status === 'active') out.push(btn('SCRAP', () => scrap(s), { cls: 'danger', title: 'Break the ship up: a new ship replaces it on your dock' }));
|
||||
if (s.downlink_day >= 0) out.push(btn('DOWNLINK', () => ctx.selectShip(s.id, 'downlink')));
|
||||
return out;
|
||||
}
|
||||
@@ -117,7 +138,7 @@ export function fleetView(ctx) {
|
||||
step('3', 'LAUNCH', 'the ship and choose which slot it flies. It enters the belt on the next daily run and the program is fixed for good.'),
|
||||
step('4', 'TALK', 'to it once a day: 1 KB up, 1 KB down, over the wormhole link.'),
|
||||
),
|
||||
h('p', { class: 'hint pad' }, 'The belt runs once a day. Ore delivered to the station earns credits.'),
|
||||
h('p', { class: 'hint pad' }, 'The belt runs once a day. Ore is towed to the station in containers. A container left there is taken, and paid for.'),
|
||||
h('p', { class: 'pad' }, h('a', { class: 'btn small', href: '/manual.pdf', target: '_blank', rel: 'noopener' }, 'OPEN THE HC-33 MANUAL (PDF)')),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user