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)
|
.Where(kv => int.Parse(kv.Value) > 0)
|
||||||
.Select(kv => Pair.New(int.Parse(kv.Key),
|
.Select(kv => Pair.New(int.Parse(kv.Key),
|
||||||
LocationFromMapOffset(int.Parse(kv.Value), MapSize)))
|
LocationFromMapOffset(int.Parse(kv.Value), MapSize)))
|
||||||
.Where(a => a.First < 8)
|
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
Map.PlayerCount = wp.Count();
|
Map.PlayerCount = wp.Count();
|
||||||
@@ -373,14 +372,45 @@ namespace OpenRA.Editor
|
|||||||
if (!Players.Contains(parts[0]))
|
if (!Players.Contains(parts[0]))
|
||||||
Players.Add(parts[0]);
|
Players.Add(parts[0]);
|
||||||
|
|
||||||
Map.Actors.Add("Actor" + ActorCount++,
|
var stance = ActorStance.Stance.None;
|
||||||
new ActorReference(parts[1].ToLowerInvariant())
|
switch(parts[5])
|
||||||
{
|
{
|
||||||
new LocationInit(new int2(loc % MapSize, loc / MapSize)),
|
case "Area Guard":
|
||||||
new OwnerInit(parts[0]),
|
case "Guard":
|
||||||
new HealthInit(float.Parse(parts[2])/256),
|
stance = ActorStance.Stance.Guard;
|
||||||
new FacingInit((section == "INFANTRY") ? int.Parse(parts[6]) : int.Parse(parts[4])),
|
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,
|
Name = section,
|
||||||
OwnsWorld = (section == "Neutral"),
|
OwnsWorld = (section == "Neutral"),
|
||||||
NonCombatant = (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,
|
Color = color.First,
|
||||||
Color2 = color.Second,
|
Color2 = color.Second,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -224,6 +224,7 @@
|
|||||||
<Compile Include="Traits\MPStartLocations.cs" />
|
<Compile Include="Traits\MPStartLocations.cs" />
|
||||||
<Compile Include="GameRules\Settings.cs" />
|
<Compile Include="GameRules\Settings.cs" />
|
||||||
<Compile Include="Support\Arguments.cs" />
|
<Compile Include="Support\Arguments.cs" />
|
||||||
|
<Compile Include="Traits\ActorStance.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<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
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||||
@@ -10,11 +11,19 @@
|
|||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
class SharesCellInfo : TraitInfo<SharesCell> {}
|
class SharesCellInfo : ITraitInfo
|
||||||
|
{
|
||||||
|
public object Create(ActorInitializer init) { return new SharesCell(init); }
|
||||||
|
}
|
||||||
public class SharesCell : IOffsetCenterLocation
|
public class SharesCell : IOffsetCenterLocation
|
||||||
{
|
{
|
||||||
[Sync]
|
[Sync]
|
||||||
public int Position;
|
public int Position;
|
||||||
|
|
||||||
|
public SharesCell(ActorInitializer init)
|
||||||
|
{
|
||||||
|
Position = init.Contains<SubcellInit>() ? init.Get<SubcellInit,int>() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
public float2 CenterOffset
|
public float2 CenterOffset
|
||||||
{ get {
|
{ get {
|
||||||
@@ -32,5 +41,23 @@ namespace OpenRA.Traits
|
|||||||
return new float2(-5f, -5f);
|
return new float2(-5f, -5f);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
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++;
|
ticks++;
|
||||||
|
|
||||||
if (ticks == 25*5)
|
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"});
|
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 =>
|
world.AddFrameEndTask(w =>
|
||||||
{
|
{
|
||||||
|
Sound.PlayToPlayer(w.LocalPlayer,"reinfor1.aud");
|
||||||
|
|
||||||
var a = w.CreateActor("lst", new TypeDictionary
|
var a = w.CreateActor("lst", new TypeDictionary
|
||||||
{
|
{
|
||||||
new LocationInit( startPos ),
|
new LocationInit( startPos ),
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
4d5ce7b02abcdb688e9e517bd827ab11b8205278
|
da082330f1e6a33caa8b631dda4fab8d3f1c1839
|
||||||
@@ -2,13 +2,13 @@ Selectable: True
|
|||||||
|
|
||||||
MapFormat: 3
|
MapFormat: 3
|
||||||
|
|
||||||
Title: GDI 01
|
Title: (null)
|
||||||
|
|
||||||
Description: Describe your map here
|
Description: Describe your map here
|
||||||
|
|
||||||
Author: Westwood Studios
|
Author: Westwood Studios
|
||||||
|
|
||||||
PlayerCount: 4
|
PlayerCount: 6
|
||||||
|
|
||||||
Tileset: TEMPERAT
|
Tileset: TEMPERAT
|
||||||
|
|
||||||
@@ -308,98 +308,133 @@ Actors:
|
|||||||
Owner: BadGuy
|
Owner: BadGuy
|
||||||
Health: 0.5
|
Health: 0.5
|
||||||
Facing: 160
|
Facing: 160
|
||||||
|
ActorStance: None
|
||||||
Actor84: gun
|
Actor84: gun
|
||||||
Location: 41,55
|
Location: 41,55
|
||||||
Owner: BadGuy
|
Owner: BadGuy
|
||||||
Health: 0.5
|
Health: 0.5
|
||||||
Facing: 160
|
Facing: 160
|
||||||
|
ActorStance: None
|
||||||
Actor85: gun
|
Actor85: gun
|
||||||
Location: 49,55
|
Location: 49,55
|
||||||
Owner: BadGuy
|
Owner: BadGuy
|
||||||
Health: 0.1875
|
Health: 0.1875
|
||||||
Facing: 160
|
Facing: 160
|
||||||
|
ActorStance: None
|
||||||
Actor86: mcv
|
Actor86: mcv
|
||||||
Location: 56,52
|
Location: 56,53
|
||||||
Owner: GoodGuy
|
Owner: GoodGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 0
|
Facing: 0
|
||||||
gunboat: boat
|
ActorStance: Guard
|
||||||
|
Actor87: boat
|
||||||
Location: 53,59
|
Location: 53,59
|
||||||
Owner: GoodGuy
|
Owner: GoodGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 64
|
Facing: 192
|
||||||
|
ActorStance: Hunt
|
||||||
Actor88: e1
|
Actor88: e1
|
||||||
Location: 56,55
|
Location: 56,55
|
||||||
Owner: GoodGuy
|
Owner: GoodGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 0
|
Facing: 0
|
||||||
|
ActorStance: Guard
|
||||||
|
Subcell: 2
|
||||||
Actor89: e1
|
Actor89: e1
|
||||||
Location: 56,55
|
Location: 56,55
|
||||||
Owner: GoodGuy
|
Owner: GoodGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 0
|
Facing: 0
|
||||||
|
ActorStance: Guard
|
||||||
|
Subcell: 4
|
||||||
Actor90: e1
|
Actor90: e1
|
||||||
Location: 56,55
|
Location: 56,55
|
||||||
Owner: GoodGuy
|
Owner: GoodGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 0
|
Facing: 0
|
||||||
|
ActorStance: Guard
|
||||||
|
Subcell: 3
|
||||||
Actor91: e1
|
Actor91: e1
|
||||||
Location: 56,55
|
Location: 56,55
|
||||||
Owner: GoodGuy
|
Owner: GoodGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 0
|
Facing: 0
|
||||||
|
ActorStance: Guard
|
||||||
|
Subcell: 1
|
||||||
Actor92: e1
|
Actor92: e1
|
||||||
Location: 57,45
|
Location: 57,45
|
||||||
Owner: BadGuy
|
Owner: BadGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 160
|
Facing: 160
|
||||||
|
ActorStance: Guard
|
||||||
|
Subcell: 2
|
||||||
Actor93: e1
|
Actor93: e1
|
||||||
Location: 56,41
|
Location: 56,41
|
||||||
Owner: BadGuy
|
Owner: BadGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 192
|
Facing: 192
|
||||||
|
ActorStance: Guard
|
||||||
|
Subcell: 2
|
||||||
Actor94: e1
|
Actor94: e1
|
||||||
Location: 48,41
|
Location: 48,41
|
||||||
Owner: BadGuy
|
Owner: BadGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 96
|
Facing: 96
|
||||||
|
ActorStance: Guard
|
||||||
|
Subcell: 3
|
||||||
Actor95: e1
|
Actor95: e1
|
||||||
Location: 59,45
|
Location: 59,45
|
||||||
Owner: BadGuy
|
Owner: BadGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 160
|
Facing: 160
|
||||||
|
ActorStance: Guard
|
||||||
|
Subcell: 1
|
||||||
Actor96: e1
|
Actor96: e1
|
||||||
Location: 46,50
|
Location: 46,50
|
||||||
Owner: BadGuy
|
Owner: BadGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 96
|
Facing: 96
|
||||||
|
ActorStance: Guard
|
||||||
|
Subcell: 3
|
||||||
Actor97: e1
|
Actor97: e1
|
||||||
Location: 48,47
|
Location: 48,47
|
||||||
Owner: BadGuy
|
Owner: BadGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 96
|
Facing: 96
|
||||||
|
ActorStance: Guard
|
||||||
|
Subcell: 1
|
||||||
Actor98: e1
|
Actor98: e1
|
||||||
Location: 38,43
|
Location: 38,43
|
||||||
Owner: BadGuy
|
Owner: BadGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 128
|
Facing: 128
|
||||||
|
ActorStance: Guard
|
||||||
|
Subcell: 4
|
||||||
Actor99: e1
|
Actor99: e1
|
||||||
Location: 38,43
|
Location: 38,43
|
||||||
Owner: BadGuy
|
Owner: BadGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 128
|
Facing: 128
|
||||||
|
ActorStance: Guard
|
||||||
|
Subcell: 1
|
||||||
Actor100: e1
|
Actor100: e1
|
||||||
Location: 48,41
|
Location: 48,41
|
||||||
Owner: BadGuy
|
Owner: BadGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 96
|
Facing: 96
|
||||||
|
ActorStance: Guard
|
||||||
|
Subcell: 2
|
||||||
Actor101: e1
|
Actor101: e1
|
||||||
Location: 41,39
|
Location: 41,39
|
||||||
Owner: BadGuy
|
Owner: BadGuy
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 96
|
Facing: 96
|
||||||
|
ActorStance: Hunt
|
||||||
|
Subcell: 4
|
||||||
|
|
||||||
Waypoints:
|
Waypoints:
|
||||||
|
spawn27: 51,47
|
||||||
|
spawn26: 48,52
|
||||||
spawn3: 58,53
|
spawn3: 58,53
|
||||||
spawn2: 52,55
|
spawn2: 52,55
|
||||||
spawn1: 38,55
|
spawn1: 38,55
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ MachineGun:
|
|||||||
BoatMissile:
|
BoatMissile:
|
||||||
ROF: 35
|
ROF: 35
|
||||||
Range: 8
|
Range: 8
|
||||||
Burst: 6
|
Burst: 2
|
||||||
BurstDelay: 7
|
BurstDelay: 7
|
||||||
Report: ROCKET2
|
Report: ROCKET2
|
||||||
Missile:
|
Missile:
|
||||||
@@ -403,7 +403,7 @@ BoatMissile:
|
|||||||
Explosion: 5
|
Explosion: 5
|
||||||
ImpactSound: xplos
|
ImpactSound: xplos
|
||||||
SmudgeType: Crater
|
SmudgeType: Crater
|
||||||
Damage: 10
|
Damage: 60
|
||||||
|
|
||||||
Tomahawk:
|
Tomahawk:
|
||||||
ROF: 40
|
ROF: 40
|
||||||
|
|||||||
Reference in New Issue
Block a user