mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-20 18:55:28 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -172,9 +172,11 @@ void MovingPlatformComponent::LoadConfigData() {
|
|||||||
SetupMoverPath();
|
SetupMoverPath();
|
||||||
} else if (m_MoverSubComponentType == eMoverSubComponentType::rotater) {
|
} else if (m_MoverSubComponentType == eMoverSubComponentType::rotater) {
|
||||||
// LWOPlatformRotator: it only spins (rotX/rotY/rotZ at rate, its own path never arrives anywhere: its
|
// 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<bool>(u"startPathingOnLoad");
|
const bool startOnLoad = !m_Parent->HasVar(u"startPathingOnLoad") || m_Parent->GetVar<bool>(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
|
// Live constructed every moving platform with simple physics as keyframed
|
||||||
@@ -381,7 +383,8 @@ void MovingPlatformComponent::StartPathing() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_MoverSubComponentType == eMoverSubComponentType::rotater) {
|
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;
|
GetMoverSubComponent()->mState = ePlatformStateFlag::Travelling;
|
||||||
Game::entityManager->SerializeEntity(m_Parent);
|
Game::entityManager->SerializeEntity(m_Parent);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -158,6 +158,10 @@ TEST_F(MovingPlatformComponentTest, RotaterIsWrittenAsTypeSix) {
|
|||||||
ASSERT_EQ(platform->GetMoverSubComponentType(), eMoverSubComponentType::rotater);
|
ASSERT_EQ(platform->GetMoverSubComponentType(), eMoverSubComponentType::rotater);
|
||||||
ASSERT_NE(platform->GetMoverSubComponent(), nullptr);
|
ASSERT_NE(platform->GetMoverSubComponent(), nullptr);
|
||||||
platform->SetSerialized(true);
|
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;
|
RakNet::BitStream stream;
|
||||||
platform->Serialize(stream, true);
|
platform->Serialize(stream, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user