Fix world entry readiness and mobile startup test

This commit is contained in:
dingo
2026-09-10 11:09:51 -04:00
parent 1bd5d487e2
commit c86f4c1f24
3 changed files with 12 additions and 3 deletions
+3 -1
View File
@@ -277,10 +277,10 @@ async function boot() {
travelButton.onclick=()=>{if(!snapshot)return;input.clear();walkTo=undefined;pendingAction=undefined;send('move');void showTravel({worldId:config.worldId,route:config.kind==='hub'?'hub':snapshot.world.phase==='won'?'portal':'escape',beforeTravel:()=>{requestedClose=true;},afterTravel:departed=>{requestedClose=departed;}});};
$<HTMLInputElement>('zoom').value = String(view.distance);
view.addChunks(chunks); view.updateEntities(chunks.flatMap(c => c.resources));
$('connection-status').textContent = 'World online';
visible('dev-boss', config.development);
let me: { character: Character | null; active?: { worldId: string; state: string; name: string } } | undefined;
try { me = await api('/api/me'); } catch { if (config.development) { await api('/auth/dev', {}); me = await api('/api/me'); } }
$('connection-status').textContent = 'World online';
if (!me && !config.development) { visible('join-form', false); visible('login', true); }
else if (me?.character) {
$<HTMLDialogElement>('arrival').close();
@@ -336,5 +336,7 @@ async function boot() {
else if (hit.point) { selection(); walkTo = hit.point; pendingAction = undefined; }
});
Object.defineProperty(window, '__aeternalis', { value: { diagnostics: () => view.diagnostics(), get snapshot() { return snapshot; }, get walkTo() { return walkTo; }, get pendingAction() { return pendingAction; }, get keys() { return input.keys; } }, configurable: true });
// Authentication and all input handlers must be ready before character creation.
$<HTMLButtonElement>('join').disabled = !me || !!me.character || !!me.active || config.kind === 'hub';
}
boot().catch(error => { console.error(error); $('arrival-error').textContent = `Unable to enter the world: ${error.message}`; $('connection-status').textContent = 'Unavailable'; });