DarkflameServer/dScripts/RockHydrantSmashable.cpp

24 lines
721 B
C++
Raw Normal View History

#include "RockHydrantSmashable.h"
#include "EntityManager.h"
2022-04-18 00:43:17 +00:00
#include "GeneralUtils.h"
2022-04-18 00:43:17 +00:00
void RockHydrantSmashable::OnDie(Entity* self, Entity* killer)
{
const auto hydrantName = self->GetVar<std::u16string>(u"hydrant");
2022-04-18 00:43:17 +00:00
LDFBaseData* data = new LDFData<std::string>(u"hydrant", GeneralUtils::UTF16ToWTF8(hydrantName));
EntityInfo info {};
info.lot = 12293;
2022-04-18 00:43:17 +00:00
info.pos = self->GetPosition();
info.rot = self->GetRotation();
info.settings = {data};
info.spawnerID = self->GetSpawnerID();
2022-04-18 00:43:17 +00:00
Game::logger->Log("RockHydrantBroken", "Rock Hydrant spawned (%s)\n", data->GetString().c_str());
auto* hydrant = EntityManager::Instance()->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(hydrant);
}