Change Exit.SpawnOffsetVector to WVec.
This commit is contained in:
@@ -51,8 +51,7 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
heli.reservation = res.Reserve(dest, self, heli);
|
heli.reservation = res.Reserve(dest, self, heli);
|
||||||
|
|
||||||
var exit = dest.Info.Traits.WithInterface<ExitInfo>().FirstOrDefault();
|
var exit = dest.Info.Traits.WithInterface<ExitInfo>().FirstOrDefault();
|
||||||
var offset = (exit == null) ? WVec.Zero :
|
var offset = (exit != null) ? exit.SpawnOffsetVector : WVec.Zero;
|
||||||
new WVec(exit.SpawnOffsetVector.X, exit.SpawnOffsetVector.Y, 0) * 1024 / Game.CellSize;
|
|
||||||
|
|
||||||
return Util.SequenceActivities(
|
return Util.SequenceActivities(
|
||||||
new HeliFly(dest.CenterPosition + offset),
|
new HeliFly(dest.CenterPosition + offset),
|
||||||
|
|||||||
@@ -72,8 +72,7 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
reservation = res.Reserve(order.TargetActor, self, this);
|
reservation = res.Reserve(order.TargetActor, self, this);
|
||||||
|
|
||||||
var exit = order.TargetActor.Info.Traits.WithInterface<ExitInfo>().FirstOrDefault();
|
var exit = order.TargetActor.Info.Traits.WithInterface<ExitInfo>().FirstOrDefault();
|
||||||
var offset = (exit == null) ? WVec.Zero :
|
var offset = (exit != null) ? exit.SpawnOffsetVector : WVec.Zero;
|
||||||
new WVec(exit.SpawnOffsetVector.X, exit.SpawnOffsetVector.Y, 0) * 1024 / Game.CellSize;
|
|
||||||
|
|
||||||
self.SetTargetLine(Target.FromActor(order.TargetActor), Color.Green);
|
self.SetTargetLine(Target.FromActor(order.TargetActor), Color.Green);
|
||||||
|
|
||||||
|
|||||||
@@ -217,8 +217,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
cargo.Load(chinook, world.CreateActor(false, ChinookCargo.Random(world.SharedRandom), allies, null, null));
|
cargo.Load(chinook, world.CreateActor(false, ChinookCargo.Random(world.SharedRandom), allies, null, null));
|
||||||
|
|
||||||
var exit = lz.Info.Traits.WithInterface<ExitInfo>().FirstOrDefault();
|
var exit = lz.Info.Traits.WithInterface<ExitInfo>().FirstOrDefault();
|
||||||
var offset = (exit == null) ? WVec.Zero :
|
var offset = (exit != null) ? exit.SpawnOffsetVector : WVec.Zero;
|
||||||
new WVec(exit.SpawnOffsetVector.X, exit.SpawnOffsetVector.Y, 0) * 1024 / Game.CellSize;
|
|
||||||
|
|
||||||
chinook.QueueActivity(new HeliFly(lz.CenterPosition + offset)); // no reservation of hpad but it's not needed
|
chinook.QueueActivity(new HeliFly(lz.CenterPosition + offset)); // no reservation of hpad but it's not needed
|
||||||
chinook.QueueActivity(new Turn(0));
|
chinook.QueueActivity(new Turn(0));
|
||||||
|
|||||||
@@ -34,9 +34,11 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int2 ExitCell = int2.Zero; // in cells relative to TopLeft
|
public readonly int2 ExitCell = int2.Zero; // in cells relative to TopLeft
|
||||||
public readonly int Facing = -1;
|
public readonly int Facing = -1;
|
||||||
|
|
||||||
public PVecInt SpawnOffsetVector { get { return (PVecInt)SpawnOffset; } }
|
// TODO: Push this conversion into the yaml
|
||||||
|
public WVec SpawnOffsetVector { get { return new WVec(SpawnOffset.X, SpawnOffset.Y, 0) * 1024 / Game.CellSize; } }
|
||||||
public CVec ExitCellVector { get { return (CVec)ExitCell; } }
|
public CVec ExitCellVector { get { return (CVec)ExitCell; } }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Exit { }
|
public class Exit { }
|
||||||
|
|
||||||
public class Production
|
public class Production
|
||||||
@@ -50,7 +52,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public void DoProduction(Actor self, ActorInfo producee, ExitInfo exitinfo)
|
public void DoProduction(Actor self, ActorInfo producee, ExitInfo exitinfo)
|
||||||
{
|
{
|
||||||
var exit = self.Location + exitinfo.ExitCellVector;
|
var exit = self.Location + exitinfo.ExitCellVector;
|
||||||
var spawn = (self.Trait<IHasLocation>().PxPosition + exitinfo.SpawnOffsetVector).ToWPos(0);
|
var spawn = self.CenterPosition + exitinfo.SpawnOffsetVector;
|
||||||
var to = exit.CenterPosition;
|
var to = exit.CenterPosition;
|
||||||
|
|
||||||
var fi = producee.Traits.Get<IFacingInfo>();
|
var fi = producee.Traits.Get<IFacingInfo>();
|
||||||
|
|||||||
Reference in New Issue
Block a user