added cheat command to give money to all the players and AI
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
@@ -37,6 +38,7 @@ namespace OpenRA.Mods.Common.Commands
|
|||||||
|
|
||||||
register("disableshroud", "toggles shroud.");
|
register("disableshroud", "toggles shroud.");
|
||||||
register("givecash", "gives the default or specified amount of money.");
|
register("givecash", "gives the default or specified amount of money.");
|
||||||
|
register("givecashall", "gives the default or specified amount of money to all players and ai.");
|
||||||
register("instantbuild", "toggles instant building.");
|
register("instantbuild", "toggles instant building.");
|
||||||
register("buildanywhere", "toggles you the ability to build anywhere.");
|
register("buildanywhere", "toggles you the ability to build anywhere.");
|
||||||
register("unlimitedpower", "toggles infinite power.");
|
register("unlimitedpower", "toggles infinite power.");
|
||||||
@@ -63,15 +65,27 @@ namespace OpenRA.Mods.Common.Commands
|
|||||||
case "givecash":
|
case "givecash":
|
||||||
var givecashorder = new Order("DevGiveCash", world.LocalPlayer.PlayerActor, false);
|
var givecashorder = new Order("DevGiveCash", world.LocalPlayer.PlayerActor, false);
|
||||||
int cash;
|
int cash;
|
||||||
|
int.TryParse(arg, out cash);
|
||||||
|
|
||||||
if (int.TryParse(arg, out cash))
|
givecashorder.ExtraData = (uint)cash;
|
||||||
givecashorder.ExtraData = (uint)cash;
|
|
||||||
|
|
||||||
Game.Debug("Giving {0} credits to player {1}.", cash == 0 ? "cheat default" : cash.ToString(CultureInfo.InvariantCulture), world.LocalPlayer.PlayerName);
|
Game.Debug("Giving {0} credits to player {1}.", cash == 0 ? "cheat default" : cash.ToString(CultureInfo.InvariantCulture), world.LocalPlayer.PlayerName);
|
||||||
world.IssueOrder(givecashorder);
|
world.IssueOrder(givecashorder);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "givecashall":
|
||||||
|
int.TryParse(arg, out cash);
|
||||||
|
|
||||||
|
foreach (var player in world.Players.Where(p => !p.NonCombatant))
|
||||||
|
{
|
||||||
|
var givecashall = new Order("DevGiveCash", player.PlayerActor, false);
|
||||||
|
givecashall.ExtraData = (uint)cash;
|
||||||
|
Game.Debug("Giving {0} credits to player {1}.", cash == 0 ? "cheat default" : cash.ToString(CultureInfo.InvariantCulture), player.PlayerName);
|
||||||
|
world.IssueOrder(givecashall);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case "disableshroud": IssueDevCommand(world, "DevShroudDisable"); break;
|
case "disableshroud": IssueDevCommand(world, "DevShroudDisable"); break;
|
||||||
case "instantbuild": IssueDevCommand(world, "DevFastBuild"); break;
|
case "instantbuild": IssueDevCommand(world, "DevFastBuild"); break;
|
||||||
case "buildanywhere": IssueDevCommand(world, "DevBuildAnywhere"); break;
|
case "buildanywhere": IssueDevCommand(world, "DevBuildAnywhere"); break;
|
||||||
|
|||||||
Reference in New Issue
Block a user