feat(world): an edit mode world constructs none of the zone's objects

With -editmode 1 the world loads the zone file, terrain scene map, navmesh and
level revisions, but makes no level objects, carver blockers, spawners, spawner
networks, triggers, vanity objects or live event objects. The zone control
object stays with the zone's own template, as the client makes the same one
itself (LevelManager::LoadZoneControlObject, 0x01082660); its server script
does nothing and a race track's does not take the player into a race. Such a
world lets in only accounts at editor_gm_level.

Plumbing only: no command starts an edit mode instance yet (docs/EditMode.md).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-10 17:34:13 -06:00
parent 4cf0909d52
commit f6914940c1
14 changed files with 219 additions and 14 deletions

View File

@@ -86,6 +86,7 @@
#include "DestroyableComponent.h"
#include "Game.h"
#include "PropertyManagementComponent.h"
#include "EditMode.h"
#include "AssetManager.h"
#include "LevelProgressionComponent.h"
#include "eBlueprintSaveResponseType.h"
@@ -243,6 +244,7 @@ int main(int argc, char** argv) {
uint32_t cloneID = 0;
uint32_t maxClients = 8;
uint32_t ourPort = 2007;
bool editMode = false;
//Check our arguments:
for (int32_t i = 0; (i + 1) < argc; i++) {
@@ -257,6 +259,7 @@ int main(int argc, char** argv) {
else if (argument == "-clone") cloneID = valOptional.value_or(0);
else if (argument == "-maxclients") maxClients = valOptional.value_or(8);
else if (argument == "-port") ourPort = valOptional.value_or(2007);
else if (argument == "-editmode") editMode = valOptional.value_or(0) != 0;
}
Game::config = new dConfig("worldconfig.ini");
@@ -423,6 +426,8 @@ int main(int argc, char** argv) {
Profiler::Scope navmesh("Navmesh and physics load", Profiler::Phase::PHYSICS);
dpWorld::Initialize(zoneID);
}
// A GM's edit mode instance (docs/EditMode.md): master says so when it starts the world
Game::zoneManager->SetEditMode(editMode);
Game::zoneManager->Initialize(LWOZONEID(zoneID, g_InstanceID, cloneID));
PacketCapture::SetClone(cloneID);
g_CloneID = cloneID;
@@ -578,7 +583,8 @@ int main(int argc, char** argv) {
DashboardNotify::Flush();
DashboardNotify::SendPlayerPositions(g_InstanceID);
MessageInspector::Update();
LiveEvents::Update();
// (an edit mode instance has no server objects, so no live events either)
if (!Game::zoneManager->GetEditMode()) LiveEvents::Update();
UgcManifest::Update();
Metrics::StartMeasurement(MetricVariable::UpdateSpawners);
@@ -889,6 +895,17 @@ namespace {
} else {
LOG("User %s authenticated with correct key.", username.GetAsString().c_str());
// An edit mode instance takes only accounts that may use /editmode, however they found its address
if (Game::zoneManager->GetEditMode()) {
const auto account = Database::Get()->GetAccountInfo(username.GetAsString());
if (!EditMode::MayEnter(account ? account->maxGmLevel : eGameMasterLevel::CIVILIAN, EditMode::RequiredLevel())) {
LOG("User %s may not enter an edit mode instance; disconnecting them", username.GetAsString().c_str());
Game::server->Disconnect(it->second.sysAddr, eServerDisconnectIdentifiers::KICK);
g_PendingUsers.erase(it);
return;
}
}
UserManager::Instance()->DeleteUser(masterAddr);
//Create our user and send them in: