mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-17 12:14:21 +00:00
chore: cleanup pointer management for LDF data (#1995)
* change network settings from vector to LwoNameValue * move settings on Entity to managed memory * Migrate more members * chore: remove pointer leakage from raw ldf pointers * feedback * fix ci
This commit is contained in:
@@ -71,9 +71,7 @@ void ZoneAgSpiderQueen::OnTimerDone(Entity* self, std::string timerName) {
|
||||
info.pos = spawnTarget->GetPosition();
|
||||
info.rot = spawnTarget->GetRotation();
|
||||
info.lot = chestObject;
|
||||
info.settings = {
|
||||
new LDFData<LWOOBJID>(u"parent_tag", self->GetObjectID())
|
||||
};
|
||||
info.settings.Insert(u"parent_tag", self->GetObjectID());
|
||||
|
||||
auto* chest = Game::entityManager->CreateEntity(info);
|
||||
Game::entityManager->ConstructEntity(chest);
|
||||
|
||||
@@ -37,12 +37,10 @@ void AmSkullkinTower::SpawnLegs(Entity* self, const std::string& loc) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<LDFBaseData*> config = { new LDFData<std::string>(u"Leg", loc) };
|
||||
|
||||
EntityInfo info{};
|
||||
info.lot = legLOT;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
info.settings = config;
|
||||
info.settings.Insert("Leg", loc);
|
||||
info.rot = newRot;
|
||||
|
||||
if (loc == "Right") {
|
||||
|
||||
@@ -204,12 +204,10 @@ void PetDigServer::SpawnPet(Entity* self, const Entity* owner, const DigInfo dig
|
||||
info.pos = self->GetPosition();
|
||||
info.rot = self->GetRotation();
|
||||
info.spawnerID = self->GetSpawnerID();
|
||||
info.settings = {
|
||||
new LDFData<LWOOBJID>(u"tamer", owner->GetObjectID()),
|
||||
new LDFData<std::string>(u"group", "pet" + std::to_string(owner->GetObjectID())),
|
||||
new LDFData<std::string>(u"spawnAnim", "spawn-pet"),
|
||||
new LDFData<float>(u"spawnTimer", 1.0)
|
||||
};
|
||||
info.settings.Insert<LWOOBJID>(u"tamer", owner->GetObjectID());
|
||||
info.settings.Insert<std::string>(u"group", "pet" + std::to_string(owner->GetObjectID()));
|
||||
info.settings.Insert<std::string>(u"spawnAnim", "spawn-pet");
|
||||
info.settings.Insert<float>(u"spawnTimer", 1.0);
|
||||
|
||||
auto* spawnedPet = Game::entityManager->CreateEntity(info);
|
||||
Game::entityManager->ConstructEntity(spawnedPet);
|
||||
|
||||
@@ -66,14 +66,12 @@ void QbSpawner::OnTimerDone(Entity* self, std::string timerName) {
|
||||
info.rot = newRot;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
info.spawnerNodeID = 0;
|
||||
info.settings = {
|
||||
new LDFData<bool>(u"no_timed_spawn", true),
|
||||
new LDFData<float>(u"aggroRadius", 70),
|
||||
new LDFData<float>(u"softtetherRadius", 80),
|
||||
new LDFData<float>(u"tetherRadius", 90),
|
||||
new LDFData<float>(u"wanderRadius", 5),
|
||||
new LDFData<int>(u"mobTableLoc", i)
|
||||
};
|
||||
info.settings.Insert<bool>(u"no_timed_spawn", true);
|
||||
info.settings.Insert<float>(u"aggroRadius", 70);
|
||||
info.settings.Insert<float>(u"softtetherRadius", 80);
|
||||
info.settings.Insert<float>(u"tetherRadius", 90);
|
||||
info.settings.Insert<float>(u"wanderRadius", 5);
|
||||
info.settings.Insert<int>(u"mobTableLoc", i);
|
||||
|
||||
auto* child = Game::entityManager->CreateEntity(info, nullptr, self);
|
||||
Game::entityManager->ConstructEntity(child);
|
||||
|
||||
@@ -34,12 +34,10 @@ void NsConcertChoiceBuildManager::SpawnCrate(Entity* self) {
|
||||
info.pos = self->GetPosition();
|
||||
info.rot = self->GetRotation();
|
||||
info.spawnerID = self->GetObjectID();
|
||||
info.settings = {
|
||||
new LDFData<bool>(u"startsQBActivator", true),
|
||||
new LDFData<std::string>(u"grpNameQBShowBricks", crate.group + std::to_string(groupNumber)),
|
||||
new LDFData<std::u16string>(u"groupID", GeneralUtils::ASCIIToUTF16("Crate_" + group)),
|
||||
new LDFData<float>(u"crateTime", crate.time),
|
||||
};
|
||||
info.settings.Insert<bool>(u"startsQBActivator", true);
|
||||
info.settings.Insert<std::string>(u"grpNameQBShowBricks", crate.group + std::to_string(groupNumber));
|
||||
info.settings.Insert<std::u16string>(u"groupID", GeneralUtils::ASCIIToUTF16("Crate_" + group));
|
||||
info.settings.Insert<float>(u"crateTime", crate.time);
|
||||
|
||||
auto* spawnedCrate = Game::entityManager->CreateEntity(info);
|
||||
Game::entityManager->ConstructEntity(spawnedCrate);
|
||||
|
||||
@@ -89,7 +89,7 @@ void NtCombatChallengeServer::SpawnTargetDummy(Entity* self) {
|
||||
info.spawnerID = self->GetObjectID();
|
||||
info.pos = self->GetPosition();
|
||||
info.rot = self->GetRotation();
|
||||
info.settings = { new LDFData<std::string>(u"custom_script_server", "scripts\\02_server\\Map\\NT\\L_NT_COMBAT_CHALLENGE_DUMMY.lua") };
|
||||
info.settings.Insert(u"custom_script_server", "scripts\\02_server\\Map\\NT\\L_NT_COMBAT_CHALLENGE_DUMMY.lua");
|
||||
|
||||
auto* dummy = Game::entityManager->CreateEntity(info, nullptr, self);
|
||||
|
||||
|
||||
@@ -95,10 +95,8 @@ void ZoneAgProperty::LoadInstance(Entity* self) {
|
||||
|
||||
for (auto* spawner : Game::zoneManager->GetSpawnersByName(self->GetVar<std::string>(InstancerSpawner))) {
|
||||
for (auto* spawnerNode : spawner->m_Info.nodes) {
|
||||
spawnerNode->config.push_back(
|
||||
new LDFData<std::string>(u"custom_script_server",
|
||||
R"(scripts\ai\GENERAL\L_INSTANCE_EXIT_TRANSFER_PLAYER_TO_LAST_NON_INSTANCE.lua)"));
|
||||
spawnerNode->config.push_back(new LDFData<std::u16string>(u"transferText", u"SPIDER_QUEEN_EXIT_QUESTION"));
|
||||
spawnerNode->config.Insert<std::string>(u"custom_script_server", R"(scripts\ai\GENERAL\L_INSTANCE_EXIT_TRANSFER_PLAYER_TO_LAST_NON_INSTANCE.lua)");
|
||||
spawnerNode->config.Insert<std::u16string>(u"transferText", u"SPIDER_QUEEN_EXIT_QUESTION");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -515,9 +515,7 @@ void NjMonastryBossInstance::FightOver(Entity* self) {
|
||||
info.pos = treasureChest->GetPosition();
|
||||
info.rot = treasureChest->GetRotation();
|
||||
info.spawnerID = self->GetObjectID();
|
||||
info.settings = {
|
||||
new LDFData<LWOOBJID>(u"parent_tag", self->GetObjectID())
|
||||
};
|
||||
info.settings.Insert<LWOOBJID>(u"parent_tag", self->GetObjectID());
|
||||
|
||||
// Finally spawn a treasure chest at the correct spawn point
|
||||
auto* chestObject = Game::entityManager->CreateEntity(info);
|
||||
|
||||
Reference in New Issue
Block a user