admin: reset-world --speed X (speed can only change on an emptied world)

Speed is stored scaled into rates and due times, so changing it under live rows would jump resources and mis-time events. reset-world now takes --speed to set the new world's speed in the same transaction.

Tested: test/admin-cli.test.js (speed asserted after reset), npm test green. NOT tested beyond that.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
jvanvik 2026-10-12 19:20:45 +02:00
parent 3c23c51902
commit d7a27db563
3 changed files with 7 additions and 5 deletions

View file

@ -247,10 +247,11 @@ test('reset-world refuses without --yes-destroy, then wipes the world and keeps
assert.equal(cli(file, ['reset-world', '1', '--yes']).code, 2, '--yes is not enough for reset-world');
const bk = path.join(dir, 'bk');
const done = cli(file, ['reset-world', '1', '--yes-destroy', '--backup', bk, '--new-seed', '--json']);
const done = cli(file, ['reset-world', '1', '--yes-destroy', '--backup', bk, '--new-seed', '--speed', '3', '--json']);
assert.equal(done.code, 0, done.err);
const after = counts();
assert.equal(after.towns, 0);
assert.equal(cli(file, ['worlds', '--json']).out.includes('"speed": 3') || /"speed":\s*3\b/.test(cli(file, ['worlds', '--json']).out), true, '--speed sets the new world speed');
assert.equal(after.operators, 0);
assert.equal(after.buildings, 0);
assert.equal(after.users, 1, 'accounts are kept');