mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-17 17:25:27 +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:
@@ -9,6 +9,7 @@
|
||||
#include "CDClientDatabase.h"
|
||||
#include "Entity.h"
|
||||
#include "GameMessages.h"
|
||||
#include "02_server/Map/njhub/FireTransRocks.h"
|
||||
#include "LDFFormat.h"
|
||||
#include "MovementMessages.h"
|
||||
#include "MovingPlatformComponent.h"
|
||||
@@ -643,3 +644,41 @@ TEST_F(MovingPlatformComponentTest, OnceOnlyMoverGoesOnItsSpinnersEvent) {
|
||||
EXPECT_EQ(mover->mState, 2u);
|
||||
EXPECT_EQ(mover->mCurrentWaypointIndex, 0u);
|
||||
}
|
||||
|
||||
// L_FIRE_TRANS_ROCKS: a rock that arrived at its top (waypoint 1) holds there (the PlatHold timer) and is then sent
|
||||
// back down to waypoint 0
|
||||
TEST_F(MovingPlatformComponentTest, FireTransRockGoesBackDownAfterItsHold) {
|
||||
Path path;
|
||||
path.pathType = PathType::MovingPlatform;
|
||||
path.pathName = "TestRockPath";
|
||||
path.pathBehavior = PathBehavior::Once;
|
||||
PathWaypoint first;
|
||||
first.position = NiPoint3(0.0f, 0.0f, 0.0f);
|
||||
first.speed = 5.0f;
|
||||
PathWaypoint second = first;
|
||||
second.position = NiPoint3(0.0f, 10.0f, 0.0f);
|
||||
path.pathWaypoints = { first, second };
|
||||
const_cast<Zone*>(Game::zoneManager->GetZone())->AddPath(path);
|
||||
|
||||
info.settings.Insert<bool>(u"startPathingOnLoad", false);
|
||||
Entity entity(288300744895900119, info);
|
||||
info.settings.values.clear();
|
||||
auto* const platform = entity.AddComponent<MovingPlatformComponent>(-1, "TestRockPath");
|
||||
auto* const mover = platform->GetMoverSubComponent();
|
||||
FireTransRocks script;
|
||||
script.OnStartup(&entity);
|
||||
EXPECT_EQ(entity.GetVarAsString(u"RockManagerGroup"), "FireTransRocksManager");
|
||||
|
||||
platform->GotoWaypoint(1);
|
||||
platform->Run(0.11f);
|
||||
platform->Run(2.1f);
|
||||
EXPECT_EQ(mover->mState, 28u);
|
||||
EXPECT_EQ(mover->mCurrentWaypointIndex, 1u);
|
||||
|
||||
script.OnTimerDone(&entity, "PlatHold");
|
||||
EXPECT_EQ(mover->mDesiredWaypointIndex, 0);
|
||||
platform->Run(0.11f);
|
||||
platform->Run(2.1f);
|
||||
EXPECT_EQ(mover->mState, 28u);
|
||||
EXPECT_EQ(mover->mCurrentWaypointIndex, 0u);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user