mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-30 01:41:40 +00:00
fix(njhub): Fire Temple rocks restart their timers as the Lua's AddTimerWithCancel
L_FIRE_TRANS_ROCKS and L_FIRE_TRANS_ROCKS_MANAGER use AddTimerWithCancel: a timer started again replaces the running one instead of running twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ void FireTransRocks::OnStartup(Entity* self) {
|
||||
|
||||
void FireTransRocks::OnArrivedAtDesiredWaypoint(Entity* self, const uint32_t waypointIndex) {
|
||||
if (waypointIndex == 1) {
|
||||
self->CancelTimer("PlatHold");
|
||||
self->AddTimer("PlatHold", 3.5f);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "MovingPlatformComponent.h"
|
||||
|
||||
void FireTransRocksManager::OnStartup(Entity* self) {
|
||||
self->CancelTimer("check");
|
||||
self->AddTimer("check", 5.0f);
|
||||
if (!self->HasVar(u"RockGroup")) self->SetVar<std::u16string>(u"RockGroup", u"FireTransRocks");
|
||||
if (!self->HasVar(u"NumberOfRocks")) self->SetVar<int32_t>(u"NumberOfRocks", 3);
|
||||
@@ -16,9 +17,11 @@ void FireTransRocksManager::CheckForRocks(Entity* self) {
|
||||
const auto rocks = Game::entityManager->GetEntitiesInGroup(self->GetVarAsString(u"RockGroup"));
|
||||
// Not all there yet: look again in a second
|
||||
if (static_cast<int32_t>(rocks.size()) < self->GetVarAs<int32_t>(u"NumberOfRocks")) {
|
||||
self->CancelTimer("check");
|
||||
self->AddTimer("check", 1.0f);
|
||||
return;
|
||||
}
|
||||
self->CancelTimer("StartPlatforms");
|
||||
self->AddTimer("StartPlatforms", 5.0f);
|
||||
}
|
||||
|
||||
@@ -32,6 +35,7 @@ void FireTransRocksManager::OnNotifyObject(Entity* self, Entity* sender, const s
|
||||
return;
|
||||
}
|
||||
// All of them are down
|
||||
self->CancelTimer("restartPlatforms");
|
||||
self->AddTimer("restartPlatforms", 1.0f);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user