From fe527c129739617659244a2a4db67480a4457f31 Mon Sep 17 00:00:00 2001 From: alzeih Date: Sat, 24 Jul 2010 20:04:21 +1200 Subject: [PATCH] Some of DeveloperMode trait (not working yet) --- OpenRA.Game/OpenRA.Game.csproj | 1 + OpenRA.Game/Traits/Player/DeveloperMode.cs | 46 ++++++++++++++++++++++ mods/ra/system.yaml | 1 + 3 files changed, 48 insertions(+) create mode 100644 OpenRA.Game/Traits/Player/DeveloperMode.cs diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 3c9e1d3282..7c1ab66ffb 100755 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -229,6 +229,7 @@ + diff --git a/OpenRA.Game/Traits/Player/DeveloperMode.cs b/OpenRA.Game/Traits/Player/DeveloperMode.cs new file mode 100644 index 0000000000..fe3e4ed2bf --- /dev/null +++ b/OpenRA.Game/Traits/Player/DeveloperMode.cs @@ -0,0 +1,46 @@ +#region Copyright & License Information +/* + * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) + * 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 + * as published by the Free Software Foundation. For more information, + * see LICENSE. + */ +#endregion + +using System; +namespace OpenRA.Traits +{ + public class DeveloperModeInfo : ITraitInfo + { + public int InitialCash = 20000; + public int BuildSpeed = 1; + public int ChargeTime = 1; + + public object Create(ActorInitializer init) { return new DeveloperMode(this); } + + } + + public class DeveloperMode : IResolveOrder + { + DeveloperModeInfo Info; + public DeveloperMode (DeveloperModeInfo info) + { + Info = info; + } + + public void ResolveOrder (Actor self, Order order) + { + switch (order.OrderString) + { + case "DevModeGiveCash": + self.World.AddFrameEndTask( w => + { + self.Owner.PlayerActor.traits.Get().GiveCash(Info.InitialCash); + }); + break; + } + } + } +} + diff --git a/mods/ra/system.yaml b/mods/ra/system.yaml index e0db906d9a..38bdfb9513 100644 --- a/mods/ra/system.yaml +++ b/mods/ra/system.yaml @@ -82,6 +82,7 @@ Player: PlayerResources: InitialCash: 5000 ActorGroupProxy: + DeveloperMode: World: