Add an AttackWander trait for creeps. Remove a pile of bogosity from AttackMove.
This commit is contained in:
@@ -57,14 +57,18 @@ namespace OpenRA
|
|||||||
this.Queued = queued;
|
this.Queued = queued;
|
||||||
this.ExtraLocation = extraLocation;
|
this.ExtraLocation = extraLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For scripting special powers
|
// For scripting special powers
|
||||||
public Order()
|
public Order()
|
||||||
: this(null, null, null, int2.Zero, null, false, int2.Zero) { }
|
: this(null, null, null, int2.Zero, null, false, int2.Zero) { }
|
||||||
|
|
||||||
public Order(string orderString, Actor subject, bool queued)
|
public Order(string orderString, Actor subject, bool queued)
|
||||||
: this(orderString, subject, null, int2.Zero, null, queued, int2.Zero) { }
|
: this(orderString, subject, null, int2.Zero, null, queued, int2.Zero) { }
|
||||||
|
|
||||||
|
public Order(string orderstring, Order order)
|
||||||
|
: this(orderstring, order.Subject, order.TargetActor, order.TargetLocation,
|
||||||
|
order.TargetString, order.Queued, order.ExtraLocation) {}
|
||||||
|
|
||||||
public byte[] Serialize()
|
public byte[] Serialize()
|
||||||
{
|
{
|
||||||
if (IsImmediate) /* chat, whatever */
|
if (IsImmediate) /* chat, whatever */
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ namespace OpenRA.Traits
|
|||||||
(cosAngle * v.X + sinAngle * v.Y),
|
(cosAngle * v.X + sinAngle * v.Y),
|
||||||
ecc * (cosAngle * v.Y - sinAngle * v.X));
|
ecc * (cosAngle * v.Y - sinAngle * v.X));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int2 CenterOfCell(int2 loc)
|
public static int2 CenterOfCell(int2 loc)
|
||||||
{
|
{
|
||||||
return new int2( Game.CellSize / 2, Game.CellSize / 2 ) + Game.CellSize * loc;
|
return new int2( Game.CellSize / 2, Game.CellSize / 2 ) + Game.CellSize * loc;
|
||||||
@@ -178,5 +178,266 @@ namespace OpenRA.Traits
|
|||||||
new int2( 391, -1229 ),
|
new int2( 391, -1229 ),
|
||||||
new int2( 199, -1305 )
|
new int2( 199, -1305 )
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
public static readonly int2[] SubPxVector =
|
||||||
|
{
|
||||||
|
new int2( 0, 1024 ),
|
||||||
|
new int2( 25, 1023 ),
|
||||||
|
new int2( 50, 1022 ),
|
||||||
|
new int2( 75, 1021 ),
|
||||||
|
new int2( 100, 1019 ),
|
||||||
|
new int2( 125, 1016 ),
|
||||||
|
new int2( 150, 1012 ),
|
||||||
|
new int2( 175, 1008 ),
|
||||||
|
new int2( 199, 1004 ),
|
||||||
|
new int2( 224, 999 ),
|
||||||
|
new int2( 248, 993 ),
|
||||||
|
new int2( 273, 986 ),
|
||||||
|
new int2( 297, 979 ),
|
||||||
|
new int2( 321, 972 ),
|
||||||
|
new int2( 344, 964 ),
|
||||||
|
new int2( 368, 955 ),
|
||||||
|
new int2( 391, 946 ),
|
||||||
|
new int2( 414, 936 ),
|
||||||
|
new int2( 437, 925 ),
|
||||||
|
new int2( 460, 914 ),
|
||||||
|
new int2( 482, 903 ),
|
||||||
|
new int2( 504, 890 ),
|
||||||
|
new int2( 526, 878 ),
|
||||||
|
new int2( 547, 865 ),
|
||||||
|
new int2( 568, 851 ),
|
||||||
|
new int2( 589, 837 ),
|
||||||
|
new int2( 609, 822 ),
|
||||||
|
new int2( 629, 807 ),
|
||||||
|
new int2( 649, 791 ),
|
||||||
|
new int2( 668, 775 ),
|
||||||
|
new int2( 687, 758 ),
|
||||||
|
new int2( 706, 741 ),
|
||||||
|
new int2( 724, 724 ),
|
||||||
|
new int2( 741, 706 ),
|
||||||
|
new int2( 758, 687 ),
|
||||||
|
new int2( 775, 668 ),
|
||||||
|
new int2( 791, 649 ),
|
||||||
|
new int2( 807, 629 ),
|
||||||
|
new int2( 822, 609 ),
|
||||||
|
new int2( 837, 589 ),
|
||||||
|
new int2( 851, 568 ),
|
||||||
|
new int2( 865, 547 ),
|
||||||
|
new int2( 878, 526 ),
|
||||||
|
new int2( 890, 504 ),
|
||||||
|
new int2( 903, 482 ),
|
||||||
|
new int2( 914, 460 ),
|
||||||
|
new int2( 925, 437 ),
|
||||||
|
new int2( 936, 414 ),
|
||||||
|
new int2( 946, 391 ),
|
||||||
|
new int2( 955, 368 ),
|
||||||
|
new int2( 964, 344 ),
|
||||||
|
new int2( 972, 321 ),
|
||||||
|
new int2( 979, 297 ),
|
||||||
|
new int2( 986, 273 ),
|
||||||
|
new int2( 993, 248 ),
|
||||||
|
new int2( 999, 224 ),
|
||||||
|
new int2( 1004, 199 ),
|
||||||
|
new int2( 1008, 175 ),
|
||||||
|
new int2( 1012, 150 ),
|
||||||
|
new int2( 1016, 125 ),
|
||||||
|
new int2( 1019, 100 ),
|
||||||
|
new int2( 1021, 75 ),
|
||||||
|
new int2( 1022, 50 ),
|
||||||
|
new int2( 1023, 25 ),
|
||||||
|
new int2( 1024, 0 ),
|
||||||
|
new int2( 1023, -25 ),
|
||||||
|
new int2( 1022, -50 ),
|
||||||
|
new int2( 1021, -75 ),
|
||||||
|
new int2( 1019, -100 ),
|
||||||
|
new int2( 1016, -125 ),
|
||||||
|
new int2( 1012, -150 ),
|
||||||
|
new int2( 1008, -175 ),
|
||||||
|
new int2( 1004, -199 ),
|
||||||
|
new int2( 999, -224 ),
|
||||||
|
new int2( 993, -248 ),
|
||||||
|
new int2( 986, -273 ),
|
||||||
|
new int2( 979, -297 ),
|
||||||
|
new int2( 972, -321 ),
|
||||||
|
new int2( 964, -344 ),
|
||||||
|
new int2( 955, -368 ),
|
||||||
|
new int2( 946, -391 ),
|
||||||
|
new int2( 936, -414 ),
|
||||||
|
new int2( 925, -437 ),
|
||||||
|
new int2( 914, -460 ),
|
||||||
|
new int2( 903, -482 ),
|
||||||
|
new int2( 890, -504 ),
|
||||||
|
new int2( 878, -526 ),
|
||||||
|
new int2( 865, -547 ),
|
||||||
|
new int2( 851, -568 ),
|
||||||
|
new int2( 837, -589 ),
|
||||||
|
new int2( 822, -609 ),
|
||||||
|
new int2( 807, -629 ),
|
||||||
|
new int2( 791, -649 ),
|
||||||
|
new int2( 775, -668 ),
|
||||||
|
new int2( 758, -687 ),
|
||||||
|
new int2( 741, -706 ),
|
||||||
|
new int2( 724, -724 ),
|
||||||
|
new int2( 706, -741 ),
|
||||||
|
new int2( 687, -758 ),
|
||||||
|
new int2( 668, -775 ),
|
||||||
|
new int2( 649, -791 ),
|
||||||
|
new int2( 629, -807 ),
|
||||||
|
new int2( 609, -822 ),
|
||||||
|
new int2( 589, -837 ),
|
||||||
|
new int2( 568, -851 ),
|
||||||
|
new int2( 547, -865 ),
|
||||||
|
new int2( 526, -878 ),
|
||||||
|
new int2( 504, -890 ),
|
||||||
|
new int2( 482, -903 ),
|
||||||
|
new int2( 460, -914 ),
|
||||||
|
new int2( 437, -925 ),
|
||||||
|
new int2( 414, -936 ),
|
||||||
|
new int2( 391, -946 ),
|
||||||
|
new int2( 368, -955 ),
|
||||||
|
new int2( 344, -964 ),
|
||||||
|
new int2( 321, -972 ),
|
||||||
|
new int2( 297, -979 ),
|
||||||
|
new int2( 273, -986 ),
|
||||||
|
new int2( 248, -993 ),
|
||||||
|
new int2( 224, -999 ),
|
||||||
|
new int2( 199, -1004 ),
|
||||||
|
new int2( 175, -1008 ),
|
||||||
|
new int2( 150, -1012 ),
|
||||||
|
new int2( 125, -1016 ),
|
||||||
|
new int2( 100, -1019 ),
|
||||||
|
new int2( 75, -1021 ),
|
||||||
|
new int2( 50, -1022 ),
|
||||||
|
new int2( 25, -1023 ),
|
||||||
|
new int2( 0, -1024 ),
|
||||||
|
new int2( -25, -1023 ),
|
||||||
|
new int2( -50, -1022 ),
|
||||||
|
new int2( -75, -1021 ),
|
||||||
|
new int2( -100, -1019 ),
|
||||||
|
new int2( -125, -1016 ),
|
||||||
|
new int2( -150, -1012 ),
|
||||||
|
new int2( -175, -1008 ),
|
||||||
|
new int2( -199, -1004 ),
|
||||||
|
new int2( -224, -999 ),
|
||||||
|
new int2( -248, -993 ),
|
||||||
|
new int2( -273, -986 ),
|
||||||
|
new int2( -297, -979 ),
|
||||||
|
new int2( -321, -972 ),
|
||||||
|
new int2( -344, -964 ),
|
||||||
|
new int2( -368, -955 ),
|
||||||
|
new int2( -391, -946 ),
|
||||||
|
new int2( -414, -936 ),
|
||||||
|
new int2( -437, -925 ),
|
||||||
|
new int2( -460, -914 ),
|
||||||
|
new int2( -482, -903 ),
|
||||||
|
new int2( -504, -890 ),
|
||||||
|
new int2( -526, -878 ),
|
||||||
|
new int2( -547, -865 ),
|
||||||
|
new int2( -568, -851 ),
|
||||||
|
new int2( -589, -837 ),
|
||||||
|
new int2( -609, -822 ),
|
||||||
|
new int2( -629, -807 ),
|
||||||
|
new int2( -649, -791 ),
|
||||||
|
new int2( -668, -775 ),
|
||||||
|
new int2( -687, -758 ),
|
||||||
|
new int2( -706, -741 ),
|
||||||
|
new int2( -724, -724 ),
|
||||||
|
new int2( -741, -706 ),
|
||||||
|
new int2( -758, -687 ),
|
||||||
|
new int2( -775, -668 ),
|
||||||
|
new int2( -791, -649 ),
|
||||||
|
new int2( -807, -629 ),
|
||||||
|
new int2( -822, -609 ),
|
||||||
|
new int2( -837, -589 ),
|
||||||
|
new int2( -851, -568 ),
|
||||||
|
new int2( -865, -547 ),
|
||||||
|
new int2( -878, -526 ),
|
||||||
|
new int2( -890, -504 ),
|
||||||
|
new int2( -903, -482 ),
|
||||||
|
new int2( -914, -460 ),
|
||||||
|
new int2( -925, -437 ),
|
||||||
|
new int2( -936, -414 ),
|
||||||
|
new int2( -946, -391 ),
|
||||||
|
new int2( -955, -368 ),
|
||||||
|
new int2( -964, -344 ),
|
||||||
|
new int2( -972, -321 ),
|
||||||
|
new int2( -979, -297 ),
|
||||||
|
new int2( -986, -273 ),
|
||||||
|
new int2( -993, -248 ),
|
||||||
|
new int2( -999, -224 ),
|
||||||
|
new int2( -1004, -199 ),
|
||||||
|
new int2( -1008, -175 ),
|
||||||
|
new int2( -1012, -150 ),
|
||||||
|
new int2( -1016, -125 ),
|
||||||
|
new int2( -1019, -100 ),
|
||||||
|
new int2( -1021, -75 ),
|
||||||
|
new int2( -1022, -50 ),
|
||||||
|
new int2( -1023, -25 ),
|
||||||
|
new int2( -1024, 0 ),
|
||||||
|
new int2( -1023, 25 ),
|
||||||
|
new int2( -1022, 50 ),
|
||||||
|
new int2( -1021, 75 ),
|
||||||
|
new int2( -1019, 100 ),
|
||||||
|
new int2( -1016, 125 ),
|
||||||
|
new int2( -1012, 150 ),
|
||||||
|
new int2( -1008, 175 ),
|
||||||
|
new int2( -1004, 199 ),
|
||||||
|
new int2( -999, 224 ),
|
||||||
|
new int2( -993, 248 ),
|
||||||
|
new int2( -986, 273 ),
|
||||||
|
new int2( -979, 297 ),
|
||||||
|
new int2( -972, 321 ),
|
||||||
|
new int2( -964, 344 ),
|
||||||
|
new int2( -955, 368 ),
|
||||||
|
new int2( -946, 391 ),
|
||||||
|
new int2( -936, 414 ),
|
||||||
|
new int2( -925, 437 ),
|
||||||
|
new int2( -914, 460 ),
|
||||||
|
new int2( -903, 482 ),
|
||||||
|
new int2( -890, 504 ),
|
||||||
|
new int2( -878, 526 ),
|
||||||
|
new int2( -865, 547 ),
|
||||||
|
new int2( -851, 568 ),
|
||||||
|
new int2( -837, 589 ),
|
||||||
|
new int2( -822, 609 ),
|
||||||
|
new int2( -807, 629 ),
|
||||||
|
new int2( -791, 649 ),
|
||||||
|
new int2( -775, 668 ),
|
||||||
|
new int2( -758, 687 ),
|
||||||
|
new int2( -741, 706 ),
|
||||||
|
new int2( -724, 724 ),
|
||||||
|
new int2( -706, 741 ),
|
||||||
|
new int2( -687, 758 ),
|
||||||
|
new int2( -668, 775 ),
|
||||||
|
new int2( -649, 791 ),
|
||||||
|
new int2( -629, 807 ),
|
||||||
|
new int2( -609, 822 ),
|
||||||
|
new int2( -589, 837 ),
|
||||||
|
new int2( -568, 851 ),
|
||||||
|
new int2( -547, 865 ),
|
||||||
|
new int2( -526, 878 ),
|
||||||
|
new int2( -504, 890 ),
|
||||||
|
new int2( -482, 903 ),
|
||||||
|
new int2( -460, 914 ),
|
||||||
|
new int2( -437, 925 ),
|
||||||
|
new int2( -414, 936 ),
|
||||||
|
new int2( -391, 946 ),
|
||||||
|
new int2( -368, 955 ),
|
||||||
|
new int2( -344, 964 ),
|
||||||
|
new int2( -321, 972 ),
|
||||||
|
new int2( -297, 979 ),
|
||||||
|
new int2( -273, 986 ),
|
||||||
|
new int2( -248, 993 ),
|
||||||
|
new int2( -224, 999 ),
|
||||||
|
new int2( -199, 1004 ),
|
||||||
|
new int2( -175, 1008 ),
|
||||||
|
new int2( -150, 1012 ),
|
||||||
|
new int2( -125, 1016 ),
|
||||||
|
new int2( -100, 1019 ),
|
||||||
|
new int2( -75, 1021 ),
|
||||||
|
new int2( -50, 1022 ),
|
||||||
|
new int2( -25, 1023 )
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
public void TickMove( int speed, int facing )
|
public void TickMove( int speed, int facing )
|
||||||
{
|
{
|
||||||
var rawspeed = speed * 7 / (32 * 1024);
|
var rawspeed = speed * 7 / (32 * 1024);
|
||||||
SubPxPosition += rawspeed * -SubPxVector[facing];
|
SubPxPosition += rawspeed * -Util.SubPxVector[facing];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanLand(int2 cell)
|
public bool CanLand(int2 cell)
|
||||||
@@ -156,265 +156,5 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
var type = self.World.GetTerrainType(cell);
|
var type = self.World.GetTerrainType(cell);
|
||||||
return Info.LandableTerrainTypes.Contains(type);
|
return Info.LandableTerrainTypes.Contains(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly int2[] SubPxVector =
|
|
||||||
{
|
|
||||||
new int2( 0, 1024 ),
|
|
||||||
new int2( 25, 1023 ),
|
|
||||||
new int2( 50, 1022 ),
|
|
||||||
new int2( 75, 1021 ),
|
|
||||||
new int2( 100, 1019 ),
|
|
||||||
new int2( 125, 1016 ),
|
|
||||||
new int2( 150, 1012 ),
|
|
||||||
new int2( 175, 1008 ),
|
|
||||||
new int2( 199, 1004 ),
|
|
||||||
new int2( 224, 999 ),
|
|
||||||
new int2( 248, 993 ),
|
|
||||||
new int2( 273, 986 ),
|
|
||||||
new int2( 297, 979 ),
|
|
||||||
new int2( 321, 972 ),
|
|
||||||
new int2( 344, 964 ),
|
|
||||||
new int2( 368, 955 ),
|
|
||||||
new int2( 391, 946 ),
|
|
||||||
new int2( 414, 936 ),
|
|
||||||
new int2( 437, 925 ),
|
|
||||||
new int2( 460, 914 ),
|
|
||||||
new int2( 482, 903 ),
|
|
||||||
new int2( 504, 890 ),
|
|
||||||
new int2( 526, 878 ),
|
|
||||||
new int2( 547, 865 ),
|
|
||||||
new int2( 568, 851 ),
|
|
||||||
new int2( 589, 837 ),
|
|
||||||
new int2( 609, 822 ),
|
|
||||||
new int2( 629, 807 ),
|
|
||||||
new int2( 649, 791 ),
|
|
||||||
new int2( 668, 775 ),
|
|
||||||
new int2( 687, 758 ),
|
|
||||||
new int2( 706, 741 ),
|
|
||||||
new int2( 724, 724 ),
|
|
||||||
new int2( 741, 706 ),
|
|
||||||
new int2( 758, 687 ),
|
|
||||||
new int2( 775, 668 ),
|
|
||||||
new int2( 791, 649 ),
|
|
||||||
new int2( 807, 629 ),
|
|
||||||
new int2( 822, 609 ),
|
|
||||||
new int2( 837, 589 ),
|
|
||||||
new int2( 851, 568 ),
|
|
||||||
new int2( 865, 547 ),
|
|
||||||
new int2( 878, 526 ),
|
|
||||||
new int2( 890, 504 ),
|
|
||||||
new int2( 903, 482 ),
|
|
||||||
new int2( 914, 460 ),
|
|
||||||
new int2( 925, 437 ),
|
|
||||||
new int2( 936, 414 ),
|
|
||||||
new int2( 946, 391 ),
|
|
||||||
new int2( 955, 368 ),
|
|
||||||
new int2( 964, 344 ),
|
|
||||||
new int2( 972, 321 ),
|
|
||||||
new int2( 979, 297 ),
|
|
||||||
new int2( 986, 273 ),
|
|
||||||
new int2( 993, 248 ),
|
|
||||||
new int2( 999, 224 ),
|
|
||||||
new int2( 1004, 199 ),
|
|
||||||
new int2( 1008, 175 ),
|
|
||||||
new int2( 1012, 150 ),
|
|
||||||
new int2( 1016, 125 ),
|
|
||||||
new int2( 1019, 100 ),
|
|
||||||
new int2( 1021, 75 ),
|
|
||||||
new int2( 1022, 50 ),
|
|
||||||
new int2( 1023, 25 ),
|
|
||||||
new int2( 1024, 0 ),
|
|
||||||
new int2( 1023, -25 ),
|
|
||||||
new int2( 1022, -50 ),
|
|
||||||
new int2( 1021, -75 ),
|
|
||||||
new int2( 1019, -100 ),
|
|
||||||
new int2( 1016, -125 ),
|
|
||||||
new int2( 1012, -150 ),
|
|
||||||
new int2( 1008, -175 ),
|
|
||||||
new int2( 1004, -199 ),
|
|
||||||
new int2( 999, -224 ),
|
|
||||||
new int2( 993, -248 ),
|
|
||||||
new int2( 986, -273 ),
|
|
||||||
new int2( 979, -297 ),
|
|
||||||
new int2( 972, -321 ),
|
|
||||||
new int2( 964, -344 ),
|
|
||||||
new int2( 955, -368 ),
|
|
||||||
new int2( 946, -391 ),
|
|
||||||
new int2( 936, -414 ),
|
|
||||||
new int2( 925, -437 ),
|
|
||||||
new int2( 914, -460 ),
|
|
||||||
new int2( 903, -482 ),
|
|
||||||
new int2( 890, -504 ),
|
|
||||||
new int2( 878, -526 ),
|
|
||||||
new int2( 865, -547 ),
|
|
||||||
new int2( 851, -568 ),
|
|
||||||
new int2( 837, -589 ),
|
|
||||||
new int2( 822, -609 ),
|
|
||||||
new int2( 807, -629 ),
|
|
||||||
new int2( 791, -649 ),
|
|
||||||
new int2( 775, -668 ),
|
|
||||||
new int2( 758, -687 ),
|
|
||||||
new int2( 741, -706 ),
|
|
||||||
new int2( 724, -724 ),
|
|
||||||
new int2( 706, -741 ),
|
|
||||||
new int2( 687, -758 ),
|
|
||||||
new int2( 668, -775 ),
|
|
||||||
new int2( 649, -791 ),
|
|
||||||
new int2( 629, -807 ),
|
|
||||||
new int2( 609, -822 ),
|
|
||||||
new int2( 589, -837 ),
|
|
||||||
new int2( 568, -851 ),
|
|
||||||
new int2( 547, -865 ),
|
|
||||||
new int2( 526, -878 ),
|
|
||||||
new int2( 504, -890 ),
|
|
||||||
new int2( 482, -903 ),
|
|
||||||
new int2( 460, -914 ),
|
|
||||||
new int2( 437, -925 ),
|
|
||||||
new int2( 414, -936 ),
|
|
||||||
new int2( 391, -946 ),
|
|
||||||
new int2( 368, -955 ),
|
|
||||||
new int2( 344, -964 ),
|
|
||||||
new int2( 321, -972 ),
|
|
||||||
new int2( 297, -979 ),
|
|
||||||
new int2( 273, -986 ),
|
|
||||||
new int2( 248, -993 ),
|
|
||||||
new int2( 224, -999 ),
|
|
||||||
new int2( 199, -1004 ),
|
|
||||||
new int2( 175, -1008 ),
|
|
||||||
new int2( 150, -1012 ),
|
|
||||||
new int2( 125, -1016 ),
|
|
||||||
new int2( 100, -1019 ),
|
|
||||||
new int2( 75, -1021 ),
|
|
||||||
new int2( 50, -1022 ),
|
|
||||||
new int2( 25, -1023 ),
|
|
||||||
new int2( 0, -1024 ),
|
|
||||||
new int2( -25, -1023 ),
|
|
||||||
new int2( -50, -1022 ),
|
|
||||||
new int2( -75, -1021 ),
|
|
||||||
new int2( -100, -1019 ),
|
|
||||||
new int2( -125, -1016 ),
|
|
||||||
new int2( -150, -1012 ),
|
|
||||||
new int2( -175, -1008 ),
|
|
||||||
new int2( -199, -1004 ),
|
|
||||||
new int2( -224, -999 ),
|
|
||||||
new int2( -248, -993 ),
|
|
||||||
new int2( -273, -986 ),
|
|
||||||
new int2( -297, -979 ),
|
|
||||||
new int2( -321, -972 ),
|
|
||||||
new int2( -344, -964 ),
|
|
||||||
new int2( -368, -955 ),
|
|
||||||
new int2( -391, -946 ),
|
|
||||||
new int2( -414, -936 ),
|
|
||||||
new int2( -437, -925 ),
|
|
||||||
new int2( -460, -914 ),
|
|
||||||
new int2( -482, -903 ),
|
|
||||||
new int2( -504, -890 ),
|
|
||||||
new int2( -526, -878 ),
|
|
||||||
new int2( -547, -865 ),
|
|
||||||
new int2( -568, -851 ),
|
|
||||||
new int2( -589, -837 ),
|
|
||||||
new int2( -609, -822 ),
|
|
||||||
new int2( -629, -807 ),
|
|
||||||
new int2( -649, -791 ),
|
|
||||||
new int2( -668, -775 ),
|
|
||||||
new int2( -687, -758 ),
|
|
||||||
new int2( -706, -741 ),
|
|
||||||
new int2( -724, -724 ),
|
|
||||||
new int2( -741, -706 ),
|
|
||||||
new int2( -758, -687 ),
|
|
||||||
new int2( -775, -668 ),
|
|
||||||
new int2( -791, -649 ),
|
|
||||||
new int2( -807, -629 ),
|
|
||||||
new int2( -822, -609 ),
|
|
||||||
new int2( -837, -589 ),
|
|
||||||
new int2( -851, -568 ),
|
|
||||||
new int2( -865, -547 ),
|
|
||||||
new int2( -878, -526 ),
|
|
||||||
new int2( -890, -504 ),
|
|
||||||
new int2( -903, -482 ),
|
|
||||||
new int2( -914, -460 ),
|
|
||||||
new int2( -925, -437 ),
|
|
||||||
new int2( -936, -414 ),
|
|
||||||
new int2( -946, -391 ),
|
|
||||||
new int2( -955, -368 ),
|
|
||||||
new int2( -964, -344 ),
|
|
||||||
new int2( -972, -321 ),
|
|
||||||
new int2( -979, -297 ),
|
|
||||||
new int2( -986, -273 ),
|
|
||||||
new int2( -993, -248 ),
|
|
||||||
new int2( -999, -224 ),
|
|
||||||
new int2( -1004, -199 ),
|
|
||||||
new int2( -1008, -175 ),
|
|
||||||
new int2( -1012, -150 ),
|
|
||||||
new int2( -1016, -125 ),
|
|
||||||
new int2( -1019, -100 ),
|
|
||||||
new int2( -1021, -75 ),
|
|
||||||
new int2( -1022, -50 ),
|
|
||||||
new int2( -1023, -25 ),
|
|
||||||
new int2( -1024, 0 ),
|
|
||||||
new int2( -1023, 25 ),
|
|
||||||
new int2( -1022, 50 ),
|
|
||||||
new int2( -1021, 75 ),
|
|
||||||
new int2( -1019, 100 ),
|
|
||||||
new int2( -1016, 125 ),
|
|
||||||
new int2( -1012, 150 ),
|
|
||||||
new int2( -1008, 175 ),
|
|
||||||
new int2( -1004, 199 ),
|
|
||||||
new int2( -999, 224 ),
|
|
||||||
new int2( -993, 248 ),
|
|
||||||
new int2( -986, 273 ),
|
|
||||||
new int2( -979, 297 ),
|
|
||||||
new int2( -972, 321 ),
|
|
||||||
new int2( -964, 344 ),
|
|
||||||
new int2( -955, 368 ),
|
|
||||||
new int2( -946, 391 ),
|
|
||||||
new int2( -936, 414 ),
|
|
||||||
new int2( -925, 437 ),
|
|
||||||
new int2( -914, 460 ),
|
|
||||||
new int2( -903, 482 ),
|
|
||||||
new int2( -890, 504 ),
|
|
||||||
new int2( -878, 526 ),
|
|
||||||
new int2( -865, 547 ),
|
|
||||||
new int2( -851, 568 ),
|
|
||||||
new int2( -837, 589 ),
|
|
||||||
new int2( -822, 609 ),
|
|
||||||
new int2( -807, 629 ),
|
|
||||||
new int2( -791, 649 ),
|
|
||||||
new int2( -775, 668 ),
|
|
||||||
new int2( -758, 687 ),
|
|
||||||
new int2( -741, 706 ),
|
|
||||||
new int2( -724, 724 ),
|
|
||||||
new int2( -706, 741 ),
|
|
||||||
new int2( -687, 758 ),
|
|
||||||
new int2( -668, 775 ),
|
|
||||||
new int2( -649, 791 ),
|
|
||||||
new int2( -629, 807 ),
|
|
||||||
new int2( -609, 822 ),
|
|
||||||
new int2( -589, 837 ),
|
|
||||||
new int2( -568, 851 ),
|
|
||||||
new int2( -547, 865 ),
|
|
||||||
new int2( -526, 878 ),
|
|
||||||
new int2( -504, 890 ),
|
|
||||||
new int2( -482, 903 ),
|
|
||||||
new int2( -460, 914 ),
|
|
||||||
new int2( -437, 925 ),
|
|
||||||
new int2( -414, 936 ),
|
|
||||||
new int2( -391, 946 ),
|
|
||||||
new int2( -368, 955 ),
|
|
||||||
new int2( -344, 964 ),
|
|
||||||
new int2( -321, 972 ),
|
|
||||||
new int2( -297, 979 ),
|
|
||||||
new int2( -273, 986 ),
|
|
||||||
new int2( -248, 993 ),
|
|
||||||
new int2( -224, 999 ),
|
|
||||||
new int2( -199, 1004 ),
|
|
||||||
new int2( -175, 1008 ),
|
|
||||||
new int2( -150, 1012 ),
|
|
||||||
new int2( -125, 1016 ),
|
|
||||||
new int2( -100, 1019 ),
|
|
||||||
new int2( -75, 1021 ),
|
|
||||||
new int2( -50, 1022 ),
|
|
||||||
new int2( -25, 1023 )
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
return int2.Zero;
|
return int2.Zero;
|
||||||
|
|
||||||
if (d.LengthSquared < 1)
|
if (d.LengthSquared < 1)
|
||||||
return Aircraft.SubPxVector[self.World.SharedRandom.Next(255)];
|
return Util.SubPxVector[self.World.SharedRandom.Next(255)];
|
||||||
return (5120 / d.LengthSquared) * d;
|
return (5120 / d.LengthSquared) * d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,69 +16,77 @@ using OpenRA.Traits.Activities;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class AttackMoveInfo : TraitInfo<AttackMove>
|
class AttackMoveInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly bool JustMove = false;
|
public readonly bool JustMove = false;
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new AttackMove(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class AttackMove : IResolveOrder, IOrderVoice, ITick, ISync
|
class AttackMove : IResolveOrder, IOrderVoice, INotifyIdle, ISync
|
||||||
{
|
{
|
||||||
[Sync] public int2 TargetLocation = int2.Zero;
|
[Sync] public int2 _targetLocation { get { return TargetLocation.HasValue ? TargetLocation.Value : int2.Zero; } }
|
||||||
|
public int2? TargetLocation = null;
|
||||||
[Sync] public bool AttackMoving = false;
|
|
||||||
|
readonly Mobile mobile;
|
||||||
|
readonly AttackMoveInfo Info;
|
||||||
|
|
||||||
|
public AttackMove(Actor self, AttackMoveInfo info)
|
||||||
|
{
|
||||||
|
Info = info;
|
||||||
|
mobile = self.Trait<Mobile>();
|
||||||
|
}
|
||||||
|
|
||||||
public string VoicePhraseForOrder(Actor self, Order order)
|
public string VoicePhraseForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString == "AttackMove")
|
if (order.OrderString == "AttackMove")
|
||||||
return "AttackMove";
|
return "AttackMove";
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Activate(Actor self)
|
||||||
|
{
|
||||||
|
self.CancelActivity();
|
||||||
|
self.QueueActivity(new AttackMoveActivity(mobile.MoveTo(TargetLocation.Value, 1)));
|
||||||
|
self.SetTargetLine(Target.FromCell(TargetLocation.Value), Color.Red);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TickIdle(Actor self)
|
||||||
|
{
|
||||||
|
if (TargetLocation.HasValue)
|
||||||
|
Activate(self);
|
||||||
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
|
TargetLocation = null;
|
||||||
if (order.OrderString == "AttackMove")
|
if (order.OrderString == "AttackMove")
|
||||||
{
|
{
|
||||||
|
if (Info.JustMove)
|
||||||
self.CancelActivity();
|
mobile.ResolveOrder(self, new Order("Move", order));
|
||||||
//if we are just moving, we don't turn on attackmove and this becomes a regular move order
|
|
||||||
if (self.Info.Traits.Get<AttackMoveInfo>().JustMove)
|
|
||||||
{
|
|
||||||
self.QueueActivity(self.Trait<Mobile>().MoveTo(order.TargetLocation, 1));
|
|
||||||
AttackMoving = false;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self.QueueActivity(new AttackMoveActivity(order.TargetLocation));
|
TargetLocation = mobile.NearestMoveableCell(order.TargetLocation);
|
||||||
AttackMoving = true;
|
Activate(self);
|
||||||
TargetLocation = order.TargetLocation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.SetTargetLine(Target.FromOrder(order), Color.Red);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AttackMoving = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AttackMoveActivity : CancelableActivity
|
class AttackMoveActivity : CancelableActivity
|
||||||
{
|
{
|
||||||
readonly int2 target;
|
|
||||||
IActivity inner;
|
IActivity inner;
|
||||||
public AttackMoveActivity( int2 target ) { this.target = target; }
|
public AttackMoveActivity( IActivity inner ) { this.inner = inner; }
|
||||||
|
|
||||||
public override IActivity Tick( Actor self )
|
public override IActivity Tick( Actor self )
|
||||||
{
|
{
|
||||||
self.Trait<AttackBase>().ScanAndAttack(self, true);
|
self.Trait<AttackBase>().ScanAndAttack(self, true);
|
||||||
|
|
||||||
if( inner == null )
|
if( inner == null )
|
||||||
{
|
return NextActivity;
|
||||||
if( IsCanceled )
|
|
||||||
return NextActivity;
|
|
||||||
inner = self.Trait<Mobile>().MoveTo( target, 1 );
|
|
||||||
}
|
|
||||||
inner = Util.RunActivity( self, inner );
|
inner = Util.RunActivity( self, inner );
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,17 +97,5 @@ namespace OpenRA.Mods.RA
|
|||||||
return base.OnCancel( self );
|
return base.OnCancel( self );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
|
||||||
{
|
|
||||||
if (!self.IsInWorld) return;
|
|
||||||
|
|
||||||
if (AttackMoving && self.IsIdle)
|
|
||||||
{
|
|
||||||
self.CancelActivity();
|
|
||||||
self.QueueActivity(new AttackMoveActivity(TargetLocation));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
39
OpenRA.Mods.RA/AttackWander.cs
Normal file
39
OpenRA.Mods.RA/AttackWander.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#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.Traits;
|
||||||
|
using OpenRA.Traits.Activities;
|
||||||
|
using System.Drawing;
|
||||||
|
using OpenRA.Mods.RA.Move;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA
|
||||||
|
{
|
||||||
|
class AttackWanderInfo : ITraitInfo
|
||||||
|
{
|
||||||
|
public readonly int MoveRadius = 4;
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new AttackWander(init.self, this); }
|
||||||
|
}
|
||||||
|
|
||||||
|
class AttackWander : INotifyIdle
|
||||||
|
{
|
||||||
|
readonly AttackWanderInfo Info;
|
||||||
|
public AttackWander(Actor self, AttackWanderInfo info)
|
||||||
|
{
|
||||||
|
Info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TickIdle(Actor self)
|
||||||
|
{
|
||||||
|
var target = Util.SubPxVector[self.World.SharedRandom.Next(255)]* Info.MoveRadius / 1024 + self.Location;
|
||||||
|
self.Trait<AttackMove>().ResolveOrder(self, new Order("AttackMove", self, false) { TargetLocation = target });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -324,6 +324,7 @@
|
|||||||
<Compile Include="Activities\RAHarvesterDockSequence.cs" />
|
<Compile Include="Activities\RAHarvesterDockSequence.cs" />
|
||||||
<Compile Include="Widgets\GameInitInfoWidget.cs" />
|
<Compile Include="Widgets\GameInitInfoWidget.cs" />
|
||||||
<Compile Include="Widgets\Delegates\GameInitDelegate.cs" />
|
<Compile Include="Widgets\Delegates\GameInitDelegate.cs" />
|
||||||
|
<Compile Include="AttackWander.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
Reference in New Issue
Block a user