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

@@ -68,6 +68,27 @@ namespace ZoneEditLock {
return eResult::OK;
}
/**
* Reading the zone's files as they are on the server: an account at the level that is one of the zone's
* editors, or an admin. OK, LEVEL_TOO_LOW or NOT_ASSIGNED; the lock is not needed to look.
*/
inline eResult Read(const Actor& actor, const Levels& levels) {
if (actor.accountId == 0 || actor.gmLevel < levels.publish) return eResult::LEVEL_TOO_LOW;
if (!actor.assigned && !IsAdmin(actor, levels)) return eResult::NOT_ASSIGNED;
return eResult::OK;
}
/**
* Change, for a requester that is only ever told 0 to 3: an account that could take the lock and hasn't is
* told LOCKED_BY_OTHER (by nobody: it has to lock the zone first), any other account without the lock what
* keeps it from taking it.
*/
inline eResult ChangeOrWhyNot(const Actor& actor, std::optional<uint32_t> holder, const Levels& levels) {
const auto result = Change(actor, holder, levels);
if (result != eResult::NOT_ASSIGNED) return result;
return Read(actor, levels) == eResult::OK ? eResult::LOCKED_BY_OTHER : eResult::NOT_ASSIGNED;
}
// What happens to the zone's running instances after its files changed
enum class eReload : uint8_t {
SKIPPED, // not asked for: the files are read when an instance next starts