mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-23 22:17:31 +00:00
3e3148e910
* convert zone manager to game namespace * Destroy logger last
53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
#include "ActVehicleDeathTrigger.h"
|
|
#include "PossessableComponent.h"
|
|
#include "GameMessages.h"
|
|
#include "RacingControlComponent.h"
|
|
#include "dZoneManager.h"
|
|
#include "EntityManager.h"
|
|
#include "PossessorComponent.h"
|
|
|
|
|
|
void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
|
auto* possessableComponent = target->GetComponent<PossessableComponent>();
|
|
|
|
Entity* vehicle;
|
|
Entity* player;
|
|
|
|
if (possessableComponent != nullptr) {
|
|
auto* player = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
|
|
|
|
if (player == nullptr) {
|
|
return;
|
|
}
|
|
|
|
return;
|
|
} else if (target->IsPlayer()) {
|
|
auto* possessorComponent = target->GetComponent<PossessorComponent>();
|
|
|
|
if (possessorComponent == nullptr) {
|
|
return;
|
|
}
|
|
|
|
vehicle = Game::entityManager->GetEntity(possessorComponent->GetPossessable());
|
|
|
|
if (vehicle == nullptr) {
|
|
return;
|
|
}
|
|
|
|
player = target;
|
|
} else {
|
|
return;
|
|
}
|
|
|
|
|
|
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0, true, false, 0);
|
|
|
|
auto* zoneController = Game::zoneManager->GetZoneControlObject();
|
|
|
|
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
|
|
|
if (racingControlComponent != nullptr) {
|
|
racingControlComponent->OnRequestDie(player);
|
|
}
|
|
}
|