ModernUO/Projects/UOContent/Engines/FeatureFlags
Kamron Batman 12b0886cef
fix(feature-flags): custom flags no longer throw; removing a flag restores its real default (#2654)
Two bugs found while reworking #2653.

**Custom flags throw.** `SyncStaticFlag` is a switch expression with no discard arm, so any key that has no static behind it throws `SwitchExpressionException`. `[FeatureFlag mykey create <category> <desc>` crashes in `CreateOrUpdateFlag`, and once such a key is in `flags.json`, every boot's `SyncAllStaticFlags()` throws mid-iteration — caught and logged as "Failed to load feature flags", but stock flags later in dictionary order never sync. Added `_ => enabled`.

**Removing a flag turns some features on.** `RemoveFlag` hardcoded `SyncStaticFlag(flagKey, true)`. For `speedhack_detection` and `insurance` the real default is `false` / `insurance.enable`, so deleting the flag enabled the feature. It now syncs the removed flag's `DefaultEnabled`, which #2653 seeds from the static.

Verified: `dotnet build Projects/UOContent/UOContent.csproj -c Release`, 0 `CS` diagnostics (post-build copy to `Distribution/` was blocked by a running server instance).
2026-09-18 19:25:39 -07:00
..
ContentFeatureFlags.cs feat: expand cache to nearly all mobiles + dynamic-obstacle pass (#2447) 2026-05-06 00:14:08 -07:00
FeatureFlagAdminGump.cs feat: Adds Feature Flag System (#2328) 2026-02-07 12:02:57 -08:00
FeatureFlagCommands.cs feat: Adds Feature Flag System (#2328) 2026-02-07 12:02:57 -08:00
FeatureFlagManager.cs fix(feature-flags): custom flags no longer throw; removing a flag restores its real default (#2654) 2026-09-18 19:25:39 -07:00
FeatureFlagSettings.cs feat: Adds Feature Flag System (#2328) 2026-02-07 12:02:57 -08:00