diff --git a/OpenRA.Game/Traits/Player/DeveloperMode.cs b/OpenRA.Game/Traits/Player/DeveloperMode.cs index 485b3b2325..b3627627bc 100644 --- a/OpenRA.Game/Traits/Player/DeveloperMode.cs +++ b/OpenRA.Game/Traits/Player/DeveloperMode.cs @@ -56,7 +56,7 @@ namespace OpenRA.Traits public void ResolveOrder(Actor self, Order order) { - if (!self.World.LobbyInfo.GlobalSettings.AllowCheats) + if (!self.World.AllowDevCommands) return; switch(order.OrderString) diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index 4c3d4ce498..d0ffe74202 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -71,6 +71,11 @@ namespace OpenRA get { return orderManager.Connection is ReplayConnection; } } + public bool AllowDevCommands + { + get { return LobbyInfo.GlobalSettings.AllowCheats || LobbyInfo.IsSinglePlayer; } + } + public void SetLocalPlayer(string pr) { if (IsReplay) diff --git a/OpenRA.Mods.RA/Console/DevCommands.cs b/OpenRA.Mods.RA/Console/DevCommands.cs index 52c2cbd011..1a2ba4a548 100644 --- a/OpenRA.Mods.RA/Console/DevCommands.cs +++ b/OpenRA.Mods.RA/Console/DevCommands.cs @@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA public void InvokeCommand(string name, string arg) { - if (!world.LobbyInfo.GlobalSettings.AllowCheats) + if (!world.AllowDevCommands) { Game.Debug("Cheats are disabled."); return; diff --git a/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs b/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs index a4498859bb..22f45314d7 100644 --- a/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs +++ b/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs @@ -96,7 +96,7 @@ namespace OpenRA.Mods.RA if (unit == null || !unit.Traits.Contains()) return 0; - if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait().FastBuild) + if (self.World.AllowDevCommands && self.Owner.PlayerActor.Trait().FastBuild) return 0; var time = (int)(unit.GetBuildTime() * Info.BuildSpeed); diff --git a/OpenRA.Mods.RA/Player/ProductionQueue.cs b/OpenRA.Mods.RA/Player/ProductionQueue.cs index 1e248d2c92..4dd1f06882 100644 --- a/OpenRA.Mods.RA/Player/ProductionQueue.cs +++ b/OpenRA.Mods.RA/Player/ProductionQueue.cs @@ -184,7 +184,7 @@ namespace OpenRA.Mods.RA public virtual IEnumerable AllItems() { - if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait().AllTech) + if (self.World.AllowDevCommands && self.Owner.PlayerActor.Trait().AllTech) return Produceable.Select(a => a.Key); return Produceable.Where(a => a.Value.Buildable || a.Value.Visible).Select(a => a.Key); @@ -192,7 +192,7 @@ namespace OpenRA.Mods.RA public virtual IEnumerable BuildableItems() { - if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait().AllTech) + if (self.World.AllowDevCommands && self.Owner.PlayerActor.Trait().AllTech) return Produceable.Select(a => a.Key); return Produceable.Where(a => a.Value.Buildable).Select(a => a.Key); @@ -289,7 +289,7 @@ namespace OpenRA.Mods.RA if (unit == null || ! unit.Traits.Contains()) return 0; - if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait().FastBuild) + if (self.World.AllowDevCommands && self.Owner.PlayerActor.Trait().FastBuild) return 0; var time = unit.GetBuildTime() * Info.BuildSpeed;