Files
DarkflameServer/dScripts/02_server/Map/General/FireTempleCinematics.cpp
Aaron Kimbrell 046cb9902d feat(scripts): L_WAVES_MANAGER_SERVER, and scripts can listen to another object's FireEvents
Entity::Subscribe takes "FireEvent" (the Lua's notification request on FireEvent): the subscriber's script hears
every FireEvent the object is sent (NotifyFireEvent). The Fire Temple waves manager uses it to hear its spinners being
sent SpawnedEnemiesDead, which the spinners send to their own group once their enemies are dead (level config
name_deactivated_event / group_deactivated_event). LEVEL:GetCinematicInfo is the camera path's time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 23:40:23 -06:00

36 lines
1.3 KiB
C++

#include "FireTempleCinematics.h"
#include "Entity.h"
#include "EntityManager.h"
#include "EffectsMessages.h"
#include "PhantomPhysicsComponent.h"
#include "dpEntity.h"
#include "dZoneManager.h"
#include "Zone.h"
std::optional<float> FireTempleCinematics::GetCinematicInfo(const std::string& pathName) {
const auto* const zone = Game::zoneManager->GetZone();
const auto* const path = zone ? zone->GetPath(pathName) : nullptr;
if (!path) return std::nullopt;
float time = 0.0f;
for (size_t i = 0; i + 1 < path->pathWaypoints.size(); i++) time += path->pathWaypoints[i].camera.time;
return time;
}
std::vector<Entity*> FireTempleCinematics::ObjectsInVolume(Entity* volume) {
std::vector<Entity*> objects;
auto* const phantom = volume ? volume->GetComponent<PhantomPhysicsComponent>() : nullptr;
if (!phantom || !phantom->GetdpEntity()) return objects;
for (const auto id : phantom->GetdpEntity()->GetCurrentlyCollidingObjects()) {
if (auto* const object = Game::entityManager->GetEntity(id)) objects.push_back(object);
}
return objects;
}
void FireTempleCinematics::PlayCinematic(Entity* player, const std::u16string& pathName) {
if (!player || !player->IsPlayer()) return;
GameMessages::PlayCinematic cinematic;
cinematic.target = player->GetObjectID();
cinematic.pathName = pathName;
cinematic.Send(player->GetSystemAddress());
}