This commit is contained in:
Pavlos Touboulidis
2014-06-13 15:55:48 +03:00
parent 0cf2d608e4
commit 3f2425f1d6

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -14,16 +14,16 @@ namespace OpenRA.Traits
{ {
public int Cash = 20000; public int Cash = 20000;
public int ResourceGrowth = 100; public int ResourceGrowth = 100;
public bool FastBuild = false; public bool FastBuild;
public bool FastCharge = false; public bool FastCharge;
public bool DisableShroud = false; public bool DisableShroud;
public bool PathDebug = false; public bool PathDebug;
public bool UnlimitedPower; public bool UnlimitedPower;
public bool BuildAnywhere; public bool BuildAnywhere;
public bool ShowCombatGeometry; public bool ShowCombatGeometry;
public bool ShowDebugGeometry; public bool ShowDebugGeometry;
public object Create (ActorInitializer init) { return new DeveloperMode(this); } public object Create(ActorInitializer init) { return new DeveloperMode(this); }
} }
public class DeveloperMode : IResolveOrder, ISync public class DeveloperMode : IResolveOrder, ISync
@@ -37,7 +37,7 @@ namespace OpenRA.Traits
[Sync] public bool UnlimitedPower; [Sync] public bool UnlimitedPower;
[Sync] public bool BuildAnywhere; [Sync] public bool BuildAnywhere;
// Client size only // Client side only
public bool ShowCombatGeometry; public bool ShowCombatGeometry;
public bool ShowDebugGeometry; public bool ShowDebugGeometry;
@@ -54,9 +54,10 @@ namespace OpenRA.Traits
ShowDebugGeometry = info.ShowDebugGeometry; ShowDebugGeometry = info.ShowDebugGeometry;
} }
public void ResolveOrder (Actor self, Order order) public void ResolveOrder(Actor self, Order order)
{ {
if (!self.World.LobbyInfo.GlobalSettings.AllowCheats) return; if (!self.World.LobbyInfo.GlobalSettings.AllowCheats)
return;
switch(order.OrderString) switch(order.OrderString)
{ {
@@ -65,22 +66,26 @@ namespace OpenRA.Traits
AllTech ^= true; AllTech ^= true;
break; break;
} }
case "DevFastCharge": case "DevFastCharge":
{ {
FastCharge ^= true; FastCharge ^= true;
break; break;
} }
case "DevFastBuild": case "DevFastBuild":
{ {
FastBuild ^= true; FastBuild ^= true;
break; break;
} }
case "DevGiveCash": case "DevGiveCash":
{ {
var amount = order.ExtraData != 0 ? (int)order.ExtraData : Info.Cash; var amount = order.ExtraData != 0 ? (int)order.ExtraData : Info.Cash;
self.Trait<PlayerResources>().GiveCash(amount); self.Trait<PlayerResources>().GiveCash(amount);
break; break;
} }
case "DevGrowResources": case "DevGrowResources":
{ {
foreach (var a in self.World.ActorsWithTrait<ISeedableResource>()) foreach (var a in self.World.ActorsWithTrait<ISeedableResource>())
@@ -90,6 +95,7 @@ namespace OpenRA.Traits
} }
break; break;
} }
case "DevShroudDisable": case "DevShroudDisable":
{ {
DisableShroud ^= true; DisableShroud ^= true;
@@ -98,38 +104,42 @@ namespace OpenRA.Traits
self.World.RenderPlayer = DisableShroud ? null : self.Owner; self.World.RenderPlayer = DisableShroud ? null : self.Owner;
break; break;
} }
case "DevPathDebug": case "DevPathDebug":
{ {
PathDebug ^= true; PathDebug ^= true;
break; break;
} }
case "DevGiveExploration": case "DevGiveExploration":
{ {
self.Owner.Shroud.ExploreAll(self.World); self.Owner.Shroud.ExploreAll(self.World);
break; break;
} }
case "DevResetExploration": case "DevResetExploration":
{ {
self.Owner.Shroud.ResetExploration(); self.Owner.Shroud.ResetExploration();
break; break;
} }
case "DevUnlimitedPower": case "DevUnlimitedPower":
{ {
UnlimitedPower ^= true; UnlimitedPower ^= true;
break; break;
} }
case "DevBuildAnywhere": case "DevBuildAnywhere":
{ {
BuildAnywhere ^= true; BuildAnywhere ^= true;
break; break;
} }
default: default:
return; return;
} }
Game.Debug("Cheat used: {0} by {1}" Game.Debug("Cheat used: {0} by {1}".F(order.OrderString, self.Owner.PlayerName));
.F(order.OrderString, self.Owner.PlayerName));
} }
} }
} }