Hacky fix for group movement
This commit is contained in:
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
[FieldLoader.Load]
|
[FieldLoader.Load]
|
||||||
public readonly bool OnRails = false;
|
public readonly bool OnRails = false;
|
||||||
[FieldLoader.Load]
|
[FieldLoader.Load]
|
||||||
public readonly bool SharesCell = true;
|
public readonly bool SharesCell = false;
|
||||||
|
|
||||||
public virtual object Create(ActorInitializer init) { return new Mobile(init, this); }
|
public virtual object Create(ActorInitializer init) { return new Mobile(init, this); }
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
|
|
||||||
int __facing;
|
int __facing;
|
||||||
int2 __fromCell, __toCell;
|
int2 __fromCell, __toCell;
|
||||||
SubCell __fromSubCell, __toSubCell;
|
public SubCell __fromSubCell, __toSubCell;
|
||||||
|
|
||||||
int __altitude;
|
int __altitude;
|
||||||
|
|
||||||
@@ -296,13 +296,13 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
public IEnumerable<Pair<int2, SubCell>> OccupiedCells()
|
public IEnumerable<Pair<int2, SubCell>> OccupiedCells()
|
||||||
{
|
{
|
||||||
if (fromCell == toCell)
|
if (fromCell == toCell)
|
||||||
yield return Pair.New(fromCell, SubCell.FullCell);
|
yield return Pair.New(fromCell, __fromSubCell);
|
||||||
else if (CanEnterCell(toCell))
|
else if (CanEnterCell(toCell))
|
||||||
yield return Pair.New(toCell, SubCell.FullCell);
|
yield return Pair.New(toCell, __toSubCell);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yield return Pair.New(fromCell, SubCell.FullCell);
|
yield return Pair.New(fromCell, __fromSubCell);
|
||||||
yield return Pair.New(toCell, SubCell.FullCell);
|
yield return Pair.New(toCell, __toSubCell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -146,6 +146,8 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
this,
|
this,
|
||||||
Util.CenterOfCell( mobile.fromCell ),
|
Util.CenterOfCell( mobile.fromCell ),
|
||||||
Util.BetweenCells( mobile.fromCell, mobile.toCell ),
|
Util.BetweenCells( mobile.fromCell, mobile.toCell ),
|
||||||
|
mobile.__fromSubCell,
|
||||||
|
mobile.__toSubCell,
|
||||||
mobile.Facing,
|
mobile.Facing,
|
||||||
mobile.Facing,
|
mobile.Facing,
|
||||||
0 );
|
0 );
|
||||||
@@ -249,15 +251,18 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
{
|
{
|
||||||
public readonly Move move;
|
public readonly Move move;
|
||||||
public readonly int2 from, to;
|
public readonly int2 from, to;
|
||||||
|
public readonly SubCell fromSubCell, toSubCell;
|
||||||
public readonly int fromFacing, toFacing;
|
public readonly int fromFacing, toFacing;
|
||||||
public int moveFraction;
|
public int moveFraction;
|
||||||
public readonly int moveFractionTotal;
|
public readonly int moveFractionTotal;
|
||||||
|
|
||||||
public MovePart( Move move, int2 from, int2 to, int fromFacing, int toFacing, int startingFraction )
|
public MovePart( Move move, int2 from, int2 to, SubCell fromSubCell, SubCell toSubCell, int fromFacing, int toFacing, int startingFraction )
|
||||||
{
|
{
|
||||||
this.move = move;
|
this.move = move;
|
||||||
this.from = from;
|
this.from = from;
|
||||||
this.to = to;
|
this.to = to;
|
||||||
|
this.fromSubCell = fromSubCell;
|
||||||
|
this.toSubCell = toSubCell;
|
||||||
this.fromFacing = fromFacing;
|
this.fromFacing = fromFacing;
|
||||||
this.toFacing = toFacing;
|
this.toFacing = toFacing;
|
||||||
this.moveFraction = startingFraction;
|
this.moveFraction = startingFraction;
|
||||||
@@ -302,7 +307,7 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
|
|
||||||
void UpdateCenterLocation( Actor self, Mobile mobile )
|
void UpdateCenterLocation( Actor self, Mobile mobile )
|
||||||
{
|
{
|
||||||
mobile.PxPosition = int2.Lerp( from, to, moveFraction, moveFractionTotal );
|
mobile.PxPosition = int2.Lerp( from + mobile.Info.SubCellOffsets[fromSubCell], to + mobile.Info.SubCellOffsets[toSubCell], moveFraction, moveFractionTotal );
|
||||||
|
|
||||||
if( moveFraction >= moveFractionTotal )
|
if( moveFraction >= moveFractionTotal )
|
||||||
mobile.Facing = toFacing & 0xFF;
|
mobile.Facing = toFacing & 0xFF;
|
||||||
@@ -320,8 +325,8 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
|
|
||||||
class MoveFirstHalf : MovePart
|
class MoveFirstHalf : MovePart
|
||||||
{
|
{
|
||||||
public MoveFirstHalf( Move move, int2 from, int2 to, int fromFacing, int toFacing, int startingFraction )
|
public MoveFirstHalf( Move move, int2 from, int2 to, SubCell fromSubCell, SubCell toSubCell, int fromFacing, int toFacing, int startingFraction )
|
||||||
: base( move, from, to, fromFacing, toFacing, startingFraction )
|
: base( move, from, to, fromSubCell, toSubCell, fromFacing, toFacing, startingFraction )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,6 +341,8 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
move,
|
move,
|
||||||
Util.BetweenCells( mobile.fromCell, mobile.toCell ),
|
Util.BetweenCells( mobile.fromCell, mobile.toCell ),
|
||||||
Util.BetweenCells( mobile.toCell, nextCell.Value ),
|
Util.BetweenCells( mobile.toCell, nextCell.Value ),
|
||||||
|
mobile.__fromSubCell,
|
||||||
|
mobile.__toSubCell,
|
||||||
mobile.Facing,
|
mobile.Facing,
|
||||||
Util.GetNearestFacing( mobile.Facing, Util.GetFacing( nextCell.Value - mobile.toCell, mobile.Facing ) ),
|
Util.GetNearestFacing( mobile.Facing, Util.GetFacing( nextCell.Value - mobile.toCell, mobile.Facing ) ),
|
||||||
moveFraction - moveFractionTotal );
|
moveFraction - moveFractionTotal );
|
||||||
@@ -349,6 +356,8 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
move,
|
move,
|
||||||
Util.BetweenCells( mobile.fromCell, mobile.toCell ),
|
Util.BetweenCells( mobile.fromCell, mobile.toCell ),
|
||||||
Util.CenterOfCell( mobile.toCell ),
|
Util.CenterOfCell( mobile.toCell ),
|
||||||
|
mobile.__fromSubCell,
|
||||||
|
mobile.__toSubCell,
|
||||||
mobile.Facing,
|
mobile.Facing,
|
||||||
mobile.Facing,
|
mobile.Facing,
|
||||||
moveFraction - moveFractionTotal );
|
moveFraction - moveFractionTotal );
|
||||||
@@ -359,8 +368,8 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
|
|
||||||
class MoveSecondHalf : MovePart
|
class MoveSecondHalf : MovePart
|
||||||
{
|
{
|
||||||
public MoveSecondHalf( Move move, int2 from, int2 to, int fromFacing, int toFacing, int startingFraction )
|
public MoveSecondHalf( Move move, int2 from, int2 to, SubCell fromSubCell, SubCell toSubCell, int fromFacing, int toFacing, int startingFraction )
|
||||||
: base( move, from, to, fromFacing, toFacing, startingFraction )
|
: base( move, from, to, fromSubCell, toSubCell, fromFacing, toFacing, startingFraction )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,7 @@
|
|||||||
Range: 4
|
Range: 4
|
||||||
Mobile:
|
Mobile:
|
||||||
Crushes: crate
|
Crushes: crate
|
||||||
|
SharesCell: true
|
||||||
TerrainSpeeds:
|
TerrainSpeeds:
|
||||||
Clear: 90
|
Clear: 90
|
||||||
Rough: 80
|
Rough: 80
|
||||||
@@ -113,7 +114,6 @@
|
|||||||
PoisonedByTiberium:
|
PoisonedByTiberium:
|
||||||
GainsExperience:
|
GainsExperience:
|
||||||
GivesExperience:
|
GivesExperience:
|
||||||
# SharesCell:
|
|
||||||
DrawLineToTarget:
|
DrawLineToTarget:
|
||||||
ActorLostNotification:
|
ActorLostNotification:
|
||||||
Notification: unitlost.aud
|
Notification: unitlost.aud
|
||||||
|
|||||||
@@ -63,6 +63,7 @@
|
|||||||
Range: 4
|
Range: 4
|
||||||
Mobile:
|
Mobile:
|
||||||
Crushes: apmine, crate
|
Crushes: apmine, crate
|
||||||
|
SharesCell: true
|
||||||
TerrainSpeeds:
|
TerrainSpeeds:
|
||||||
Clear: 90
|
Clear: 90
|
||||||
Rough: 80
|
Rough: 80
|
||||||
|
|||||||
Reference in New Issue
Block a user