Files
DarkflameServer/dScripts/ai/PETS/HydrantSmashable.cpp
David Markowitz 0101933f5c 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
2026-06-14 20:54:52 -07:00

20 lines
590 B
C++

#include "HydrantSmashable.h"
#include "EntityManager.h"
#include "EntityInfo.h"
#include "GeneralUtils.h"
void HydrantSmashable::OnDie(Entity* self, Entity* killer) {
const auto hydrantName = self->GetVar<std::u16string>(u"hydrant");
EntityInfo info{};
info.lot = HYDRANT_BROKEN;
info.pos = self->GetPosition();
info.rot = self->GetRotation();
info.settings.Insert<std::string>(u"hydrant", GeneralUtils::UTF16ToWTF8(hydrantName));
info.spawnerID = self->GetSpawnerID();
auto* hydrant = Game::entityManager->CreateEntity(info);
Game::entityManager->ConstructEntity(hydrant);
}