mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-18 09:45:28 +00:00
feat(scripts): L_FIRE_TRANS_ROCKS and its manager, the rocks of the NJ fire transition
L_FIRE_TRANS_ROCKS_MANAGER waits until the rocks of its RockGroup are all there (NumberOfRocks, 3), sends them to waypoint 1 five seconds later, and each time all of them have told it they are back down sends them up again after a second. L_FIRE_TRANS_ROCKS holds a rock that arrived at waypoint 1 for 3.5 s and sends it back to waypoint 0, where it tells the manager (PlatformDown). Both act on ArrivedAtDesiredWaypoint and GoToWaypoint, which the mover has. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
24
dScripts/02_server/Map/njhub/FireTransRocks.cpp
Normal file
24
dScripts/02_server/Map/njhub/FireTransRocks.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "FireTransRocks.h"
|
||||
|
||||
#include "Entity.h"
|
||||
#include "EntityManager.h"
|
||||
#include "MovingPlatformComponent.h"
|
||||
|
||||
void FireTransRocks::OnStartup(Entity* self) {
|
||||
if (!self->HasVar(u"RockManagerGroup")) self->SetVar<std::u16string>(u"RockManagerGroup", u"FireTransRocksManager");
|
||||
}
|
||||
|
||||
void FireTransRocks::OnArrivedAtDesiredWaypoint(Entity* self, const uint32_t waypointIndex) {
|
||||
if (waypointIndex == 1) {
|
||||
self->AddTimer("PlatHold", 3.5f);
|
||||
return;
|
||||
}
|
||||
// The first manager there is hears that the rock is down
|
||||
const auto managers = Game::entityManager->GetEntitiesInGroup(self->GetVarAsString(u"RockManagerGroup"));
|
||||
if (!managers.empty()) managers.front()->GetScript()->OnNotifyObject(managers.front(), self, "PlatformDown");
|
||||
}
|
||||
|
||||
void FireTransRocks::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName != "PlatHold") return;
|
||||
if (auto* const platform = self->GetComponent<MovingPlatformComponent>()) platform->GotoWaypoint(0);
|
||||
}
|
||||
Reference in New Issue
Block a user