From f6d0a48172958ee8fa08eeeed711e925f9784867 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Tue, 10 Nov 2026 13:40:30 -0600 Subject: [PATCH] fix(moving platform): a rotater without a path stays stopped at its waypoint Only a rotater on a path runs (LWOMovingPlatformComponent::SetupPlatform 0x00ccea50), and the client reads a platform that is not at a waypoint from its path's waypoints (LWOPlatform::Deserialize 0x00c870e0), which a rotater without a path does not have. It was sent travelling (2) whenever startPathingOnLoad was not false. No object in the client's maps is a rotater. Co-Authored-By: Claude Opus 5.5 --- dGame/dComponents/MovingPlatformComponent.cpp | 9 ++++++--- .../dComponentsTests/MovingPlatformComponentTests.cpp | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/dGame/dComponents/MovingPlatformComponent.cpp b/dGame/dComponents/MovingPlatformComponent.cpp index e1639db37..01ab84284 100644 --- a/dGame/dComponents/MovingPlatformComponent.cpp +++ b/dGame/dComponents/MovingPlatformComponent.cpp @@ -172,9 +172,11 @@ void MovingPlatformComponent::LoadConfigData() { SetupMoverPath(); } else if (m_MoverSubComponentType == eMoverSubComponentType::rotater) { // LWOPlatformRotator: it only spins (rotX/rotY/rotZ at rate, its own path never arrives anywhere: its - // HandleStoppedLogic 0x00bdc660 only keeps the angular velocity), while travelling + // HandleStoppedLogic 0x00bdc660 only keeps the angular velocity), while travelling. Only one on a path runs + // (LWOMovingPlatformComponent::SetupPlatform 0x00ccea50), and the client reads a platform that is not at a + // waypoint from its path (LWOPlatform::Deserialize 0x00c870e0), so one without a path stays as it was made (12). const bool startOnLoad = !m_Parent->HasVar(u"startPathingOnLoad") || m_Parent->GetVar(u"startPathingOnLoad"); - if (startOnLoad) GetMoverSubComponent()->mState = ePlatformStateFlag::Travelling; + if (startOnLoad && m_Path != nullptr) GetMoverSubComponent()->mState = ePlatformStateFlag::Travelling; } // Live constructed every moving platform with simple physics as keyframed @@ -381,7 +383,8 @@ void MovingPlatformComponent::StartPathing() { return; } if (m_MoverSubComponentType == eMoverSubComponentType::rotater) { - // LWOPlatformRotator::StartLinearMovement: spinning again + // LWOPlatformRotator::StartLinearMovement: spinning again (only on a path, as above) + if (m_Path == nullptr) return; GetMoverSubComponent()->mState = ePlatformStateFlag::Travelling; Game::entityManager->SerializeEntity(m_Parent); return; diff --git a/tests/dGameTests/dComponentsTests/MovingPlatformComponentTests.cpp b/tests/dGameTests/dComponentsTests/MovingPlatformComponentTests.cpp index dbfc654fb..ec0938172 100644 --- a/tests/dGameTests/dComponentsTests/MovingPlatformComponentTests.cpp +++ b/tests/dGameTests/dComponentsTests/MovingPlatformComponentTests.cpp @@ -158,6 +158,10 @@ TEST_F(MovingPlatformComponentTest, RotaterIsWrittenAsTypeSix) { ASSERT_EQ(platform->GetMoverSubComponentType(), eMoverSubComponentType::rotater); ASSERT_NE(platform->GetMoverSubComponent(), nullptr); platform->SetSerialized(true); + // Without a path it does not run: it stays stopped at its waypoint, also when started + EXPECT_EQ(platform->GetMoverSubComponent()->mState, 12u); + platform->StartPathing(); + EXPECT_EQ(platform->GetMoverSubComponent()->mState, 12u); RakNet::BitStream stream; platform->Serialize(stream, true);