feat(zone): zone files as the game client's level editor packs them

ZoneFilePack reads and writes the editor's packed files: named entries whose data is
sd0, one entry for a single file or the zone, terrain, scenes and triggers of a whole
map. Every length is checked, data that is not sd0 or has a chunk over 256 KiB is
refused, and only a name's base name is used. ZoneFilePush makes a set of what was
sent (one file replaces that file in the zone's set), checks it and applies it like
any other set.

The override store links a set's files instead of moving them, so a file the zone
already has can be carried into its next set, and one change at a time is made in an
override folder whichever server makes it. The asset manager can read the client's
own file past an override.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-10 19:11:29 -06:00
parent dbe0722095
commit e50a2255f8
13 changed files with 880 additions and 17 deletions

View File

@@ -20,8 +20,9 @@
* swapped in with a rename; the set it replaces goes to backups first. Restoring a backup and clearing a zone's set
* are the same swap. Knows nothing of who may do this (ZoneEditLock) or how files arrive.
*
* Only reads and writes files under root, and takes no lock of its own: callers apply one set at a time. No
* settings, database or logging, so it can run on a worker thread.
* Only reads and writes files under root. Changes in one override folder happen one at a time, whichever server
* makes them (a file lock, where the system has one). No settings, database or logging, so it can run on a worker
* thread.
*/
namespace ZoneOverrideStore {
struct StoreError : std::runtime_error {
@@ -45,7 +46,7 @@ namespace ZoneOverrideStore {
std::vector<Entry> files;
};
// A file of a new set: where its bytes are now (moved or copied into the store)
// A file of a new set: where its bytes are now (linked or copied into the store; the source stays)
struct NewFile {
std::string path;
std::filesystem::path source;