refactor(component): moving platform subcomponents like the client's

PlatformSubComponent (LWOPlatform: the state between waypoints and its
serialization) is the base of MoverSubComponent (4), SimpleMoverSubComponent
(5) and the new RotatorSubComponent (6), as LWOPlatformMover,
LWOPlatformSimpleMover and LWOPlatformRotator are built on LWOPlatform. The
platform keeps one subcomponent per type the client makes
(LWOMovingPlatformComponent::SetupPlatform: one per platformIs* setting that
is true) and sends them all; the first is the one the server runs. Same bytes
for every platform with one subcomponent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-01 15:59:45 -05:00
parent 083c071853
commit bff3fe6363
3 changed files with 145 additions and 115 deletions

View File

@@ -77,6 +77,17 @@ TEST_F(MovingPlatformComponentTest, SubcomponentTypeFromLevelConfig) {
info.settings.values.clear();
}
// LWOMovingPlatformComponent::SetupPlatform: one subcomponent per setting that is true, mover, simple mover, rotater
TEST_F(MovingPlatformComponentTest, OneSubcomponentPerSetting) {
info.settings.Insert<bool>(u"platformIsRotater", true);
info.settings.Insert<bool>(u"platformIsMover", true);
Entity both(288300744895900107, info);
const std::vector expected{ eMoverSubComponentType::mover, eMoverSubComponentType::rotater };
EXPECT_EQ(ChooseSubComponentTypes(-1, both), expected);
EXPECT_EQ(ChooseMoverSubComponentType(-1, both), eMoverSubComponentType::mover);
info.settings.values.clear();
}
// Live: 1 (subcomponents), 1 (dirty), 0 (no path), 1, type 5, the starting point (the object's position and
// rotation, w first), state 9 (stopped at its desired waypoint), waypoint 0, not reversing, then the ending 0 bit
TEST_F(MovingPlatformComponentTest, SimpleMoverConstructionMatchesLive) {