diff --git a/OpenRA.Editor/LegacyMapImporter.cs b/OpenRA.Editor/LegacyMapImporter.cs index 5134b58670..d6df6b656b 100644 --- a/OpenRA.Editor/LegacyMapImporter.cs +++ b/OpenRA.Editor/LegacyMapImporter.cs @@ -160,7 +160,6 @@ namespace OpenRA.Editor .Where(kv => int.Parse(kv.Value) > 0) .Select(kv => Pair.New(int.Parse(kv.Key), LocationFromMapOffset(int.Parse(kv.Value), MapSize))) - .Where(a => a.First < 8) .ToArray(); Map.PlayerCount = wp.Count(); @@ -373,14 +372,45 @@ namespace OpenRA.Editor if (!Players.Contains(parts[0])) Players.Add(parts[0]); - Map.Actors.Add("Actor" + ActorCount++, - new ActorReference(parts[1].ToLowerInvariant()) - { - new LocationInit(new int2(loc % MapSize, loc / MapSize)), - new OwnerInit(parts[0]), - new HealthInit(float.Parse(parts[2])/256), - new FacingInit((section == "INFANTRY") ? int.Parse(parts[6]) : int.Parse(parts[4])), - }); + 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])/256), + new FacingInit((section == "INFANTRY") ? int.Parse(parts[6]) : int.Parse(parts[4])), + new ActorStanceInit(stance), + }; + + if (section == "INFANTRY") + actor.Add(new SubcellInit(int.Parse(parts[4]))); + + Map.Actors.Add("Actor" + ActorCount++,actor); + } } @@ -407,7 +437,7 @@ namespace OpenRA.Editor Name = section, OwnsWorld = (section == "Neutral"), NonCombatant = (section == "Neutral"), - Race = (isRA) ? ((section == "BadGuy") ? "allies" : "soviet") : ((section == "BadGuy") ? "nod" : "gdi"), + Race = (isRA) ? ((section == "BadGuy") ? "soviet" : "allies") : ((section == "BadGuy") ? "nod" : "gdi"), Color = color.First, Color2 = color.Second, }; diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index f10b63cb46..e7e06f3170 100755 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -224,6 +224,7 @@ + diff --git a/OpenRA.Game/Traits/ActorStance.cs b/OpenRA.Game/Traits/ActorStance.cs new file mode 100644 index 0000000000..dc9399d9b4 --- /dev/null +++ b/OpenRA.Game/Traits/ActorStance.cs @@ -0,0 +1,52 @@ +#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 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/OpenRA.Game/Traits/SharesCell.cs b/OpenRA.Game/Traits/SharesCell.cs index e1c468a180..4229c39b39 100644 --- a/OpenRA.Game/Traits/SharesCell.cs +++ b/OpenRA.Game/Traits/SharesCell.cs @@ -1,3 +1,4 @@ +using OpenRA.FileFormats; #region Copyright & License Information /* * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) @@ -10,11 +11,19 @@ namespace OpenRA.Traits { - class SharesCellInfo : TraitInfo {} + class SharesCellInfo : ITraitInfo + { + public object Create(ActorInitializer init) { return new SharesCell(init); } + } public class SharesCell : IOffsetCenterLocation { [Sync] public int Position; + + public SharesCell(ActorInitializer init) + { + Position = init.Contains() ? init.Get() : 0; + } public float2 CenterOffset { get { @@ -32,5 +41,23 @@ namespace OpenRA.Traits return new float2(-5f, -5f); } }} + } + + public class SubcellInit : IActorInit + { + [FieldFromYamlKey] + public readonly int value = 0; + + public SubcellInit() { } + + public SubcellInit( int init ) + { + value = init; + } + + public int Value( World world ) + { + return value; + } } } diff --git a/OpenRA.Mods.Cnc/Missions/Gdi01Script.cs b/OpenRA.Mods.Cnc/Missions/Gdi01Script.cs index 58077bbec3..52acf8981a 100644 --- a/OpenRA.Mods.Cnc/Missions/Gdi01Script.cs +++ b/OpenRA.Mods.Cnc/Missions/Gdi01Script.cs @@ -58,24 +58,12 @@ namespace OpenRA.Mods.RA if (ticks == 0) { - Actors["gunboat"].QueueActivity(new Move(new int2(50,59),1)); + Actors["Actor87"].QueueActivity(new Move(new int2(50,59),1)); // Gunboat } ticks++; if (ticks == 25*5) { - Sound.PlayToPlayer(self.World.LocalPlayer,"reinfor1.aud"); - - // Pathfinder does stupid crap, so hardcode the path we want - var path = new List() - { - new int2(53,61), - new int2(53,60), - new int2(53,59), - new int2(53,58), - new int2(53,57), - }; - DoReinforcements(self.World, new int2(54,61),new int2(54,57), new int2(53,53), new string[] {"e1","e1","e1"}); } } @@ -84,6 +72,8 @@ namespace OpenRA.Mods.RA { world.AddFrameEndTask(w => { + Sound.PlayToPlayer(w.LocalPlayer,"reinfor1.aud"); + var a = w.CreateActor("lst", new TypeDictionary { new LocationInit( startPos ), diff --git a/mods/cnc/maps/gdi01/map.uid b/mods/cnc/maps/gdi01/map.uid index c13f53cbf3..155efa3283 100644 --- a/mods/cnc/maps/gdi01/map.uid +++ b/mods/cnc/maps/gdi01/map.uid @@ -1 +1 @@ -4d5ce7b02abcdb688e9e517bd827ab11b8205278 \ No newline at end of file +da082330f1e6a33caa8b631dda4fab8d3f1c1839 \ No newline at end of file diff --git a/mods/cnc/maps/gdi01/map.yaml b/mods/cnc/maps/gdi01/map.yaml index e1639ff647..ccd428f6a4 100644 --- a/mods/cnc/maps/gdi01/map.yaml +++ b/mods/cnc/maps/gdi01/map.yaml @@ -2,13 +2,13 @@ Selectable: True MapFormat: 3 -Title: GDI 01 +Title: (null) Description: Describe your map here Author: Westwood Studios -PlayerCount: 4 +PlayerCount: 6 Tileset: TEMPERAT @@ -308,98 +308,133 @@ 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 Actor86: mcv - Location: 56,52 + Location: 56,53 Owner: GoodGuy Health: 1 Facing: 0 - gunboat: boat + ActorStance: Guard + Actor87: boat Location: 53,59 Owner: GoodGuy Health: 1 - Facing: 64 + Facing: 192 + 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 Waypoints: + spawn27: 51,47 + spawn26: 48,52 spawn3: 58,53 spawn2: 52,55 spawn1: 38,55 diff --git a/mods/cnc/weapons.yaml b/mods/cnc/weapons.yaml index e4f85b6f16..f6574827e1 100644 --- a/mods/cnc/weapons.yaml +++ b/mods/cnc/weapons.yaml @@ -382,7 +382,7 @@ MachineGun: BoatMissile: ROF: 35 Range: 8 - Burst: 6 + Burst: 2 BurstDelay: 7 Report: ROCKET2 Missile: @@ -403,7 +403,7 @@ BoatMissile: Explosion: 5 ImpactSound: xplos SmudgeType: Crater - Damage: 10 + Damage: 60 Tomahawk: ROF: 40