mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-05-30 21:51:33 +00:00
add settings if they dont exist
add helper for spawnerinfo config data
This commit is contained in:
parent
bfeb10c972
commit
a153d0a78c
@ -385,12 +385,25 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
|
|||||||
auto* spawner = Game::zoneManager->GetSpawner(spawnerId);
|
auto* spawner = Game::zoneManager->GetSpawner(spawnerId);
|
||||||
|
|
||||||
// If empty, insert the default config data since it doesn't exist yet
|
// If empty, insert the default config data since it doesn't exist yet
|
||||||
if (info.nodes[0]->config.empty()) {
|
|
||||||
info.nodes[0]->config.push_back(new LDFData<LWOOBJID>(u"modelBehaviors", 0));
|
if (!node->HasVar(u"modelBehaviors")) {
|
||||||
info.nodes[0]->config.push_back(new LDFData<LWOOBJID>(u"userModelID", info.spawnerID));
|
node->config.push_back(new LDFData<LWOOBJID>(u"modelBehaviors", 0));
|
||||||
info.nodes[0]->config.push_back(new LDFData<int>(u"modelType", 2));
|
}
|
||||||
info.nodes[0]->config.push_back(new LDFData<bool>(u"propertyObjectID", true));
|
|
||||||
info.nodes[0]->config.push_back(new LDFData<int>(u"componentWhitelist", 1));
|
if (!node->HasVar(u"userModelID")) {
|
||||||
|
node->config.push_back(new LDFData<LWOOBJID>(u"userModelID", info.spawnerID));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!node->HasVar(u"modelType")) {
|
||||||
|
node->config.push_back(new LDFData<int>(u"modelType", 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!node->HasVar(u"propertyObjectID")) {
|
||||||
|
node->config.push_back(new LDFData<bool>(u"propertyObjectID", true));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!node->HasVar(u"componentWhitelist")) {
|
||||||
|
node->config.push_back(new LDFData<int>(u"componentWhitelist", 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* model = spawner->Spawn();
|
auto* model = spawner->Spawn();
|
||||||
@ -607,25 +620,21 @@ void PropertyManagementComponent::Load() {
|
|||||||
|
|
||||||
info.spawnerID = databaseModel.id;
|
info.spawnerID = databaseModel.id;
|
||||||
|
|
||||||
std::vector<LDFBaseData*> settings;
|
|
||||||
|
|
||||||
//BBB property models need to have extra stuff set for them:
|
//BBB property models need to have extra stuff set for them:
|
||||||
if (databaseModel.lot == 14) {
|
if (databaseModel.lot == 14) {
|
||||||
LWOOBJID blueprintID = databaseModel.ugcId;
|
LWOOBJID blueprintID = databaseModel.ugcId;
|
||||||
GeneralUtils::SetBit(blueprintID, eObjectBits::CHARACTER);
|
GeneralUtils::SetBit(blueprintID, eObjectBits::CHARACTER);
|
||||||
GeneralUtils::SetBit(blueprintID, eObjectBits::PERSISTENT);
|
GeneralUtils::SetBit(blueprintID, eObjectBits::PERSISTENT);
|
||||||
|
|
||||||
settings.push_back(new LDFData<LWOOBJID>(u"blueprintID", blueprintID));
|
if (!node->HasVar(u"blueprintID")) node->config.push_back(new LDFData<LWOOBJID>(u"blueprintID", blueprintID));
|
||||||
} else {
|
} else {
|
||||||
settings.push_back(new LDFData<LWOOBJID>(u"modelBehaviors", 0));
|
if (!node->HasVar(u"modelBehaviors")) node->config.push_back(new LDFData<LWOOBJID>(u"modelBehaviors", 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.push_back(new LDFData<int>(u"modelType", 2));
|
if (!node->HasVar(u"modelType")) node->config.push_back(new LDFData<int>(u"modelType", 2));
|
||||||
settings.push_back(new LDFData<int>(u"componentWhitelist", 1));
|
if (!node->HasVar(u"componentWhitelist")) node->config.push_back(new LDFData<int>(u"componentWhitelist", 1));
|
||||||
settings.push_back(new LDFData<bool>(u"propertyObjectID", true));
|
if (!node->HasVar(u"propertyObjectID")) node->config.push_back(new LDFData<bool>(u"propertyObjectID", true));
|
||||||
settings.push_back(new LDFData<LWOOBJID>(u"userModelID", databaseModel.id));
|
if (!node->HasVar(u"userModelID")) node->config.push_back(new LDFData<LWOOBJID>(u"userModelID", databaseModel.id));
|
||||||
|
|
||||||
node->config = settings;
|
|
||||||
|
|
||||||
const auto spawnerId = Game::zoneManager->MakeSpawner(info);
|
const auto spawnerId = Game::zoneManager->MakeSpawner(info);
|
||||||
|
|
||||||
|
@ -7,6 +7,15 @@
|
|||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
|
|
||||||
|
bool SpawnerNode::HasVar(const std::u16string_view view) {
|
||||||
|
for (const auto* data : config) {
|
||||||
|
if (data->GetKey() == view) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Spawner::Spawner(const SpawnerInfo info) {
|
Spawner::Spawner(const SpawnerInfo info) {
|
||||||
m_Info = info;
|
m_Info = info;
|
||||||
m_Active = m_Info.activeOnLoad && info.spawnActivator;
|
m_Active = m_Info.activeOnLoad && info.spawnActivator;
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include "LDFFormat.h"
|
#include "LDFFormat.h"
|
||||||
#include "EntityInfo.h"
|
#include "EntityInfo.h"
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
struct SpawnerNode {
|
struct SpawnerNode {
|
||||||
NiPoint3 position = NiPoint3Constant::ZERO;
|
NiPoint3 position = NiPoint3Constant::ZERO;
|
||||||
@ -18,6 +19,8 @@ struct SpawnerNode {
|
|||||||
uint32_t nodeMax = 1;
|
uint32_t nodeMax = 1;
|
||||||
std::vector<LWOOBJID> entities;
|
std::vector<LWOOBJID> entities;
|
||||||
std::vector<LDFBaseData*> config;
|
std::vector<LDFBaseData*> config;
|
||||||
|
|
||||||
|
bool HasVar(const std::u16string_view view);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SpawnerInfo {
|
struct SpawnerInfo {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user