Move cheats option to rules.
This commit is contained in:
@@ -58,7 +58,6 @@ namespace OpenRA
|
||||
|
||||
public class MapOptions
|
||||
{
|
||||
public bool? Cheats;
|
||||
public bool? Crates;
|
||||
public bool? Creeps;
|
||||
public bool? Fog;
|
||||
@@ -72,8 +71,6 @@ namespace OpenRA
|
||||
|
||||
public void UpdateServerSettings(Session.Global settings)
|
||||
{
|
||||
if (Cheats.HasValue)
|
||||
settings.AllowCheats = Cheats.Value;
|
||||
if (Crates.HasValue)
|
||||
settings.Crates = Crates.Value;
|
||||
if (Creeps.HasValue)
|
||||
|
||||
@@ -14,17 +14,46 @@ namespace OpenRA.Traits
|
||||
[Desc("Attach this to the player actor.")]
|
||||
public class DeveloperModeInfo : ITraitInfo
|
||||
{
|
||||
[Desc("Default value of the developer mode checkbox in the lobby.")]
|
||||
public bool Enabled = false;
|
||||
|
||||
[Desc("Prevent the developer mode state from being changed in the lobby.")]
|
||||
public bool Locked = false;
|
||||
|
||||
[Desc("Default cash bonus granted by the give cash cheat.")]
|
||||
public int Cash = 20000;
|
||||
|
||||
[Desc("Growth steps triggered by the grow resources button.")]
|
||||
public int ResourceGrowth = 100;
|
||||
|
||||
[Desc("Enable the fast build cheat by default.")]
|
||||
public bool FastBuild;
|
||||
|
||||
[Desc("Enable the fast support powers cheat by default.")]
|
||||
public bool FastCharge;
|
||||
|
||||
[Desc("Enable the disable visibility cheat by default.")]
|
||||
public bool DisableShroud;
|
||||
public bool PathDebug;
|
||||
|
||||
[Desc("Enable the unlimited power cheat by default.")]
|
||||
public bool UnlimitedPower;
|
||||
|
||||
[Desc("Enable the build anywhere cheat by default.")]
|
||||
public bool BuildAnywhere;
|
||||
|
||||
[Desc("Enable the path debug overlay by default.")]
|
||||
public bool PathDebug;
|
||||
|
||||
[Desc("Enable the combat geometry overlay by default.")]
|
||||
public bool ShowCombatGeometry;
|
||||
|
||||
[Desc("Enable the debug geometry overlay by default.")]
|
||||
public bool ShowDebugGeometry;
|
||||
|
||||
[Desc("Enable the depth buffer overlay by default.")]
|
||||
public bool ShowDepthPreview;
|
||||
|
||||
[Desc("Enable the actor tags overlay by default.")]
|
||||
public bool ShowActorTags;
|
||||
|
||||
public object Create(ActorInitializer init) { return new DeveloperMode(this); }
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
|
||||
@@ -163,7 +163,6 @@ ServerTraits:
|
||||
LobbySettingsNotification
|
||||
|
||||
LobbyDefaults:
|
||||
AllowCheats: false
|
||||
Crates: true
|
||||
StartingUnitsClass: light
|
||||
FragileAlliances: false
|
||||
|
||||
@@ -156,7 +156,6 @@ ServerTraits:
|
||||
LobbySettingsNotification
|
||||
|
||||
LobbyDefaults:
|
||||
AllowCheats: false
|
||||
Crates: true
|
||||
StartingUnitsClass: none
|
||||
FragileAlliances: false
|
||||
|
||||
@@ -166,7 +166,6 @@ ServerTraits:
|
||||
LobbySettingsNotification
|
||||
|
||||
LobbyDefaults:
|
||||
AllowCheats: false
|
||||
Crates: true
|
||||
StartingUnitsClass: none
|
||||
FragileAlliances: false
|
||||
|
||||
@@ -215,7 +215,6 @@ ServerTraits:
|
||||
LobbySettingsNotification
|
||||
|
||||
LobbyDefaults:
|
||||
AllowCheats: true
|
||||
Crates: true
|
||||
StartingUnitsClass: none
|
||||
FragileAlliances: false
|
||||
|
||||
@@ -42,6 +42,7 @@ Player:
|
||||
PlayerResources:
|
||||
ActorGroupProxy:
|
||||
DeveloperMode:
|
||||
Enabled: true
|
||||
Shroud:
|
||||
FrozenActorLayer:
|
||||
BaseAttackNotifier:
|
||||
|
||||
Reference in New Issue
Block a user