Move cheats option to rules.
This commit is contained in:
@@ -408,7 +408,8 @@ namespace OpenRA.Mods.Common.Server
|
||||
return true;
|
||||
}
|
||||
|
||||
if (server.Map.Options.Cheats.HasValue)
|
||||
var devMode = server.Map.Rules.Actors["player"].TraitInfo<DeveloperModeInfo>();
|
||||
if (devMode.Locked)
|
||||
{
|
||||
server.SendOrderTo(conn, "Message", "Map has disabled cheat configuration.");
|
||||
return true;
|
||||
@@ -1011,6 +1012,9 @@ namespace OpenRA.Mods.Common.Server
|
||||
.Where(s => s != null)
|
||||
.ToDictionary(s => s.PlayerReference, s => s);
|
||||
|
||||
var gs = server.LobbyInfo.GlobalSettings;
|
||||
var devMode = server.Map.Rules.Actors["player"].TraitInfo<DeveloperModeInfo>();
|
||||
gs.AllowCheats = devMode.Enabled;
|
||||
server.Map.Options.UpdateServerSettings(server.LobbyInfo.GlobalSettings);
|
||||
}
|
||||
|
||||
|
||||
@@ -349,8 +349,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var allowCheats = optionsBin.GetOrNull<CheckboxWidget>("ALLOWCHEATS_CHECKBOX");
|
||||
if (allowCheats != null)
|
||||
{
|
||||
var cheatsLocked = new CachedTransform<Map, bool>(
|
||||
map => map.Rules.Actors["player"].TraitInfo<DeveloperModeInfo>().Locked);
|
||||
|
||||
allowCheats.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.AllowCheats;
|
||||
allowCheats.IsDisabled = () => configurationDisabled() || Map.Options.Cheats.HasValue;
|
||||
allowCheats.IsDisabled = () => configurationDisabled() || cheatsLocked.Update(Map);
|
||||
allowCheats.OnClick = () => orderManager.IssueOrder(Order.Command(
|
||||
"allowcheats {0}".F(!orderManager.LobbyInfo.GlobalSettings.AllowCheats)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user