26 struct FeatureToggle {
30 ::ll::TypedStorage<4, 4, ::FeatureOptionID> featureID;
31 ::ll::TypedStorage<4, 4, ::FeatureOptionID> dependencyFeatureID;
32 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Option>> option;
33 ::ll::TypedStorage<8, 64, ::std::function<void(
::Option&)>> setup;
34 ::ll::TypedStorage<8, 64, ::std::function<void(
bool&)>> lock;
35 ::ll::TypedStorage<4, 4, ::FeatureOptionTabID> tabID;
40 FeatureToggle& operator=(FeatureToggle
const&);
41 FeatureToggle(FeatureToggle
const&);
49 MCAPI ~FeatureToggle();
59 using ExpectedDisabled = ::std::vector<::FeatureOptionID>;
61 using ExpectedEnabled = ::std::vector<::FeatureOptionID>;
63 using FeatureTogglesArray = ::std::vector<::FeatureToggles::FeatureToggle>;
65 using LockFunction = ::std::function<void(
bool&)>;
67 using SetupFunction = ::std::function<void(
::Option&)>;
72 ::ll::TypedStorage<8, 24, ::std::vector<::FeatureToggles::FeatureToggle>> mFeatures;
73 ::ll::TypedStorage<8, 24, ::std::vector<::Bedrock::PubSub::Subscription>> mOptionLockSubscriptions;
74 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mFilePath;
75 ::ll::TypedStorage<1, 1, bool> mIsInGame;
85 virtual ~FeatureToggles() ;
93 MCAPI ::std::function<void(
::Option&)> _getDisabledIfOptionExpectationsNotMetSetupCallback(
94 ::std::vector<::FeatureOptionID> expectedDisabledOptions,
95 ::std::vector<::FeatureOptionID> expectedEnabledOptions
98 MCAPI ::std::function<void(
bool&)> _getLockIfInGameOrOptionExpectationsNotMetLockCallback(
99 ::std::vector<::FeatureOptionID> expectedDisabledOptions,
100 ::std::vector<::FeatureOptionID> expectedEnabledOptions
105 MCAPI
void _registerFeature(
106 ::FeatureOptionTabID tabID,
107 ::FeatureOptionID featureID,
108 ::std::string
const& locName,
109 ::std::string
const& saveName,
111 ::FeatureOptionID dependencyFeatureID,
112 ::std::function<
void(
::Option&)> setup,
113 ::std::function<
void(
bool&)> lock
116 MCAPI
void _registerFeatures();
118 MCAPI
void _setupDependencies();
120 MCAPI ::Option* get(::FeatureOptionID featureID);
123 MCAPI ::FeatureOptionID getFeatureIDFromSaveTag(::std::string_view featureSaveTag)
const;
126 MCAPI
bool isEnabled(::FeatureOptionID featureID)
const;
129 MCFOLD
bool isGraniteBayFeatureEnabled()
const;
136 MCAPI static ::std::unique_ptr<::FeatureToggles>& mFeatureToggles();