Merge pull request #5631 from pavlos256/dev-iddqd
Add "/all" dev command
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
@@ -29,26 +30,25 @@ namespace OpenRA.Mods.RA
|
||||
var console = world.WorldActor.Trait<ChatCommands>();
|
||||
var help = world.WorldActor.Trait<HelpCommand>();
|
||||
|
||||
console.RegisterCommand("disableshroud", this);
|
||||
console.RegisterCommand("givecash", this);
|
||||
console.RegisterCommand("instantbuild", this);
|
||||
console.RegisterCommand("buildanywhere", this);
|
||||
console.RegisterCommand("unlimitedpower", this);
|
||||
console.RegisterCommand("enabletech", this);
|
||||
console.RegisterCommand("instantcharge", this);
|
||||
Action<string, string> register = (name, helpText) =>
|
||||
{
|
||||
console.RegisterCommand(name, this);
|
||||
help.RegisterHelp(name, helpText);
|
||||
};
|
||||
|
||||
help.RegisterHelp("disableshroud", "toggles shroud.");
|
||||
help.RegisterHelp("givecash", "gives the default or specified amount of money.");
|
||||
help.RegisterHelp("instantbuild", "toggles instant building.");
|
||||
help.RegisterHelp("buildanywhere", "toggles you the ability to build anywhere.");
|
||||
help.RegisterHelp("unlimitedpower", "toggles infinite power.");
|
||||
help.RegisterHelp("enabletech", "toggles the ability to build everything.");
|
||||
help.RegisterHelp("instantcharge", "toggles instant support power charging.");
|
||||
register("disableshroud", "toggles shroud.");
|
||||
register("givecash", "gives the default or specified amount of money.");
|
||||
register("instantbuild", "toggles instant building.");
|
||||
register("buildanywhere", "toggles you the ability to build anywhere.");
|
||||
register("unlimitedpower", "toggles infinite power.");
|
||||
register("enabletech", "toggles the ability to build everything.");
|
||||
register("instantcharge", "toggles instant support power charging.");
|
||||
register("all", "toggles all cheats and gives you some cash for your trouble.");
|
||||
}
|
||||
|
||||
public void InvokeCommand(string name, string arg)
|
||||
{
|
||||
if (!world.LobbyInfo.GlobalSettings.AllowCheats)
|
||||
if (!world.AllowDevCommands)
|
||||
{
|
||||
Game.Debug("Cheats are disabled.");
|
||||
return;
|
||||
@@ -74,6 +74,16 @@ namespace OpenRA.Mods.RA
|
||||
case "unlimitedpower": IssueDevCommand(world, "DevUnlimitedPower"); break;
|
||||
case "enabletech": IssueDevCommand(world, "DevEnableTech"); break;
|
||||
case "instantcharge": IssueDevCommand(world, "DevFastCharge"); break;
|
||||
|
||||
case "all":
|
||||
IssueDevCommand(world, "DevShroudDisable");
|
||||
IssueDevCommand(world, "DevFastBuild");
|
||||
IssueDevCommand(world, "DevBuildAnywhere");
|
||||
IssueDevCommand(world, "DevUnlimitedPower");
|
||||
IssueDevCommand(world, "DevEnableTech");
|
||||
IssueDevCommand(world, "DevFastCharge");
|
||||
IssueDevCommand(world, "DevGiveCash");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.RA
|
||||
if (unit == null || !unit.Traits.Contains<BuildableInfo>())
|
||||
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;
|
||||
|
||||
var time = (int)(unit.GetBuildTime() * Info.BuildSpeed);
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
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.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()
|
||||
{
|
||||
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.Where(a => a.Value.Buildable).Select(a => a.Key);
|
||||
@@ -289,7 +289,7 @@ namespace OpenRA.Mods.RA
|
||||
if (unit == null || ! unit.Traits.Contains<BuildableInfo>())
|
||||
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;
|
||||
|
||||
var time = unit.GetBuildTime() * Info.BuildSpeed;
|
||||
|
||||
Reference in New Issue
Block a user