New worlds get generated camp names like new claims (t3)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+9
-3
@@ -98,16 +98,22 @@ function boot(hotData) {
|
||||
buildTitleCells(); drawTitle();
|
||||
$('nw-seed').value = String(Math.floor(Math.random() * 900000) + 100000);
|
||||
$('wallet').onclick = () => { playSfx('ui'); openNotebook('Market'); };
|
||||
let autoName = '', worldNames = [];
|
||||
const newWorldSeed = () => parseInt(String($('nw-seed').value).replace(/\D/g, ''), 10) || Math.floor(Math.random() * 1e6);
|
||||
$('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'; }
|
||||
try { worldNames = (await listWorlds()).map(w => w.name); }
|
||||
catch (e) { worldNames = []; }
|
||||
$('nw-name').value = autoName = claimName(newWorldSeed(), worldNames);
|
||||
$('nw-name').focus(); $('nw-name').select();
|
||||
};
|
||||
$('nw-seed').oninput = () => {
|
||||
if ($('nw-name').value === autoName) $('nw-name').value = autoName = claimName(newWorldSeed(), worldNames);
|
||||
};
|
||||
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 seed = newWorldSeed();
|
||||
const [w, h] = $('nw-size').value.split('x').map(Number);
|
||||
startNewWorld(seed, w, h, $('nw-name').value);
|
||||
};
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ async function setupNewWorld(seed, w, h, name, carried, title = 'Generating worl
|
||||
async function startNewWorld(seed, w, h, name = '') {
|
||||
try {
|
||||
const worlds = await listWorlds();
|
||||
await setupNewWorld(seed, w, h, cleanWorldName(name, `World ${worlds.length + 1}`));
|
||||
await setupNewWorld(seed, w, h, cleanWorldName(name, claimName(seed, worlds.map(w => w.name))));
|
||||
career = { id: newWorldId(), claims: [GAME.worldId], claimNo: 1 };
|
||||
GAME.careerId = career.id; GAME.claimNo = 1;
|
||||
showLoading(true, 0.9, 'Saving');
|
||||
|
||||
Reference in New Issue
Block a user