Split facing into its own interface; fix husks
This commit is contained in:
@@ -15,7 +15,6 @@ namespace OpenRA.Traits.Activities
|
||||
public class Turn : IActivity
|
||||
{
|
||||
public IActivity NextActivity { get; set; }
|
||||
|
||||
int desiredFacing;
|
||||
|
||||
public Turn( int desiredFacing )
|
||||
@@ -25,22 +24,18 @@ namespace OpenRA.Traits.Activities
|
||||
|
||||
public IActivity Tick( Actor self )
|
||||
{
|
||||
var mobile = self.traits.Get<IMove>();
|
||||
var ROT = self.traits.Get<IMove>().ROT;
|
||||
var facing = self.traits.Get<IFacing>();
|
||||
|
||||
if( desiredFacing == mobile.Facing )
|
||||
if( desiredFacing == facing.Facing )
|
||||
return NextActivity;
|
||||
|
||||
mobile.Facing = Util.TickFacing(mobile.Facing, desiredFacing, ROT);
|
||||
facing.Facing = Util.TickFacing(facing.Facing, desiredFacing, facing.ROT);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Cancel( Actor self )
|
||||
{
|
||||
var mobile = self.traits.Get<IMove>();
|
||||
|
||||
desiredFacing = mobile.Facing;
|
||||
desiredFacing = self.traits.Get<IFacing>().Facing;
|
||||
NextActivity = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenRA.Traits
|
||||
public virtual object Create(ActorInitializer init) { return new Mobile(init, this); }
|
||||
}
|
||||
|
||||
public class Mobile : IIssueOrder, IResolveOrder, IOrderCursor, IOrderVoice, IOccupySpace, IMove, INudge
|
||||
public class Mobile : IIssueOrder, IResolveOrder, IOrderCursor, IOrderVoice, IOccupySpace, IMove, IFacing, INudge
|
||||
{
|
||||
public readonly Actor self;
|
||||
public readonly MobileInfo Info;
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenRA.Traits
|
||||
|
||||
public virtual int CreationFacing( Actor self, Actor newUnit )
|
||||
{
|
||||
return newUnit.traits.Get<IMove>().InitialFacing;
|
||||
return newUnit.traits.Get<IFacing>().InitialFacing;
|
||||
}
|
||||
|
||||
public virtual bool Produce( Actor self, ActorInfo producee )
|
||||
@@ -56,7 +56,7 @@ namespace OpenRA.Traits
|
||||
return false;
|
||||
|
||||
var newUnit = self.World.CreateActor( producee.Name, location.Value, self.Owner );
|
||||
newUnit.traits.Get<IMove>().Facing = CreationFacing( self, newUnit ); ;
|
||||
newUnit.traits.Get<IFacing>().Facing = CreationFacing( self, newUnit ); ;
|
||||
|
||||
var pi = self.Info.Traits.Get<ProductionInfo>();
|
||||
var rp = self.traits.GetOrDefault<RallyPoint>();
|
||||
|
||||
@@ -110,8 +110,12 @@ namespace OpenRA.Traits
|
||||
float MovementCostForCell(Actor self, int2 cell);
|
||||
float MovementSpeedForCell(Actor self, int2 cell);
|
||||
IEnumerable<float2> GetCurrentPath(Actor self);
|
||||
int ROT { get; }
|
||||
int Altitude { get; set; }
|
||||
}
|
||||
|
||||
public interface IFacing
|
||||
{
|
||||
int ROT { get; }
|
||||
int Facing { get; set; }
|
||||
int InitialFacing { get; }
|
||||
}
|
||||
|
||||
@@ -23,20 +23,20 @@ namespace OpenRA.Traits
|
||||
[Sync]
|
||||
public int turretFacing = 0;
|
||||
public int? desiredFacing;
|
||||
TurretedInfo Info;
|
||||
IMove Move;
|
||||
TurretedInfo info;
|
||||
IFacing facing;
|
||||
|
||||
public Turreted(Actor self, TurretedInfo info)
|
||||
{
|
||||
Info = info;
|
||||
this.info = info;
|
||||
turretFacing = info.InitialFacing;
|
||||
Move = self.traits.GetOrDefault<IMove>();
|
||||
facing = self.traits.GetOrDefault<IFacing>();
|
||||
}
|
||||
|
||||
public void Tick( Actor self )
|
||||
{
|
||||
var df = desiredFacing ?? ( Move != null ? Move.Facing : turretFacing );
|
||||
turretFacing = Util.TickFacing(turretFacing, df, Info.ROT);
|
||||
var df = desiredFacing ?? ( facing != null ? facing.Facing : turretFacing );
|
||||
turretFacing = Util.TickFacing(turretFacing, df, info.ROT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,9 +40,8 @@ namespace OpenRA.Mods.Cnc
|
||||
{
|
||||
var a = w.CreateActor("C17", startPos, owner);
|
||||
var cargo = a.traits.Get<Cargo>();
|
||||
var aMove = a.traits.Get<IMove>();
|
||||
aMove.Facing = 64;
|
||||
aMove.Altitude = a.Info.Traits.Get<PlaneInfo>().CruiseAltitude;
|
||||
a.traits.Get<IFacing>().Facing = 64;
|
||||
a.traits.Get<IMove>().Altitude = a.Info.Traits.Get<PlaneInfo>().CruiseAltitude;
|
||||
|
||||
var newUnit = new Actor(self.World, producee.Name, new int2(0, 0), self.Owner);
|
||||
cargo.Load(a, newUnit);
|
||||
@@ -60,7 +59,7 @@ namespace OpenRA.Mods.Cnc
|
||||
{
|
||||
ww.Add(actor);
|
||||
actor.traits.Get<IMove>().SetPosition(actor, self.Location + unloadOffset);
|
||||
newUnit.traits.Get<IMove>().Facing = 192;
|
||||
newUnit.traits.Get<IFacing>().Facing = 192;
|
||||
actor.CancelActivity();
|
||||
actor.QueueActivity(new Move(self.Location + exitOffset, self));
|
||||
actor.QueueActivity(new Move(rp.rallyPoint, 0));
|
||||
|
||||
@@ -30,8 +30,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
public IActivity Tick( Actor self )
|
||||
{
|
||||
var move = self.traits.Get<IMove>();
|
||||
|
||||
var facing = self.traits.Get<IFacing>();
|
||||
if (!Target.IsValid)
|
||||
return NextActivity;
|
||||
|
||||
@@ -45,7 +44,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
var numDirs = (renderUnit != null)
|
||||
? renderUnit.anim.CurrentSequence.Facings : 8;
|
||||
|
||||
if (Util.QuantizeFacing(move.Facing, numDirs)
|
||||
if (Util.QuantizeFacing(facing.Facing, numDirs)
|
||||
!= Util.QuantizeFacing(desiredFacing, numDirs))
|
||||
{
|
||||
return new Turn( desiredFacing ) { NextActivity = this };
|
||||
|
||||
@@ -58,9 +58,9 @@ namespace OpenRA.Mods.RA.Activities
|
||||
if (oldHealth != null && newHealth != null)
|
||||
newHealth.HPFraction = oldHealth.HPFraction;
|
||||
|
||||
var move = a.traits.GetOrDefault<IMove>();
|
||||
if (move != null)
|
||||
move.Facing = facing;
|
||||
var ifacing = a.traits.GetOrDefault<IFacing>();
|
||||
if (ifacing != null)
|
||||
ifacing.Facing = facing;
|
||||
|
||||
if (selected)
|
||||
w.Selection.Add(w, a);
|
||||
|
||||
@@ -44,9 +44,9 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
// if we're a thing that can turn, turn to the
|
||||
// right facing for the unload animation
|
||||
var move = self.traits.GetOrDefault<IMove>();
|
||||
var facing = self.traits.GetOrDefault<IFacing>();
|
||||
var unloadFacing = self.Info.Traits.Get<CargoInfo>().UnloadFacing;
|
||||
if (move != null && move.Facing != unloadFacing)
|
||||
if (facing != null && facing.Facing != unloadFacing)
|
||||
return new Turn(unloadFacing) { NextActivity = this };
|
||||
|
||||
// todo: handle the BS of open/close sequences, which are inconsistent,
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA
|
||||
public virtual object Create( ActorInitializer init ) { return new Aircraft( init , this ); }
|
||||
}
|
||||
|
||||
public class Aircraft : IMove, IOccupySpace
|
||||
public class Aircraft : IMove, IFacing, IOccupySpace
|
||||
{
|
||||
[Sync]
|
||||
public int2 Location;
|
||||
|
||||
@@ -103,12 +103,13 @@ namespace OpenRA.Mods.RA
|
||||
if( !CanAttack( self ) ) return;
|
||||
|
||||
var move = self.traits.GetOrDefault<IMove>();
|
||||
var facing = self.traits.GetOrDefault<IFacing>();
|
||||
foreach (var w in Weapons)
|
||||
if (CheckFire(self, move, w))
|
||||
if (CheckFire(self, move, facing, w))
|
||||
w.FiredShot();
|
||||
}
|
||||
|
||||
bool CheckFire(Actor self, IMove move, Weapon w)
|
||||
bool CheckFire(Actor self, IMove move, IFacing facing, Weapon w)
|
||||
{
|
||||
if (w.FireDelay > 0) return false;
|
||||
|
||||
@@ -132,15 +133,15 @@ namespace OpenRA.Mods.RA
|
||||
target = this.target,
|
||||
|
||||
src = (self.CenterLocation
|
||||
+ Combat.GetTurretPosition(self, move, w.Turret)
|
||||
+ Combat.GetBarrelPosition(self, move, w.Turret, barrel)).ToInt2(),
|
||||
+ Combat.GetTurretPosition(self, facing, w.Turret)
|
||||
+ Combat.GetBarrelPosition(self, facing, w.Turret, barrel)).ToInt2(),
|
||||
srcAltitude = move != null ? move.Altitude : 0,
|
||||
dest = target.CenterLocation.ToInt2(),
|
||||
destAltitude = destMove != null ? destMove.Altitude : 0,
|
||||
|
||||
facing = barrel.Facing +
|
||||
(self.traits.Contains<Turreted>() ? self.traits.Get<Turreted>().turretFacing :
|
||||
move != null ? move.Facing : Util.GetFacing(target.CenterLocation - self.CenterLocation, 0)),
|
||||
facing != null ? facing.Facing : Util.GetFacing(target.CenterLocation - self.CenterLocation, 0)),
|
||||
};
|
||||
|
||||
ScheduleDelayedAction( FireDelay( self, self.Info.Traits.Get<AttackBaseInfo>() ), () =>
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
if (!target.IsValid) return;
|
||||
|
||||
var move = self.traits.Get<IMove>();
|
||||
var facingToTarget = Util.GetFacing(target.CenterLocation - self.CenterLocation, move.Facing);
|
||||
var facing = self.traits.Get<IFacing>().Facing;
|
||||
var facingToTarget = Util.GetFacing(target.CenterLocation - self.CenterLocation, facing);
|
||||
|
||||
if (Math.Abs(facingToTarget - move.Facing) % 256 < FacingTolerance)
|
||||
if (Math.Abs(facingToTarget - facing) % 256 < FacingTolerance)
|
||||
DoAttack(self);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,14 +43,13 @@ namespace OpenRA.Mods.RA
|
||||
var weapon = Rules.Weapons[info.Weapon.ToLowerInvariant()];
|
||||
dropDelay = weapon.ROF;
|
||||
|
||||
var move = self.traits.Get<IMove>();
|
||||
var args = new ProjectileArgs
|
||||
{
|
||||
srcAltitude = move.Altitude,
|
||||
srcAltitude = self.traits.Get<IMove>().Altitude,
|
||||
destAltitude = 0,
|
||||
src = self.CenterLocation.ToInt2(),
|
||||
dest = self.CenterLocation.ToInt2(),
|
||||
facing = move.Facing,
|
||||
facing = self.traits.Get<IFacing>().Facing,
|
||||
firedBy = self,
|
||||
weapon = weapon
|
||||
};
|
||||
|
||||
@@ -192,14 +192,13 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
return Util.RotateVectorByFacing(localRecoil, facing, .7f);
|
||||
}
|
||||
|
||||
public static float2 GetTurretPosition(Actor self, IMove move, Turret turret)
|
||||
public static float2 GetTurretPosition(Actor self, IFacing facing, Turret turret)
|
||||
{
|
||||
if(move == null) return turret.ScreenSpacePosition; /* things that don't have a rotating base don't need the turrets repositioned */
|
||||
if(facing == null) return turret.ScreenSpacePosition; /* things that don't have a rotating base don't need the turrets repositioned */
|
||||
|
||||
var ru = self.traits.GetOrDefault<RenderUnit>();
|
||||
var numDirs = (ru != null) ? ru.anim.CurrentSequence.Facings : 8;
|
||||
var bodyFacing = move.Facing;
|
||||
var bodyFacing = facing.Facing;
|
||||
var quantizedFacing = Util.QuantizeFacing(bodyFacing, numDirs) * (256 / numDirs);
|
||||
|
||||
return (Util.RotateVectorByFacing(turret.UnitSpacePosition, quantizedFacing, .7f)
|
||||
@@ -208,14 +207,14 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
|
||||
// gets the screen-space position of a barrel.
|
||||
public static float2 GetBarrelPosition(Actor self, IMove move, Turret turret, Barrel barrel)
|
||||
public static float2 GetBarrelPosition(Actor self, IFacing facing, Turret turret, Barrel barrel)
|
||||
{
|
||||
var turreted = self.traits.GetOrDefault<Turreted>();
|
||||
|
||||
if (turreted == null && move == null)
|
||||
if (turreted == null && facing == null)
|
||||
return float2.Zero;
|
||||
|
||||
var turretFacing = turreted != null ? turreted.turretFacing : move.Facing;
|
||||
var turretFacing = turreted != null ? turreted.turretFacing : facing.Facing;
|
||||
|
||||
return Util.RotateVectorByFacing(barrel.Position, turretFacing, .7f);
|
||||
}
|
||||
|
||||
@@ -34,9 +34,9 @@ namespace OpenRA.Mods.RA
|
||||
var a = w.CreateActor(info.Actor, self.Location
|
||||
+ info.SpawnOffset, self.Owner);
|
||||
|
||||
var move = a.traits.GetOrDefault<IMove>();
|
||||
if (move != null)
|
||||
move.Facing = info.Facing;
|
||||
var facing = a.traits.GetOrDefault<IFacing>();
|
||||
if (facing != null)
|
||||
facing.Facing = info.Facing;
|
||||
|
||||
if (info.InitialActivity != null)
|
||||
a.QueueActivity(Game.CreateObject<IActivity>(info.InitialActivity));
|
||||
|
||||
@@ -18,12 +18,17 @@ namespace OpenRA.Mods.RA
|
||||
public object Create( ActorInitializer init ) { return new Husk( init ); }
|
||||
}
|
||||
|
||||
class Husk : IOccupySpace
|
||||
class Husk : IOccupySpace, IFacing
|
||||
{
|
||||
Actor self;
|
||||
[Sync]
|
||||
int2 location;
|
||||
|
||||
[Sync]
|
||||
public int Facing { get; set; }
|
||||
public int ROT { get { return 0; } }
|
||||
public int InitialFacing { get { return 0; } }
|
||||
|
||||
public Husk(ActorInitializer init)
|
||||
{
|
||||
this.self = init.self;
|
||||
|
||||
@@ -28,10 +28,7 @@ namespace OpenRA.Mods.RA
|
||||
var info = self.Info.Traits.Get<LeavesHuskInfo>();
|
||||
var husk = w.CreateActor(info.HuskActor, self.Location, self.Owner);
|
||||
husk.CenterLocation = self.CenterLocation;
|
||||
var move = self.traits.Get<IMove>();
|
||||
var huskMove = husk.traits.Get<IMove>();
|
||||
huskMove.Altitude = move.Altitude;
|
||||
huskMove.Facing = move.Facing;
|
||||
husk.traits.Get<IFacing>().Facing = self.traits.Get<IFacing>().Facing;
|
||||
|
||||
var turreted = self.traits.GetOrDefault<Turreted>();
|
||||
if (turreted != null)
|
||||
|
||||
@@ -24,10 +24,9 @@ namespace OpenRA.Mods.RA
|
||||
Actor dockedHarv = null;
|
||||
public void OnDock(Actor self, Actor harv, DeliverResources dockOrder)
|
||||
{
|
||||
var move = harv.traits.Get<IMove>();
|
||||
var harvester = harv.traits.Get<Harvester>();
|
||||
|
||||
if (move.Facing != 64)
|
||||
if (harv.traits.Get<IFacing>().Facing != 64)
|
||||
harv.QueueActivity (new Turn (64));
|
||||
|
||||
harv.QueueActivity (new CallFunc (() =>
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA
|
||||
return false;
|
||||
|
||||
var newUnit = self.World.CreateActor( producee.Name, location.Value, self.Owner );
|
||||
newUnit.traits.Get<IMove>().Facing = CreationFacing( self, newUnit ); ;
|
||||
newUnit.traits.Get<IFacing>().Facing = CreationFacing( self, newUnit ); ;
|
||||
|
||||
var pi = self.Info.Traits.Get<ProductionInfo>();
|
||||
var rp = self.traits.GetOrDefault<RallyPoint>();
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
public class RenderInfantry : RenderSimple, INotifyAttack, INotifyDamage
|
||||
{
|
||||
public RenderInfantry(Actor self)
|
||||
: base(self, () => self.traits.Get<IMove>().Facing)
|
||||
: base(self, () => self.traits.Get<IFacing>().Facing)
|
||||
{
|
||||
anim.Play("stand");
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
public class RenderUnit : RenderSimple, INotifyDamage
|
||||
{
|
||||
public RenderUnit(Actor self)
|
||||
: base(self, () => self.traits.Contains<IMove>() ? self.traits.Get<IMove>().Facing : 0)
|
||||
: base(self, () => self.traits.Contains<IFacing>() ? self.traits.Get<IFacing>().Facing : 0)
|
||||
{
|
||||
anim.Play("idle");
|
||||
anims.Add( "smoke", new AnimationWithOffset( new Animation( "smoke_m" ), null, () => !isSmoking ) );
|
||||
|
||||
@@ -24,19 +24,18 @@ namespace OpenRA.Mods.RA.Render
|
||||
class RenderUnitRotor : RenderUnit
|
||||
{
|
||||
public Animation rotorAnim, secondRotorAnim;
|
||||
IMove move;
|
||||
|
||||
public RenderUnitRotor(Actor self)
|
||||
public RenderUnitRotor( Actor self )
|
||||
: base(self)
|
||||
{
|
||||
move = self.traits.Get<IMove>();
|
||||
var facing = self.traits.Get<IFacing>();
|
||||
var info = self.Info.Traits.Get<RenderUnitRotorInfo>();
|
||||
|
||||
rotorAnim = new Animation(GetImage(self));
|
||||
rotorAnim.PlayRepeating("rotor");
|
||||
anims.Add("rotor_1", new AnimationWithOffset(
|
||||
rotorAnim,
|
||||
() => Combat.GetTurretPosition( self, move, new Turret(info.PrimaryOffset)),
|
||||
() => Combat.GetTurretPosition( self, facing, new Turret(info.PrimaryOffset)),
|
||||
null ) { ZOffset = 1 } );
|
||||
|
||||
if (info.SecondaryOffset == null) return;
|
||||
@@ -45,7 +44,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
secondRotorAnim.PlayRepeating("rotor2");
|
||||
anims.Add("rotor_2", new AnimationWithOffset(
|
||||
secondRotorAnim,
|
||||
() => Combat.GetTurretPosition(self, move, new Turret(info.SecondaryOffset)),
|
||||
() => Combat.GetTurretPosition(self, facing, new Turret(info.SecondaryOffset)),
|
||||
null) { ZOffset = 1 });
|
||||
}
|
||||
|
||||
@@ -53,7 +52,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
base.Tick(self);
|
||||
|
||||
var isFlying = move.Altitude > 0;
|
||||
var isFlying = self.traits.Get<IMove>().Altitude > 0;
|
||||
if (isFlying ^ (rotorAnim.CurrentSequence.Name != "rotor"))
|
||||
return;
|
||||
|
||||
|
||||
@@ -24,15 +24,14 @@ namespace OpenRA.Mods.RA.Render
|
||||
public RenderUnitSpinner(Actor self)
|
||||
: base(self)
|
||||
{
|
||||
var move = self.traits.Get<IMove>();
|
||||
var info = self.Info.Traits.Get<RenderUnitSpinnerInfo>();
|
||||
|
||||
var spinnerAnim = new Animation(GetImage(self));
|
||||
spinnerAnim.PlayRepeating("spinner");
|
||||
anims.Add("spinner", new AnimationWithOffset(
|
||||
spinnerAnim,
|
||||
() => Combat.GetTurretPosition(self, move, new Turret(info.Offset)),
|
||||
null) { ZOffset = 1 });
|
||||
() => Combat.GetTurretPosition( self, self.traits.Get<IFacing>(), new Turret(info.Offset)),
|
||||
null ) { ZOffset = 1 } );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
public RenderUnitTurreted(Actor self)
|
||||
: base(self)
|
||||
{
|
||||
var move = self.traits.Get<IMove>();
|
||||
var facing = self.traits.Get<IFacing>();
|
||||
var turreted = self.traits.Get<Turreted>();
|
||||
var attack = self.traits.GetOrDefault<AttackBase>();
|
||||
var attackInfo = self.Info.Traits.Get<AttackBaseInfo>();
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
var turret = attack.Turrets[i];
|
||||
anims.Add( "turret_{0}".F(i),
|
||||
new AnimationWithOffset( turretAnim,
|
||||
() => Combat.GetTurretPosition( self, move, turret ),
|
||||
() => Combat.GetTurretPosition( self, facing, turret ),
|
||||
null) { ZOffset = 1 });
|
||||
|
||||
if (attackInfo.MuzzleFlash)
|
||||
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
() => (int)(turret.Recoil * 5.9f)); /* hack: dumb crap */
|
||||
anims.Add("muzzle_flash_{0}".F(i),
|
||||
new AnimationWithOffset(muzzleFlash,
|
||||
() => Combat.GetTurretPosition(self, move, turret),
|
||||
() => Combat.GetTurretPosition(self, facing, turret),
|
||||
() => turret.Recoil <= 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,9 +48,8 @@ namespace OpenRA.Mods.RA
|
||||
var flare = flareType != null ? w.CreateActor(flareType, order.TargetLocation, Owner) : null;
|
||||
|
||||
var a = w.CreateActor((Info as AirstrikePowerInfo).UnitType, startPos, Owner);
|
||||
var aMove = a.traits.Get<IMove>();
|
||||
aMove.Facing = Util.GetFacing(order.TargetLocation - startPos, 0);
|
||||
aMove.Altitude = a.Info.Traits.Get<PlaneInfo>().CruiseAltitude;
|
||||
a.traits.Get<IFacing>().Facing = Util.GetFacing(order.TargetLocation - startPos, 0);
|
||||
a.traits.Get<IMove>().Altitude = a.Info.Traits.Get<PlaneInfo>().CruiseAltitude;
|
||||
a.traits.Get<CarpetBomb>().SetTarget(order.TargetLocation);
|
||||
|
||||
a.CancelActivity();
|
||||
|
||||
@@ -61,9 +61,8 @@ namespace OpenRA.Mods.RA
|
||||
var flare = flareType != null ? w.CreateActor(flareType, p, owner) : null;
|
||||
|
||||
var a = w.CreateActor((Info as ParatroopersPowerInfo).UnitType, startPos, owner);
|
||||
var aMove = a.traits.Get<IMove>();
|
||||
aMove.Facing = Util.GetFacing(p - startPos, 0);
|
||||
aMove.Altitude = a.Info.Traits.Get<PlaneInfo>().CruiseAltitude;
|
||||
a.traits.Get<IFacing>().Facing = Util.GetFacing(p - startPos, 0);
|
||||
a.traits.Get<IMove>().Altitude = a.Info.Traits.Get<PlaneInfo>().CruiseAltitude;
|
||||
|
||||
a.CancelActivity();
|
||||
a.QueueActivity(new FlyCircle(p));
|
||||
|
||||
@@ -46,9 +46,8 @@ namespace OpenRA.Mods.RA
|
||||
var enterCell = self.World.ChooseRandomEdgeCell();
|
||||
|
||||
var plane = self.World.CreateActor("U2", enterCell, self.Owner);
|
||||
var planeMove = plane.traits.Get<IMove>();
|
||||
planeMove.Altitude = plane.Info.Traits.Get<PlaneInfo>().CruiseAltitude;
|
||||
planeMove.Facing = Util.GetFacing(order.TargetLocation - enterCell, 0);
|
||||
plane.traits.Get<IMove>().Altitude = plane.Info.Traits.Get<PlaneInfo>().CruiseAltitude;
|
||||
plane.traits.Get<IFacing>().Facing = Util.GetFacing(order.TargetLocation - enterCell, 0);
|
||||
|
||||
plane.CancelActivity();
|
||||
plane.QueueActivity(new Fly(Util.CenterOfCell(order.TargetLocation)));
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace OpenRA.Mods.RA
|
||||
if (info != null)
|
||||
{
|
||||
alt = 0;
|
||||
var move = self.traits.Get<IMove>();
|
||||
pos = Combat.GetTurretPosition(self, move, new Turret(info.Offset));
|
||||
var ifacing = self.traits.Get<IFacing>();
|
||||
pos = Combat.GetTurretPosition(self, ifacing, new Turret(info.Offset));
|
||||
var ru = self.traits.Get<RenderUnit>();
|
||||
|
||||
v = Game.CosmeticRandom.Gauss2D(1) * info.Spread.RelOffset();
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.RA
|
||||
va = info.Speed;
|
||||
|
||||
if (!info.UseTurretFacing) InitialFacing = null;
|
||||
facing = InitialFacing ?? move.Facing;
|
||||
facing = InitialFacing ?? ifacing.Facing;
|
||||
|
||||
var anim = new Animation(ru.GetImage(self), () => (int)facing);
|
||||
anim.PlayRepeating(info.Anim);
|
||||
|
||||
@@ -25,11 +25,10 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public WithMuzzleFlash(Actor self)
|
||||
{
|
||||
var move = self.traits.Get<IMove>();
|
||||
var attackInfo = self.Info.Traits.Get<AttackBaseInfo>();
|
||||
var render = self.traits.Get<RenderSimple>();
|
||||
|
||||
muzzleFlash = new Animation(render.GetImage(self), () => move.Facing);
|
||||
muzzleFlash = new Animation(render.GetImage(self), () => self.traits.Get<IFacing>().Facing);
|
||||
muzzleFlash.Play("muzzle");
|
||||
|
||||
render.anims.Add("muzzle", new RenderSimple.AnimationWithOffset(
|
||||
|
||||
Reference in New Issue
Block a user