fix: stop the world wipe taking the world settings with it
A wipe was quietly turning a Sophie world into an Apocalypse one. 139 sandbox
values had reverted -- loot rates from 0.35 back to 0.9, ranged weapons and ammo
to 2.0, CharacterFreePoints from 0 to 60 -- and ten of Sophie's mod-added
options had vanished entirely.
The reset script was not deleting the settings. PZ reads
Server/<name>_SandboxVars.lua only when it creates a world, and then writes the
running world's settings back over that same file. The file is an output, not an
input. So once any world came up with defaults, the server stamped those defaults
into the file, and every wipe afterwards regenerated from them -- inheriting the
corruption rather than causing it, and with no way back out on its own. The same
shape as the admin-password deadlock.
The intended settings now live in config-template/, which the server has no
reason to touch, and a wipe restores Server/<name>_{SandboxVars,spawnregions,
spawnpoints}.lua from there before restarting. That is also the file to hand-edit
when changing the world: edit the template, wipe, and the new world has the edits.
Verified by wiping: 139 differences before, 0 after. The server still rewrites
the live file on boot -- 996 keys become 1061 as it adds newer options -- but
every Sophie value survives that now.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
05fc3b5c65
commit
1c467b1a76
@@ -55,6 +55,24 @@ else
|
||||
log "No database found at $DB_PATH"
|
||||
fi
|
||||
|
||||
# Restore the intended world settings before the server regenerates.
|
||||
#
|
||||
# Without this the wipe silently changes the game. PZ writes the running world's
|
||||
# settings back over Server/<name>_SandboxVars.lua, so by the time we delete the
|
||||
# save that file already describes the world we are throwing away -- and if that
|
||||
# world had defaults, the replacement inherits them. Restoring from the canonical
|
||||
# copy is what makes a wipe reset the world and keep the settings.
|
||||
CONFIG_TEMPLATE="{{ podman_home }}/.local/share/volumes/zomboid/config-template"
|
||||
SERVER_DIR="{{ podman_home }}/.local/share/volumes/zomboid/data/Server"
|
||||
for f in SandboxVars spawnregions spawnpoints; do
|
||||
if [[ -f "${CONFIG_TEMPLATE}/${f}.lua" ]]; then
|
||||
podman unshare cp "${CONFIG_TEMPLATE}/${f}.lua" "${SERVER_DIR}/${SERVER_NAME}_${f}.lua"
|
||||
log "Restored ${SERVER_NAME}_${f}.lua from canonical config"
|
||||
else
|
||||
log "WARNING: no canonical ${f}.lua; the new world will inherit whatever the server last wrote"
|
||||
fi
|
||||
done
|
||||
|
||||
# Start server
|
||||
log "Starting zomboid service..."
|
||||
systemctl --user start zomboid.service
|
||||
|
||||
Reference in New Issue
Block a user