2021-12-05 17:54:36 +00:00
|
|
|
#include "RaceMaelstromGeiser.h"
|
|
|
|
#include "GameMessages.h"
|
|
|
|
#include "PossessableComponent.h"
|
|
|
|
#include "PossessorComponent.h"
|
|
|
|
#include "EntityManager.h"
|
2023-06-26 05:00:01 +00:00
|
|
|
#include "VehicleRacingControlComponent.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include "dZoneManager.h"
|
|
|
|
|
|
|
|
void RaceMaelstromGeiser::OnStartup(Entity* self) {
|
|
|
|
self->SetVar(u"AmFiring", false);
|
|
|
|
|
|
|
|
self->AddTimer("downTime", self->GetVar<int32_t>(u"startTime"));
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
self->SetProximityRadius(15, "deathZone");
|
|
|
|
}
|
|
|
|
|
|
|
|
void RaceMaelstromGeiser::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
|
|
|
if (!entering->IsPlayer() || name != "deathZone" || status != "ENTER") {
|
2022-07-28 13:39:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
if (!self->GetVar<bool>(u"AmFiring")) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-06-09 08:27:05 +00:00
|
|
|
auto* possessableComponent = entering->GetComponent<PossessableComponent>();
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
Entity* vehicle;
|
|
|
|
Entity* player;
|
|
|
|
|
|
|
|
if (possessableComponent != nullptr) {
|
|
|
|
player = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
|
|
|
|
|
|
|
|
if (player == nullptr) {
|
|
|
|
return;
|
2022-07-28 13:39:57 +00:00
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
vehicle = entering;
|
|
|
|
} else if (entering->IsPlayer()) {
|
2023-06-09 08:27:05 +00:00
|
|
|
auto* possessorComponent = entering->GetComponent<PossessorComponent>();
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
if (possessorComponent == nullptr) {
|
|
|
|
return;
|
2022-07-28 13:39:57 +00:00
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
vehicle = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable());
|
|
|
|
|
|
|
|
if (vehicle == nullptr) {
|
|
|
|
return;
|
2022-07-28 13:39:57 +00:00
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
player = entering;
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-02 22:39:21 +00:00
|
|
|
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0, true, false, 0);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
auto* zoneController = dZoneManager::Instance()->GetZoneControlObject();
|
|
|
|
|
2023-06-26 05:00:01 +00:00
|
|
|
auto* vehicleRacingControlComponent = zoneController->GetComponent<VehicleRacingControlComponent>();
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-06-26 05:00:01 +00:00
|
|
|
if (vehicleRacingControlComponent) vehicleRacingControlComponent->OnRequestDie(player);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RaceMaelstromGeiser::OnTimerDone(Entity* self, std::string timerName) {
|
|
|
|
if (timerName == "downTime") {
|
|
|
|
GameMessages::SendPlayFXEffect(self->GetObjectID(), 4048, u"rebuild_medium", "geiser", LWOOBJID_EMPTY, 1, 1, true);
|
|
|
|
|
|
|
|
self->AddTimer("buildUpTime", 1);
|
|
|
|
} else if (timerName == "buildUpTime") {
|
|
|
|
self->SetVar(u"AmFiring", true);
|
|
|
|
|
|
|
|
self->AddTimer("killTime", 1.5f);
|
|
|
|
} else if (timerName == "killTime") {
|
|
|
|
GameMessages::SendStopFXEffect(self, true, "geiser");
|
|
|
|
|
|
|
|
self->SetVar(u"AmFiring", false);
|
|
|
|
|
|
|
|
self->AddTimer("downTime", 3.0);
|
|
|
|
}
|
|
|
|
}
|