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){
LOG("Removing spawner %llu", npc.m_ID);
Game::zoneManager->RemoveSpawner(npc.m_ID);
}
} else{
auto* entity = Game::entityManager->GetEntity(npc.m_ID);
if (!entity) continue;
entity->Smash(LWOOBJID_EMPTY, eKillType::VIOLENT);
}
}
m_NPCs.clear();
}
@ -139,9 +140,9 @@ void VanityUtilities::SpawnVanity() {
auto* spawner = SpawnSpawner(npc.m_LOT, location.m_Position, location.m_Rotation, npc.ldf);
if (!spawner) continue;
npc.m_ID = spawner->m_Info.spawnerID;
}
} else {
// 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;
npc.m_ID = npcEntity->GetObjectID();
if (!npc.m_Phrases.empty()){
@ -160,6 +161,7 @@ void VanityUtilities::SpawnVanity() {
SetupNPCTalk(npcEntity);
}
}
}
if (zoneID == 1200) {
{
@ -251,13 +253,12 @@ Spawner* VanityUtilities::SpawnSpawner(LOT lot, const NiPoint3& position, const
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;
info.lot = lot;
info.pos = position;
info.rot = rotation;
if (ID == LWOOBJID_EMPTY) info.spawnerID = Game::entityManager->GetZoneControlEntity()->GetObjectID();
else info.spawnerID = ID;
info.spawnerID = Game::entityManager->GetZoneControlEntity()->GetObjectID();
info.settings = ldf;
auto* entity = Game::entityManager->CreateEntity(info);

View File

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