fix(moving platform): a simple mover without a quick build sets off when it is loaded

A simple mover is a LWOPlatform like a mover: made stopped at its
waypoint (12) and, unless startPathingOnLoad is false, waiting there (9)
for the shortest wait before it leaves for its other end
(ResumeTravelling 0x00c86b90, SetWaitingTime 0x00bdc860, RunPlatform
0x00c86e10). Live showed it on the NJ counterweights, which wait for
their quick build first; one without a quick build was left waiting for
a script here.

The client only reads startPathingOnLoad (LWOMovingPlatformComponent::
LoadConfigData 0x00d0f690) and never starts a platform by itself, so the
rule is the server's, taken from what live did with movers (12 with the
setting false, else 9 and off) and from the scripts: L_NJ_SPINNER_SERVER
stops its platform when it starts up, simple movers included, and the
simple movers that wait for an event without that script all have
startPathingOnLoad 0 in the maps.

The wait now runs in the component for both, in place of the timer a
built counterweight got, and a simple mover with startPathingOnLoad
false is constructed stopped (12).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-10 16:49:24 -06:00
parent 4e8e0e64ef
commit 22c3168587
3 changed files with 84 additions and 14 deletions

View File

@@ -575,3 +575,50 @@ TEST_F(MovingPlatformComponentTest, MoverKeepsItsVelocityThroughAWaitLikeLive) {
EXPECT_EQ(mover->mPosition, NiPoint3(30.0f, 0.0f, 30.0f));
EXPECT_EQ(entity.GetPosition(), NiPoint3(30.0f, 0.0f, 30.0f));
}
// A simple mover without a quick build runs from when it is loaded, as a mover does: waiting at its waypoint (9) for the
// shortest wait, then off to its other end, where it has stopped (28). With startPathingOnLoad false it stays as it was
// made (12), and so does one its script stops when it starts up (live's NJ spinner script, L_NJ_SPINNER_SERVER).
TEST_F(MovingPlatformComponentTest, SimpleMoverSetsOffOnLoadUnlessToldNotTo) {
info.lot = 16141;
info.pos = NiPoint3(10.0f, 20.0f, 30.0f);
info.rot = QuatUtils::IDENTITY;
{
Entity entity(288300744895900115, info);
entity.AddComponent<SimplePhysicsComponent>(-1);
auto* const platform = entity.AddComponent<MovingPlatformComponent>(41, "");
auto* const mover = platform->GetSimpleMoverSubComponent();
EXPECT_EQ(mover->mState, 9u);
entity.Update(0.05f);
EXPECT_EQ(mover->mState, 9u);
entity.Update(0.06f);
EXPECT_EQ(mover->mState, 2u);
entity.Update(0.0f);
entity.Update(1.1f);
EXPECT_EQ(mover->mState, 28u);
EXPECT_EQ(mover->mCurrentWaypointIndex, 1u);
// Stopped at its end it does not set off again by itself
entity.Update(1.0f);
EXPECT_EQ(mover->mState, 28u);
}
{
Entity entity(288300744895900116, info);
auto* const platform = entity.AddComponent<MovingPlatformComponent>(41, "");
auto* const mover = platform->GetSimpleMoverSubComponent();
platform->StopPathing();
EXPECT_EQ(mover->mState, 12u);
entity.Update(1.0f);
EXPECT_EQ(mover->mState, 12u);
EXPECT_EQ(mover->mCurrentWaypointIndex, 0u);
}
{
info.settings.Insert<bool>(u"startPathingOnLoad", false);
Entity entity(288300744895900117, info);
info.settings.values.clear();
auto* const platform = entity.AddComponent<MovingPlatformComponent>(41, "");
auto* const mover = platform->GetSimpleMoverSubComponent();
EXPECT_EQ(mover->mState, 12u);
entity.Update(1.0f);
EXPECT_EQ(mover->mState, 12u);
}
}