2021-12-05 17:54:36 +00:00
|
|
|
#include "HydrantSmashable.h"
|
|
|
|
#include "EntityManager.h"
|
2023-01-07 05:17:05 +00:00
|
|
|
#include "EntityInfo.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include "GeneralUtils.h"
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void HydrantSmashable::OnDie(Entity* self, Entity* killer) {
|
|
|
|
const auto hydrantName = self->GetVar<std::u16string>(u"hydrant");
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
LDFBaseData* data = new LDFData<std::string>(u"hydrant", GeneralUtils::UTF16ToWTF8(hydrantName));
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
EntityInfo info{};
|
|
|
|
info.lot = HYDRANT_BROKEN;
|
|
|
|
info.pos = self->GetPosition();
|
|
|
|
info.rot = self->GetRotation();
|
|
|
|
info.settings = { data };
|
|
|
|
info.spawnerID = self->GetSpawnerID();
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* hydrant = Game::entityManager->CreateEntity(info);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
Game::entityManager->ConstructEntity(hydrant);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|