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 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-28 11:10:07 -06:00
parent 908d1954bd
commit 73f18fc5bf
2 changed files with 18 additions and 0 deletions

View File

@@ -118,6 +118,10 @@ std::vector<eMoverSubComponentType> ChooseSubComponentTypes(const int32_t compon
if (setMover && entity.GetVar<bool>(u"platformIsMover")) types.push_back(eMoverSubComponentType::mover);
if (setSimpleMover && entity.GetVar<bool>(u"platformIsSimpleMover")) types.push_back(eMoverSubComponentType::simpleMover);
if (setRotater && entity.GetVar<bool>(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<bool>(u"rotate_while_idle") ? eMoverSubComponentType::rotater : eMoverSubComponentType::mover);
}
return types;
}

View File

@@ -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<bool>(u"rotate_while_idle", true);
Entity idleRotater(288300744895900107, info);
EXPECT_EQ(ChooseMoverSubComponentType(41, idleRotater), eMoverSubComponentType::rotater);
info.settings.values.clear();
info.settings.Insert<bool>(u"platformIsRotater", false);
info.settings.Insert<bool>(u"rotate_while_idle", false);
Entity idleMover(288300744895900108, info);
EXPECT_EQ(ChooseMoverSubComponentType(41, idleMover), eMoverSubComponentType::mover);
info.settings.values.clear();
info.settings.Insert<bool>(u"rotate_while_idle", true);
Entity idleOnly(288300744895900111, info);
EXPECT_EQ(ChooseMoverSubComponentType(41, idleOnly), eMoverSubComponentType::simpleMover);
info.settings.values.clear();
}