mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-18 01:35:27 +00:00
revert(world): the edit mode world
This reverts commit f6914940. The client's level editor builds a zone's objects
itself from its own files, so a world server that constructs none of them has no use.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -47,7 +47,7 @@ Level::Level(Zone* parentZone, const std::string& filepath, int32_t sceneID) {
|
||||
static_cast<LevelFile::ChunkHeader&>(header) = chunkHeader;
|
||||
m_ChunkHeaders.insert(std::make_pair(id, header));
|
||||
}
|
||||
LoadSceneObjects(levelFile.objects, m_SceneID);
|
||||
LoadSceneObjects(levelFile.objects);
|
||||
}
|
||||
|
||||
void Level::MakeSpawner(const SceneObject& obj, int32_t sceneID) {
|
||||
@@ -120,18 +120,7 @@ void Level::MakeSpawner(const SceneObject& obj, int32_t sceneID) {
|
||||
Game::zoneManager->MakeSpawner(spawnInfo);
|
||||
}
|
||||
|
||||
void Level::LoadSceneObjects(const std::vector<SceneObject>& objects, const int32_t sceneID) {
|
||||
// Edit mode: the GM's client has the level's objects from its own files, so none is made here. The oldest files
|
||||
// keep the spawn point in an object, which is still read.
|
||||
if (Game::zoneManager->GetEditMode()) {
|
||||
for (const auto& obj : objects) {
|
||||
if (obj.lot != LOT_MARKER_PLAYER_START) continue;
|
||||
Game::zoneManager->GetZoneMut()->SetSpawnPos(obj.position);
|
||||
Game::zoneManager->GetZoneMut()->SetSpawnRot(obj.rotation);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void Level::LoadSceneObjects(const std::vector<SceneObject>& objects) {
|
||||
CDFeatureGatingTable* featureGatingTable = CDClientManager::GetTable<CDFeatureGatingTable>();
|
||||
|
||||
CDFeatureGating gating;
|
||||
@@ -192,7 +181,7 @@ void Level::LoadSceneObjects(const std::vector<SceneObject>& objects, const int3
|
||||
}
|
||||
|
||||
if (obj.lot == 176) { //Spawner
|
||||
MakeSpawner(obj, sceneID);
|
||||
MakeSpawner(obj, m_SceneID);
|
||||
} else { //Regular object
|
||||
EntityInfo info;
|
||||
info.spawnerID = 0;
|
||||
@@ -202,7 +191,7 @@ void Level::LoadSceneObjects(const std::vector<SceneObject>& objects, const int3
|
||||
info.rot = obj.rotation;
|
||||
info.settings = obj.settings;
|
||||
info.scale = obj.scale;
|
||||
info.scene = sceneID;
|
||||
info.scene = m_SceneID;
|
||||
Game::entityManager->CreateEntity(info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,11 @@ public:
|
||||
|
||||
static void MakeSpawner(const SceneObject& obj, int32_t sceneID = -1);
|
||||
|
||||
// Makes the objects and spawners of a level file. In edit mode (dZoneManager::GetEditMode) none: only the player
|
||||
// start marker's place is taken
|
||||
static void LoadSceneObjects(const std::vector<SceneObject>& objects, int32_t sceneID = -1);
|
||||
|
||||
std::map<uint32_t, Header> m_ChunkHeaders;
|
||||
private:
|
||||
Zone* m_ParentZone;
|
||||
int32_t m_SceneID = -1;
|
||||
|
||||
//private functions:
|
||||
void LoadSceneObjects(const std::vector<SceneObject>& objects);
|
||||
};
|
||||
|
||||
@@ -138,8 +138,7 @@ void Zone::LoadZoneIntoMemory() {
|
||||
}
|
||||
}
|
||||
|
||||
// Edit mode: no spawner networks (the paths themselves are kept, they are only data)
|
||||
if (m_FileFormatVersion >= Zone::FileFormatVersion::EarlyAlpha && !Game::zoneManager->GetEditMode()) {
|
||||
if (m_FileFormatVersion >= Zone::FileFormatVersion::EarlyAlpha) {
|
||||
for (const Path& path : m_Paths) {
|
||||
if (path.pathType != PathType::Spawner) continue;
|
||||
SpawnerInfo info{};
|
||||
@@ -287,8 +286,7 @@ void Zone::LoadScene(ZoneScene&& zoneScene) {
|
||||
LWOSCENEID lwoSceneID(scene.id, scene.sceneType);
|
||||
|
||||
std::string luTriggersPath = scene.filename.substr(0, scene.filename.size() - 4) + ".lutriggers";
|
||||
// Edit mode: no triggers
|
||||
if (!Game::zoneManager->GetEditMode() && Game::assetManager->HasFile((m_ZonePath + luTriggersPath).c_str())) LoadLUTriggers(luTriggersPath, scene);
|
||||
if (Game::assetManager->HasFile((m_ZonePath + luTriggersPath).c_str())) LoadLUTriggers(luTriggersPath, scene);
|
||||
|
||||
m_Scenes[lwoSceneID] = std::move(scene);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,8 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) {
|
||||
EntityInfo info;
|
||||
info.lot = zoneControlTemplate;
|
||||
|
||||
info.id = ZONE_CONTROL_OBJECT_ID;
|
||||
/* Yep its hardcoded like this in the client too, this exact value. */
|
||||
info.id = 0x3FFF'FFFFFFFELL;
|
||||
Entity* zoneControl = Game::entityManager->CreateEntity(info, nullptr, nullptr, true);
|
||||
m_ZoneControlObject = zoneControl;
|
||||
|
||||
@@ -72,9 +73,7 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) {
|
||||
|
||||
LOG("Zone prepared in: %llu ms", (endTime - startTime));
|
||||
|
||||
// The vanity objects are server objects the client's editor would not know
|
||||
if (!m_EditMode) VanityUtilities::SpawnVanity();
|
||||
else LOG("Zone %i is in edit mode: no level objects, spawners, triggers or vanity objects were loaded", zoneID.GetMapID());
|
||||
VanityUtilities::SpawnVanity();
|
||||
}
|
||||
|
||||
dZoneManager::~dZoneManager() {
|
||||
|
||||
@@ -23,9 +23,6 @@ private:
|
||||
void LoadWorldConfig();
|
||||
|
||||
public:
|
||||
// The zone control object's ID, the same fixed value in the client (LevelManager::LoadZoneControlObject, 0x01082660)
|
||||
static constexpr LWOOBJID ZONE_CONTROL_OBJECT_ID = 0x3FFF'FFFFFFFELL;
|
||||
|
||||
void Initialize(const LWOZONEID& zoneID);
|
||||
~dZoneManager();
|
||||
|
||||
@@ -33,13 +30,6 @@ public:
|
||||
Zone* GetZoneMut() const;
|
||||
const Zone* GetZone() const { return GetZoneMut(); };
|
||||
bool HasZone() const { return m_pZone != nullptr; };
|
||||
|
||||
/**
|
||||
* A GM's edit mode (docs/EditMode.md): the zone's level objects, spawners, spawner networks and triggers are not
|
||||
* loaded, so the GM's client is the only one that has them. Set before Initialize.
|
||||
*/
|
||||
bool GetEditMode() const { return m_EditMode; }
|
||||
void SetEditMode(bool value) { m_EditMode = value; }
|
||||
void LoadZone(const LWOZONEID& zoneID); //Discard the current zone (if any) and loads a new zone.
|
||||
|
||||
/* Adds a spawner to the zone with the specified ID. */
|
||||
@@ -113,7 +103,6 @@ private:
|
||||
bool m_PlayerLoseCoinsOnDeath = false;
|
||||
bool m_DisableSaveLocation = false;
|
||||
bool m_MountsAllowed = true;
|
||||
bool m_EditMode = false;
|
||||
bool m_PetsAllowed = true;
|
||||
std::map<LWOOBJID, Spawner*> m_Spawners;
|
||||
std::optional<WorldConfig> m_WorldConfig = std::nullopt;
|
||||
|
||||
Reference in New Issue
Block a user