#include "SpinnersVol.h" #include "Entity.h" #include "EntityManager.h" #include "dZoneManager.h" #include "Spawner.h" #include "EffectsMessages.h" #include "PhantomPhysicsComponent.h" #include "dpEntity.h" namespace { // The wait before the rail's network is activated constexpr float SpawnDelay = 2.0f; } void SpinnersVol::ProcessEvent(Entity* self, const bool upperLimitReached) { if (!upperLimitReached) return; // Each player in the volume sees the cinematic auto* const phantomPhysics = self->GetComponent(); if (phantomPhysics && phantomPhysics->GetdpEntity()) { for (const auto id : phantomPhysics->GetdpEntity()->GetCurrentlyCollidingObjects()) { auto* const player = Game::entityManager->GetEntity(id); if (!player || !player->IsPlayer()) continue; GameMessages::PlayCinematic cinematic; cinematic.target = player->GetObjectID(); cinematic.pathName = m_TargetCine; cinematic.Send(player->GetSystemAddress()); } } // (a timer with cancel: a second one replaces the first) self->CancelTimer(m_TimerName); self->AddTimer(m_TimerName, SpawnDelay); } void SpinnersVol::OnTimerDone(Entity* self, std::string timerName) { if (timerName != m_TimerName) return; const auto spawners = Game::zoneManager->GetSpawnersByName(m_TargetNetwork); if (!spawners.empty() && spawners.front()) spawners.front()->Activate(); }