fix spawners and cleanup

This commit is contained in:
Aaron Kimbre 2023-11-09 18:59:43 -06:00
parent 6e07798023
commit 4867136133
2 changed files with 23 additions and 23 deletions

View File

@ -37,11 +37,12 @@ void VanityUtilities::SpawnVanity() {
if (npc.m_LOT == 176){ if (npc.m_LOT == 176){
LOG("Removing spawner %llu", npc.m_ID); LOG("Removing spawner %llu", npc.m_ID);
Game::zoneManager->RemoveSpawner(npc.m_ID); Game::zoneManager->RemoveSpawner(npc.m_ID);
} } else{
auto* entity = Game::entityManager->GetEntity(npc.m_ID); auto* entity = Game::entityManager->GetEntity(npc.m_ID);
if (!entity) continue; if (!entity) continue;
entity->Smash(LWOOBJID_EMPTY, eKillType::VIOLENT); entity->Smash(LWOOBJID_EMPTY, eKillType::VIOLENT);
} }
}
m_NPCs.clear(); m_NPCs.clear();
} }
@ -139,9 +140,9 @@ void VanityUtilities::SpawnVanity() {
auto* spawner = SpawnSpawner(npc.m_LOT, location.m_Position, location.m_Rotation, npc.ldf); auto* spawner = SpawnSpawner(npc.m_LOT, location.m_Position, location.m_Rotation, npc.ldf);
if (!spawner) continue; if (!spawner) continue;
npc.m_ID = spawner->m_Info.spawnerID; npc.m_ID = spawner->m_Info.spawnerID;
} } else {
// Spawn the NPC // Spawn the NPC
auto* npcEntity = SpawnNPC(npc.m_LOT, npc.m_Name, location.m_Position, location.m_Rotation, npc.m_Equipment, npc.ldf, npc.m_ID); auto* npcEntity = SpawnNPC(npc.m_LOT, npc.m_Name, location.m_Position, location.m_Rotation, npc.m_Equipment, npc.ldf);
if (!npcEntity) continue; if (!npcEntity) continue;
npc.m_ID = npcEntity->GetObjectID(); npc.m_ID = npcEntity->GetObjectID();
if (!npc.m_Phrases.empty()){ if (!npc.m_Phrases.empty()){
@ -160,6 +161,7 @@ void VanityUtilities::SpawnVanity() {
SetupNPCTalk(npcEntity); SetupNPCTalk(npcEntity);
} }
} }
}
if (zoneID == 1200) { if (zoneID == 1200) {
{ {
@ -251,13 +253,12 @@ Spawner* VanityUtilities::SpawnSpawner(LOT lot, const NiPoint3& position, const
return spawner; return spawner;
} }
Entity* VanityUtilities::SpawnNPC(LOT lot, const std::string& name, const NiPoint3& position, const NiQuaternion& rotation, const std::vector<LOT>& inventory, const std::vector<LDFBaseData*>& ldf, const LWOOBJID ID) { Entity* VanityUtilities::SpawnNPC(LOT lot, const std::string& name, const NiPoint3& position, const NiQuaternion& rotation, const std::vector<LOT>& inventory, const std::vector<LDFBaseData*>& ldf) {
EntityInfo info; EntityInfo info;
info.lot = lot; info.lot = lot;
info.pos = position; info.pos = position;
info.rot = rotation; info.rot = rotation;
if (ID == LWOOBJID_EMPTY) info.spawnerID = Game::entityManager->GetZoneControlEntity()->GetObjectID(); info.spawnerID = Game::entityManager->GetZoneControlEntity()->GetObjectID();
else info.spawnerID = ID;
info.settings = ldf; info.settings = ldf;
auto* entity = Game::entityManager->CreateEntity(info); auto* entity = Game::entityManager->CreateEntity(info);

View File

@ -42,8 +42,7 @@ public:
const NiPoint3& position, const NiPoint3& position,
const NiQuaternion& rotation, const NiQuaternion& rotation,
const std::vector<LOT>& inventory, const std::vector<LOT>& inventory,
const std::vector<LDFBaseData*>& ldf, const std::vector<LDFBaseData*>& ldf
const LWOOBJID ID = LWOOBJID_EMPTY
); );
static Spawner* SpawnSpawner( static Spawner* SpawnSpawner(