Always allow cheats on single player games

This commit is contained in:
Pavlos Touboulidis
2014-06-13 16:27:00 +03:00
parent d22658011b
commit ee4f3e5642
5 changed files with 11 additions and 6 deletions

View File

@@ -56,7 +56,7 @@ namespace OpenRA.Traits
public void ResolveOrder(Actor self, Order order) public void ResolveOrder(Actor self, Order order)
{ {
if (!self.World.LobbyInfo.GlobalSettings.AllowCheats) if (!self.World.AllowDevCommands)
return; return;
switch(order.OrderString) switch(order.OrderString)

View File

@@ -71,6 +71,11 @@ namespace OpenRA
get { return orderManager.Connection is ReplayConnection; } get { return orderManager.Connection is ReplayConnection; }
} }
public bool AllowDevCommands
{
get { return LobbyInfo.GlobalSettings.AllowCheats || LobbyInfo.IsSinglePlayer; }
}
public void SetLocalPlayer(string pr) public void SetLocalPlayer(string pr)
{ {
if (IsReplay) if (IsReplay)

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA
public void InvokeCommand(string name, string arg) public void InvokeCommand(string name, string arg)
{ {
if (!world.LobbyInfo.GlobalSettings.AllowCheats) if (!world.AllowDevCommands)
{ {
Game.Debug("Cheats are disabled."); Game.Debug("Cheats are disabled.");
return; return;

View File

@@ -96,7 +96,7 @@ namespace OpenRA.Mods.RA
if (unit == null || !unit.Traits.Contains<BuildableInfo>()) if (unit == null || !unit.Traits.Contains<BuildableInfo>())
return 0; return 0;
if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait<DeveloperMode>().FastBuild) if (self.World.AllowDevCommands && self.Owner.PlayerActor.Trait<DeveloperMode>().FastBuild)
return 0; return 0;
var time = (int)(unit.GetBuildTime() * Info.BuildSpeed); var time = (int)(unit.GetBuildTime() * Info.BuildSpeed);

View File

@@ -184,7 +184,7 @@ namespace OpenRA.Mods.RA
public virtual IEnumerable<ActorInfo> AllItems() public virtual IEnumerable<ActorInfo> AllItems()
{ {
if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait<DeveloperMode>().AllTech) if (self.World.AllowDevCommands && self.Owner.PlayerActor.Trait<DeveloperMode>().AllTech)
return Produceable.Select(a => a.Key); return Produceable.Select(a => a.Key);
return Produceable.Where(a => a.Value.Buildable || a.Value.Visible).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<ActorInfo> BuildableItems() public virtual IEnumerable<ActorInfo> BuildableItems()
{ {
if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait<DeveloperMode>().AllTech) if (self.World.AllowDevCommands && self.Owner.PlayerActor.Trait<DeveloperMode>().AllTech)
return Produceable.Select(a => a.Key); return Produceable.Select(a => a.Key);
return Produceable.Where(a => a.Value.Buildable).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<BuildableInfo>()) if (unit == null || ! unit.Traits.Contains<BuildableInfo>())
return 0; return 0;
if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait<DeveloperMode>().FastBuild) if (self.World.AllowDevCommands && self.Owner.PlayerActor.Trait<DeveloperMode>().FastBuild)
return 0; return 0;
var time = unit.GetBuildTime() * Info.BuildSpeed; var time = unit.GetBuildTime() * Info.BuildSpeed;