From 73f18fc5bffa1def8320a32e27277e5869df692f Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Sat, 28 Nov 2026 11:10:07 -0600 Subject: [PATCH] fix(platforms): rotate_while_idle chooses the subcomponent when all types are set false As the client: a rotater when true, else a mover. Co-Authored-By: Claude Opus 5.5 --- dGame/dComponents/MovingPlatformComponent.cpp | 4 ++++ .../MovingPlatformComponentTests.cpp | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/dGame/dComponents/MovingPlatformComponent.cpp b/dGame/dComponents/MovingPlatformComponent.cpp index 932ba91f6..e2ebb47c2 100644 --- a/dGame/dComponents/MovingPlatformComponent.cpp +++ b/dGame/dComponents/MovingPlatformComponent.cpp @@ -118,6 +118,10 @@ std::vector ChooseSubComponentTypes(const int32_t compon if (setMover && entity.GetVar(u"platformIsMover")) types.push_back(eMoverSubComponentType::mover); if (setSimpleMover && entity.GetVar(u"platformIsSimpleMover")) types.push_back(eMoverSubComponentType::simpleMover); if (setRotater && entity.GetVar(u"platformIsRotater")) types.push_back(eMoverSubComponentType::rotater); + // All set false: rotate_while_idle makes it a rotater, or a mover when false + if (types.empty() && entity.HasVar(u"rotate_while_idle")) { + types.push_back(entity.GetVar(u"rotate_while_idle") ? eMoverSubComponentType::rotater : eMoverSubComponentType::mover); + } return types; } diff --git a/tests/dGameTests/dComponentsTests/MovingPlatformComponentTests.cpp b/tests/dGameTests/dComponentsTests/MovingPlatformComponentTests.cpp index c9e5032ee..40b01fa21 100644 --- a/tests/dGameTests/dComponentsTests/MovingPlatformComponentTests.cpp +++ b/tests/dGameTests/dComponentsTests/MovingPlatformComponentTests.cpp @@ -95,6 +95,20 @@ TEST_F(MovingPlatformComponentTest, SubcomponentTypeFromLevelConfig) { Entity none(288300744895900106, info); EXPECT_EQ(ChooseMoverSubComponentType(41, none), eMoverSubComponentType::none); + // All false with rotate_while_idle: a rotater when it is true, else a mover; without the type settings it does + // nothing + info.settings.Insert(u"rotate_while_idle", true); + Entity idleRotater(288300744895900107, info); + EXPECT_EQ(ChooseMoverSubComponentType(41, idleRotater), eMoverSubComponentType::rotater); + info.settings.values.clear(); + info.settings.Insert(u"platformIsRotater", false); + info.settings.Insert(u"rotate_while_idle", false); + Entity idleMover(288300744895900108, info); + EXPECT_EQ(ChooseMoverSubComponentType(41, idleMover), eMoverSubComponentType::mover); + info.settings.values.clear(); + info.settings.Insert(u"rotate_while_idle", true); + Entity idleOnly(288300744895900111, info); + EXPECT_EQ(ChooseMoverSubComponentType(41, idleOnly), eMoverSubComponentType::simpleMover); info.settings.values.clear(); }