DarkflameServer/dScripts/RockHydrantSmashable.cpp
2021-12-05 18:54:36 +01:00

24 lines
671 B
C++

#include "RockHydrantSmashable.h"
#include "EntityManager.h"
#include "SimplePhysicsComponent.h"
#include "Entity.h"
#include "GameMessages.h"
#include "Game.h"
#include "dLogger.h"
void RockHydrantSmashable::OnDie(Entity* self, Entity* killer) {
SimplePhysicsComponent* physics = self->GetComponent<SimplePhysicsComponent>();
NiPoint3 pos = physics->GetPosition();
EntityInfo info;
info.lot = 12293;
info.pos = pos;
info.spawner = nullptr;
info.spawnerID = self->GetSpawnerID();
info.spawnerNodeID = 0;
Entity* newEntity = EntityManager::Instance()->CreateEntity(info, nullptr);
if (newEntity) {
EntityManager::Instance()->ConstructEntity(newEntity);
}
}