From da4811abe89a01ed5400206676eee8a8774ca427 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 21 Aug 2011 18:59:20 +1200 Subject: [PATCH] rip out ActorStance garbage --- OpenRA.Editor/LegacyMapImporter.cs | 38 +++++---------------------- OpenRA.Game/OpenRA.Game.csproj | 1 - OpenRA.Game/Traits/ActorStance.cs | 42 ------------------------------ mods/cnc/maps/gdi01/map.yaml | 19 -------------- 4 files changed, 6 insertions(+), 94 deletions(-) delete mode 100644 OpenRA.Game/Traits/ActorStance.cs diff --git a/OpenRA.Editor/LegacyMapImporter.cs b/OpenRA.Editor/LegacyMapImporter.cs index b2f3db5a44..3f8bd17a32 100644 --- a/OpenRA.Editor/LegacyMapImporter.cs +++ b/OpenRA.Editor/LegacyMapImporter.cs @@ -379,38 +379,12 @@ namespace OpenRA.Editor if (!Players.Contains(parts[0])) Players.Add(parts[0]); - var stance = ActorStance.Stance.None; - switch (parts[5]) - { - case "Area Guard": - case "Guard": - stance = ActorStance.Stance.Guard; - break; - case "Defend Base": - stance = ActorStance.Stance.Defend; - break; - case "Hunt": - case "Rampage": - case "Attack Base": - case "Attack Units": - case "Attack Civil.": - case "Attack Tarcom": - stance = ActorStance.Stance.Hunt; - break; - case "Retreat": - case "Return": - stance = ActorStance.Stance.Retreat; - break; - // do we care about `Harvest' and `Sticky'? - } - var actor = new ActorReference(parts[1].ToLowerInvariant()) { new LocationInit(new int2(loc % MapSize, loc / MapSize)), new OwnerInit(parts[0]), new HealthInit(float.Parse(parts[2], NumberFormatInfo.InvariantInfo)/256), new FacingInit((section == "INFANTRY") ? int.Parse(parts[6]) : int.Parse(parts[4])), - new ActorStanceInit(stance), }; if (section == "INFANTRY") @@ -441,17 +415,17 @@ namespace OpenRA.Editor void LoadPlayer(IniFile file, string section, bool isRA) { - var c = (section == "BadGuy") ? "red" : - (isRA) ? "blue" : "gold"; + var c = section == "BadGuy" ? "red" : + isRA ? "blue" : "gold"; var color = namedColorMapping[c]; var pr = new PlayerReference { Name = section, - OwnsWorld = (section == "Neutral"), - NonCombatant = (section == "Neutral"), - Race = (isRA) ? ((section == "BadGuy") ? "soviet" : "allies") : ((section == "BadGuy") ? "nod" : "gdi"), + OwnsWorld = section == "Neutral", + NonCombatant = section == "Neutral", + Race = isRA ? (section == "BadGuy" ? "soviet" : "allies") : (section == "BadGuy" ? "nod" : "gdi"), ColorRamp = new ColorRamp( (byte)((color.First.GetHue() / 360.0f) * 255), (byte)(color.First.GetSaturation() * 255), @@ -459,7 +433,7 @@ namespace OpenRA.Editor (byte)(color.Second.GetBrightness() * 255)) }; - var Neutral = new List(){"Neutral"}; + var Neutral = new [] {"Neutral"}; foreach (var s in file.GetSection(section, true)) { Console.WriteLine(s.Key); diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 4777cc3cd5..58ba78a932 100755 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -168,7 +168,6 @@ - diff --git a/OpenRA.Game/Traits/ActorStance.cs b/OpenRA.Game/Traits/ActorStance.cs deleted file mode 100644 index b82ef17ef4..0000000000 --- a/OpenRA.Game/Traits/ActorStance.cs +++ /dev/null @@ -1,42 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2011 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 COPYING. - */ -#endregion - -using OpenRA.FileFormats; -namespace OpenRA.Traits -{ - class ActorStanceInfo : ITraitInfo - { - public object Create(ActorInitializer init) { return new ActorStance(init); } - } - - public class ActorStance - { - // Stances modify default actor behavior - public enum Stance - { - None, - Guard, // Stay near an actor/area; attack anything that comes near - Defend, // Come running if a bad guy comes in range of the defendee - Hunt, // Go searching for things to kill; will stray from move orders etc to follow target - Retreat // Actively avoid things which might kill me - } - - // Doesn't do anything... yet - public ActorStance(ActorInitializer init) {} - } - - public class ActorStanceInit : IActorInit - { - [FieldFromYamlKey] public readonly ActorStance.Stance value = ActorStance.Stance.None; - public ActorStanceInit() { } - public ActorStanceInit( ActorStance.Stance init ) { value = init; } - public ActorStance.Stance Value( World world ) { return value; } - } -} diff --git a/mods/cnc/maps/gdi01/map.yaml b/mods/cnc/maps/gdi01/map.yaml index 5f6936e186..080c4005be 100644 --- a/mods/cnc/maps/gdi01/map.yaml +++ b/mods/cnc/maps/gdi01/map.yaml @@ -308,128 +308,109 @@ Actors: Owner: BadGuy Health: 0.5 Facing: 160 - ActorStance: None Actor84: gun Location: 41,55 Owner: BadGuy Health: 0.5 Facing: 160 - ActorStance: None Actor85: gun Location: 49,55 Owner: BadGuy Health: 0.1875 Facing: 160 - ActorStance: None mcv: mcv Location: 56,53 Owner: GoodGuy Health: 1 Facing: 0 - ActorStance: Guard Gunboat: boat Location: 53,59 Owner: GoodGuy Health: 1 Facing: 64 - ActorStance: Hunt Actor88: e1 Location: 56,55 Owner: GoodGuy Health: 1 Facing: 0 - ActorStance: Guard SubCell: 2 Actor89: e1 Location: 56,55 Owner: GoodGuy Health: 1 Facing: 0 - ActorStance: Guard SubCell: 4 Actor90: e1 Location: 56,55 Owner: GoodGuy Health: 1 Facing: 0 - ActorStance: Guard SubCell: 3 Actor91: e1 Location: 56,55 Owner: GoodGuy Health: 1 Facing: 0 - ActorStance: Guard SubCell: 1 Actor92: e1 Location: 57,45 Owner: BadGuy Health: 1 Facing: 160 - ActorStance: Guard SubCell: 2 Actor93: e1 Location: 56,41 Owner: BadGuy Health: 1 Facing: 192 - ActorStance: Guard SubCell: 2 Actor94: e1 Location: 48,41 Owner: BadGuy Health: 1 Facing: 96 - ActorStance: Guard SubCell: 3 Actor95: e1 Location: 59,45 Owner: BadGuy Health: 1 Facing: 160 - ActorStance: Guard SubCell: 1 Actor96: e1 Location: 46,50 Owner: BadGuy Health: 1 Facing: 96 - ActorStance: Guard SubCell: 3 Actor97: e1 Location: 48,47 Owner: BadGuy Health: 1 Facing: 96 - ActorStance: Guard SubCell: 1 Actor98: e1 Location: 38,43 Owner: BadGuy Health: 1 Facing: 128 - ActorStance: Guard SubCell: 4 Actor99: e1 Location: 38,43 Owner: BadGuy Health: 1 Facing: 128 - ActorStance: Guard SubCell: 1 Actor100: e1 Location: 48,41 Owner: BadGuy Health: 1 Facing: 96 - ActorStance: Guard SubCell: 2 Actor101: e1 Location: 41,39 Owner: BadGuy Health: 1 Facing: 96 - ActorStance: Hunt SubCell: 4 spawn27: waypoint Location: 51,47