2021-12-05 17:54:36 +00:00
|
|
|
#include "RockHydrantSmashable.h"
|
|
|
|
#include "EntityManager.h"
|
2023-01-07 05:17:05 +00:00
|
|
|
#include "EntityInfo.h"
|
2022-04-18 00:43:17 +00:00
|
|
|
#include "GeneralUtils.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-04-18 00:43:17 +00:00
|
|
|
void RockHydrantSmashable::OnDie(Entity* self, Entity* killer) {
|
|
|
|
const auto hydrantName = self->GetVar<std::u16string>(u"hydrant");
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-04-18 00:43:17 +00:00
|
|
|
LDFBaseData* data = new LDFData<std::string>(u"hydrant", GeneralUtils::UTF16ToWTF8(hydrantName));
|
|
|
|
|
|
|
|
EntityInfo info{};
|
2022-04-19 02:02:04 +00:00
|
|
|
info.lot = ROCK_HYDRANT_BROKEN;
|
2022-04-18 00:43:17 +00:00
|
|
|
info.pos = self->GetPosition();
|
|
|
|
info.rot = self->GetRotation();
|
|
|
|
info.settings = { data };
|
2021-12-05 17:54:36 +00:00
|
|
|
info.spawnerID = self->GetSpawnerID();
|
|
|
|
|
2022-04-19 02:02:04 +00:00
|
|
|
auto* hydrant = EntityManager::Instance()->CreateEntity(info);
|
2022-04-18 00:43:17 +00:00
|
|
|
|
2022-04-19 02:02:04 +00:00
|
|
|
EntityManager::Instance()->ConstructEntity(hydrant);
|
2022-04-18 00:43:17 +00:00
|
|
|
}
|