DarkflameServer/dScripts/ai/ACT/ActVehicleDeathTrigger.cpp
Aaron Kimbre fd182d222f Update activing and racing components
Hopefully not going to rename them for a third time, no way
2023-06-26 15:06:33 -05:00

51 lines
1.2 KiB
C++

#include "ActVehicleDeathTrigger.h"
#include "PossessableComponent.h"
#include "GameMessages.h"
#include "RacingComponent.h"
#include "dZoneManager.h"
#include "EntityManager.h"
#include "PossessionComponent.h"
void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
auto* possessableComponent = target->GetComponent<PossessableComponent>();
Entity* vehicle;
Entity* player;
if (possessableComponent != nullptr) {
auto* player = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
if (player == nullptr) {
return;
}
return;
} else if (target->IsPlayer()) {
auto* possessionComponent = target->GetComponent<PossessionComponent>();
if (possessionComponent == nullptr) {
return;
}
vehicle = EntityManager::Instance()->GetEntity(possessionComponent->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 = dZoneManager::Instance()->GetZoneControlObject();
auto* racingComponent = zoneController->GetComponent<RacingComponent>();
if (racingComponent) racingComponent->OnRequestDie(player);
}