Name box in the New world panel (t10)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 01:19:25 -04:00
co-authored by Claude Opus 5.5
parent 40d9647b73
commit edd9cdf940
9 changed files with 52 additions and 12 deletions
+9 -2
View File
@@ -97,11 +97,18 @@ function boot(hotData) {
buildTitleCells(); drawTitle();
$('nw-seed').value = String(Math.floor(Math.random() * 900000) + 100000);
$('wallet').onclick = () => { playSfx('ui'); openNotebook('Market'); };
$('btn-new').onclick = () => { auInit(); playSfx('ui'); $('newworld').hidden = !$('newworld').hidden; if (!$('newworld').hidden) $('btn-generate').focus(); };
$('btn-new').onclick = async () => {
auInit(); playSfx('ui'); $('newworld').hidden = !$('newworld').hidden;
if ($('newworld').hidden) return;
try { $('nw-name').value = `World ${(await listWorlds()).length + 1}`; }
catch (e) { $('nw-name').value = 'World 1'; }
$('nw-name').focus(); $('nw-name').select();
};
for (const id of ['nw-name', 'nw-seed']) $(id).onkeydown = e => { if (e.key === 'Enter') $('btn-generate').click(); };
$('btn-generate').onclick = () => {
const seed = parseInt(String($('nw-seed').value).replace(/\D/g, ''), 10) || Math.floor(Math.random() * 1e6);
const [w, h] = $('nw-size').value.split('x').map(Number);
startNewWorld(seed, w, h);
startNewWorld(seed, w, h, $('nw-name').value);
};
$('btn-continue').onclick = async () => { auInit(); playSfx('ui'); const sv = await newestSave(); if (sv) startFromSave(sv); else toast('No saved world found.'); };
$('btn-title-settings').onclick = () => { auInit(); playSfx('ui'); openSettings('Display'); };