Import infantry subcell and actor stance
This commit is contained in:
@@ -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())
|
||||
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,
|
||||
};
|
||||
|
||||
@@ -224,6 +224,7 @@
|
||||
<Compile Include="Traits\MPStartLocations.cs" />
|
||||
<Compile Include="GameRules\Settings.cs" />
|
||||
<Compile Include="Support\Arguments.cs" />
|
||||
<Compile Include="Traits\ActorStance.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||
|
||||
52
OpenRA.Game/Traits/ActorStance.cs
Normal file
52
OpenRA.Game/Traits/ActorStance.cs
Normal file
@@ -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<ActorStance.Stance>
|
||||
{
|
||||
[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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using OpenRA.FileFormats;
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||
@@ -10,12 +11,20 @@
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
class SharesCellInfo : TraitInfo<SharesCell> {}
|
||||
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<SubcellInit>() ? init.Get<SubcellInit,int>() : 0;
|
||||
}
|
||||
|
||||
public float2 CenterOffset
|
||||
{ get {
|
||||
switch (Position)
|
||||
@@ -33,4 +42,22 @@ namespace OpenRA.Traits
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
||||
public class SubcellInit : IActorInit<int>
|
||||
{
|
||||
[FieldFromYamlKey]
|
||||
public readonly int value = 0;
|
||||
|
||||
public SubcellInit() { }
|
||||
|
||||
public SubcellInit( int init )
|
||||
{
|
||||
value = init;
|
||||
}
|
||||
|
||||
public int Value( World world )
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<int2>()
|
||||
{
|
||||
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 ),
|
||||
|
||||
@@ -1 +1 @@
|
||||
4d5ce7b02abcdb688e9e517bd827ab11b8205278
|
||||
da082330f1e6a33caa8b631dda4fab8d3f1c1839
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user