Rename LocalCoordinatesModel -> BodyOrientation.
This commit is contained in:
@@ -16,7 +16,7 @@ using OpenRA.FileFormats;
|
|||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
public class RenderSimpleInfo : RenderSpritesInfo, LocalCoordinatesModelInfo
|
public class RenderSimpleInfo : RenderSpritesInfo, IBodyOrientationInfo
|
||||||
{
|
{
|
||||||
[Desc("Number of facings for gameplay calculations. -1 indiciates auto-detection from sequence")]
|
[Desc("Number of facings for gameplay calculations. -1 indiciates auto-detection from sequence")]
|
||||||
public readonly int QuantizedFacings = -1;
|
public readonly int QuantizedFacings = -1;
|
||||||
@@ -34,7 +34,7 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RenderSimple : RenderSprites, ILocalCoordinatesModel, IAutoSelectionSize
|
public class RenderSimple : RenderSprites, IBodyOrientation, IAutoSelectionSize
|
||||||
{
|
{
|
||||||
RenderSimpleInfo Info;
|
RenderSimpleInfo Info;
|
||||||
|
|
||||||
|
|||||||
@@ -187,12 +187,12 @@ namespace OpenRA.Traits
|
|||||||
public interface IPostRenderSelection { void RenderAfterWorld(WorldRenderer wr); }
|
public interface IPostRenderSelection { void RenderAfterWorld(WorldRenderer wr); }
|
||||||
public interface IPreRenderSelection { void RenderBeforeWorld(WorldRenderer wr, Actor self); }
|
public interface IPreRenderSelection { void RenderBeforeWorld(WorldRenderer wr, Actor self); }
|
||||||
public interface IRenderAsTerrain { IEnumerable<IRenderable> RenderAsTerrain(WorldRenderer wr, Actor self); }
|
public interface IRenderAsTerrain { IEnumerable<IRenderable> RenderAsTerrain(WorldRenderer wr, Actor self); }
|
||||||
public interface ILocalCoordinatesModel
|
public interface IBodyOrientation
|
||||||
{
|
{
|
||||||
WVec LocalToWorld(WVec vec);
|
WVec LocalToWorld(WVec vec);
|
||||||
WRot QuantizeOrientation(Actor self, WRot orientation);
|
WRot QuantizeOrientation(Actor self, WRot orientation);
|
||||||
}
|
}
|
||||||
public interface LocalCoordinatesModelInfo {}
|
public interface IBodyOrientationInfo {}
|
||||||
|
|
||||||
public interface ITargetable
|
public interface ITargetable
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Cnc
|
namespace OpenRA.Mods.Cnc
|
||||||
{
|
{
|
||||||
public class WithCargoInfo : ITraitInfo, Requires<CargoInfo>, Requires<LocalCoordinatesModelInfo>
|
public class WithCargoInfo : ITraitInfo, Requires<CargoInfo>, Requires<IBodyOrientationInfo>
|
||||||
{
|
{
|
||||||
[Desc("Cargo position relative to turret or body. (forward, right, up) triples")]
|
[Desc("Cargo position relative to turret or body. (forward, right, up) triples")]
|
||||||
public readonly WRange[] LocalOffset = {};
|
public readonly WRange[] LocalOffset = {};
|
||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
IFacing facing;
|
IFacing facing;
|
||||||
WithCargoInfo Info;
|
WithCargoInfo Info;
|
||||||
WVec[] positions;
|
WVec[] positions;
|
||||||
ILocalCoordinatesModel coords;
|
IBodyOrientation body;
|
||||||
|
|
||||||
public WithCargo(Actor self, WithCargoInfo info)
|
public WithCargo(Actor self, WithCargoInfo info)
|
||||||
{
|
{
|
||||||
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
facing = self.TraitOrDefault<IFacing>();
|
facing = self.TraitOrDefault<IFacing>();
|
||||||
Info = info;
|
Info = info;
|
||||||
|
|
||||||
coords = self.Trait<ILocalCoordinatesModel>();
|
body = self.Trait<IBodyOrientation>();
|
||||||
|
|
||||||
if (info.LocalOffset.Length % 3 != 0)
|
if (info.LocalOffset.Length % 3 != 0)
|
||||||
throw new InvalidOperationException("Invalid LocalOffset array length");
|
throw new InvalidOperationException("Invalid LocalOffset array length");
|
||||||
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
foreach (var rr in r)
|
foreach (var rr in r)
|
||||||
yield return rr;
|
yield return rr;
|
||||||
|
|
||||||
var bodyOrientation = coords.QuantizeOrientation(self, self.Orientation);
|
var bodyOrientation = body.QuantizeOrientation(self, self.Orientation);
|
||||||
var pos = self.CenterPosition;
|
var pos = self.CenterPosition;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (var c in cargo.Passengers)
|
foreach (var c in cargo.Passengers)
|
||||||
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
var cargoPassenger = c.Trait<Passenger>();
|
var cargoPassenger = c.Trait<Passenger>();
|
||||||
if (Info.DisplayTypes.Contains(cargoPassenger.info.CargoType))
|
if (Info.DisplayTypes.Contains(cargoPassenger.info.CargoType))
|
||||||
{
|
{
|
||||||
var offset = pos - c.CenterPosition + coords.LocalToWorld(positions[i++ % positions.Length].Rotate(bodyOrientation));
|
var offset = pos - c.CenterPosition + body.LocalToWorld(positions[i++ % positions.Length].Rotate(bodyOrientation));
|
||||||
foreach (var cr in c.Render(wr))
|
foreach (var cr in c.Render(wr))
|
||||||
yield return cr.WithPos(cr.Pos + offset).WithZOffset(1);
|
yield return cr.WithPos(cr.Pos + offset).WithZOffset(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly WeaponInfo Weapon;
|
public readonly WeaponInfo Weapon;
|
||||||
public readonly Barrel[] Barrels;
|
public readonly Barrel[] Barrels;
|
||||||
Lazy<Turreted> Turret;
|
Lazy<Turreted> Turret;
|
||||||
Lazy<ILocalCoordinatesModel> Coords;
|
Lazy<IBodyOrientation> Coords;
|
||||||
|
|
||||||
public WRange Recoil;
|
public WRange Recoil;
|
||||||
public int FireDelay { get; private set; }
|
public int FireDelay { get; private set; }
|
||||||
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
// We can't resolve these until runtime
|
// We can't resolve these until runtime
|
||||||
Turret = Lazy.New(() => self.TraitsImplementing<Turreted>().FirstOrDefault(t => t.Name == info.Turret));
|
Turret = Lazy.New(() => self.TraitsImplementing<Turreted>().FirstOrDefault(t => t.Name == info.Turret));
|
||||||
Coords = Lazy.New(() => self.Trait<ILocalCoordinatesModel>());
|
Coords = Lazy.New(() => self.Trait<IBodyOrientation>());
|
||||||
|
|
||||||
Weapon = Rules.Weapons[info.Weapon.ToLowerInvariant()];
|
Weapon = Rules.Weapons[info.Weapon.ToLowerInvariant()];
|
||||||
Burst = Weapon.Burst;
|
Burst = Weapon.Burst;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class ContrailInfo : ITraitInfo, Requires<LocalCoordinatesModelInfo>
|
class ContrailInfo : ITraitInfo, Requires<IBodyOrientationInfo>
|
||||||
{
|
{
|
||||||
[Desc("Position relative to body")]
|
[Desc("Position relative to body")]
|
||||||
public readonly WVec Offset = WVec.Zero;
|
public readonly WVec Offset = WVec.Zero;
|
||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
ContrailInfo info;
|
ContrailInfo info;
|
||||||
ContrailHistory history;
|
ContrailHistory history;
|
||||||
ILocalCoordinatesModel coords;
|
IBodyOrientation body;
|
||||||
|
|
||||||
public Contrail(Actor self, ContrailInfo info)
|
public Contrail(Actor self, ContrailInfo info)
|
||||||
{
|
{
|
||||||
@@ -40,13 +40,13 @@ namespace OpenRA.Mods.RA
|
|||||||
history = new ContrailHistory(info.TrailLength,
|
history = new ContrailHistory(info.TrailLength,
|
||||||
info.UsePlayerColor ? ContrailHistory.ChooseColor(self) : info.Color);
|
info.UsePlayerColor ? ContrailHistory.ChooseColor(self) : info.Color);
|
||||||
|
|
||||||
coords = self.Trait<ILocalCoordinatesModel>();
|
body = self.Trait<IBodyOrientation>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
var local = info.Offset.Rotate(coords.QuantizeOrientation(self, self.Orientation));
|
var local = info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation));
|
||||||
history.Tick(self.CenterPosition + coords.LocalToWorld(local));
|
history.Tick(self.CenterPosition + body.LocalToWorld(local));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RenderAfterWorld(WorldRenderer wr, Actor self) { history.Render(wr, self); }
|
public void RenderAfterWorld(WorldRenderer wr, Actor self) { history.Render(wr, self); }
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA.Render
|
namespace OpenRA.Mods.RA.Render
|
||||||
{
|
{
|
||||||
public class WithRotorInfo : ITraitInfo, Requires<RenderSpritesInfo>, Requires<LocalCoordinatesModelInfo>
|
public class WithRotorInfo : ITraitInfo, Requires<RenderSpritesInfo>, Requires<IBodyOrientationInfo>
|
||||||
{
|
{
|
||||||
[Desc("Position relative to body")]
|
[Desc("Position relative to body")]
|
||||||
public readonly WVec Offset = WVec.Zero;
|
public readonly WVec Offset = WVec.Zero;
|
||||||
@@ -29,12 +29,12 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
public WithRotor(Actor self, WithRotorInfo info)
|
public WithRotor(Actor self, WithRotorInfo info)
|
||||||
{
|
{
|
||||||
var rs = self.Trait<RenderSprites>();
|
var rs = self.Trait<RenderSprites>();
|
||||||
var coords = self.Trait<ILocalCoordinatesModel>();
|
var body = self.Trait<IBodyOrientation>();
|
||||||
|
|
||||||
rotorAnim = new Animation(rs.GetImage(self));
|
rotorAnim = new Animation(rs.GetImage(self));
|
||||||
rotorAnim.PlayRepeating("rotor");
|
rotorAnim.PlayRepeating("rotor");
|
||||||
rs.anims.Add(info.Id, new AnimationWithOffset(rotorAnim,
|
rs.anims.Add(info.Id, new AnimationWithOffset(rotorAnim,
|
||||||
() => coords.LocalToWorld(info.Offset.Rotate(coords.QuantizeOrientation(self, self.Orientation))),
|
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
|
||||||
null, p => WithTurret.ZOffsetFromCenter(self, p, 1)));
|
null, p => WithTurret.ZOffsetFromCenter(self, p, 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA.Render
|
namespace OpenRA.Mods.RA.Render
|
||||||
{
|
{
|
||||||
class WithSpinnerInfo : ITraitInfo, Requires<RenderSpritesInfo>, Requires<LocalCoordinatesModelInfo>
|
class WithSpinnerInfo : ITraitInfo, Requires<RenderSpritesInfo>, Requires<IBodyOrientationInfo>
|
||||||
{
|
{
|
||||||
[Desc("Sequence name to use")]
|
[Desc("Sequence name to use")]
|
||||||
public readonly string Sequence = "spinner";
|
public readonly string Sequence = "spinner";
|
||||||
@@ -30,12 +30,12 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
public WithSpinner(Actor self, WithSpinnerInfo info)
|
public WithSpinner(Actor self, WithSpinnerInfo info)
|
||||||
{
|
{
|
||||||
var rs = self.Trait<RenderSprites>();
|
var rs = self.Trait<RenderSprites>();
|
||||||
var coords = self.Trait<ILocalCoordinatesModel>();
|
var body = self.Trait<IBodyOrientation>();
|
||||||
|
|
||||||
var spinner = new Animation(rs.GetImage(self));
|
var spinner = new Animation(rs.GetImage(self));
|
||||||
spinner.PlayRepeating(info.Sequence);
|
spinner.PlayRepeating(info.Sequence);
|
||||||
rs.anims.Add("spinner_{0}".F(info.Sequence), new AnimationWithOffset(spinner,
|
rs.anims.Add("spinner_{0}".F(info.Sequence), new AnimationWithOffset(spinner,
|
||||||
() => coords.LocalToWorld(info.Offset.Rotate(coords.QuantizeOrientation(self, self.Orientation))),
|
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
|
||||||
null, p => WithTurret.ZOffsetFromCenter(self, p, 1)));
|
null, p => WithTurret.ZOffsetFromCenter(self, p, 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
@@ -17,7 +17,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA.Render
|
namespace OpenRA.Mods.RA.Render
|
||||||
{
|
{
|
||||||
class WithTurretInfo : ITraitInfo, Requires<RenderSpritesInfo>, Requires<TurretedInfo>, Requires<LocalCoordinatesModelInfo>
|
class WithTurretInfo : ITraitInfo, Requires<RenderSpritesInfo>, Requires<TurretedInfo>, Requires<IBodyOrientationInfo>
|
||||||
{
|
{
|
||||||
[Desc("Sequence name to use")]
|
[Desc("Sequence name to use")]
|
||||||
public readonly string Sequence = "turret";
|
public readonly string Sequence = "turret";
|
||||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
{
|
{
|
||||||
WithTurretInfo info;
|
WithTurretInfo info;
|
||||||
RenderSprites rs;
|
RenderSprites rs;
|
||||||
ILocalCoordinatesModel coords;
|
IBodyOrientation body;
|
||||||
AttackBase ab;
|
AttackBase ab;
|
||||||
Turreted t;
|
Turreted t;
|
||||||
IEnumerable<Armament> arms;
|
IEnumerable<Armament> arms;
|
||||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
rs = self.Trait<RenderSprites>();
|
rs = self.Trait<RenderSprites>();
|
||||||
coords = self.Trait<ILocalCoordinatesModel>();
|
body = self.Trait<IBodyOrientation>();
|
||||||
|
|
||||||
ab = self.TraitOrDefault<AttackBase>();
|
ab = self.TraitOrDefault<AttackBase>();
|
||||||
t = self.TraitsImplementing<Turreted>()
|
t = self.TraitsImplementing<Turreted>()
|
||||||
@@ -72,9 +72,9 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
|
|
||||||
var recoil = arms.Aggregate(WRange.Zero, (a,b) => a + b.Recoil);
|
var recoil = arms.Aggregate(WRange.Zero, (a,b) => a + b.Recoil);
|
||||||
var localOffset = new WVec(-recoil, WRange.Zero, WRange.Zero);
|
var localOffset = new WVec(-recoil, WRange.Zero, WRange.Zero);
|
||||||
var bodyOrientation = coords.QuantizeOrientation(self, self.Orientation);
|
var bodyOrientation = body.QuantizeOrientation(self, self.Orientation);
|
||||||
var turretOrientation = coords.QuantizeOrientation(self, t.LocalOrientation(self));
|
var turretOrientation = body.QuantizeOrientation(self, t.LocalOrientation(self));
|
||||||
return t.Position(self) + coords.LocalToWorld(localOffset.Rotate(turretOrientation).Rotate(bodyOrientation));
|
return t.Position(self) + body.LocalToWorld(localOffset.Rotate(turretOrientation).Rotate(bodyOrientation));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class SmokeTrailWhenDamagedInfo : ITraitInfo, Requires<LocalCoordinatesModelInfo>
|
class SmokeTrailWhenDamagedInfo : ITraitInfo, Requires<IBodyOrientationInfo>
|
||||||
{
|
{
|
||||||
[Desc("Position relative to body")]
|
[Desc("Position relative to body")]
|
||||||
public readonly WVec Offset = WVec.Zero;
|
public readonly WVec Offset = WVec.Zero;
|
||||||
@@ -26,14 +26,14 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
class SmokeTrailWhenDamaged : ITick
|
class SmokeTrailWhenDamaged : ITick
|
||||||
{
|
{
|
||||||
ILocalCoordinatesModel coords;
|
IBodyOrientation body;
|
||||||
SmokeTrailWhenDamagedInfo info;
|
SmokeTrailWhenDamagedInfo info;
|
||||||
int ticks;
|
int ticks;
|
||||||
|
|
||||||
public SmokeTrailWhenDamaged(Actor self, SmokeTrailWhenDamagedInfo info)
|
public SmokeTrailWhenDamaged(Actor self, SmokeTrailWhenDamagedInfo info)
|
||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
coords = self.Trait<ILocalCoordinatesModel>();
|
body = self.Trait<IBodyOrientation>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
@@ -44,8 +44,8 @@ namespace OpenRA.Mods.RA
|
|||||||
if (position.Z > 0 && self.GetDamageState() >= DamageState.Heavy &&
|
if (position.Z > 0 && self.GetDamageState() >= DamageState.Heavy &&
|
||||||
!self.World.FogObscures(new CPos(position)))
|
!self.World.FogObscures(new CPos(position)))
|
||||||
{
|
{
|
||||||
var offset = info.Offset.Rotate(coords.QuantizeOrientation(self, self.Orientation));
|
var offset = info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation));
|
||||||
var pos = position + coords.LocalToWorld(offset);
|
var pos = position + body.LocalToWorld(offset);
|
||||||
self.World.AddFrameEndTask(w => w.Add(new Smoke(w, pos, info.Sprite)));
|
self.World.AddFrameEndTask(w => w.Add(new Smoke(w, pos, info.Sprite)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class NukePowerInfo : SupportPowerInfo, Requires<LocalCoordinatesModelInfo>
|
class NukePowerInfo : SupportPowerInfo, Requires<IBodyOrientationInfo>
|
||||||
{
|
{
|
||||||
[WeaponReference]
|
[WeaponReference]
|
||||||
public readonly string MissileWeapon = "";
|
public readonly string MissileWeapon = "";
|
||||||
@@ -25,12 +25,12 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
class NukePower : SupportPower
|
class NukePower : SupportPower
|
||||||
{
|
{
|
||||||
ILocalCoordinatesModel coords;
|
IBodyOrientation body;
|
||||||
|
|
||||||
public NukePower(Actor self, NukePowerInfo info)
|
public NukePower(Actor self, NukePowerInfo info)
|
||||||
: base(self, info)
|
: base(self, info)
|
||||||
{
|
{
|
||||||
coords = self.Trait<ILocalCoordinatesModel>();
|
body = self.Trait<IBodyOrientation>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IOrderGenerator OrderGenerator(string order, SupportPowerManager manager)
|
public override IOrderGenerator OrderGenerator(string order, SupportPowerManager manager)
|
||||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.RA
|
|||||||
var rb = self.Trait<RenderSimple>();
|
var rb = self.Trait<RenderSimple>();
|
||||||
rb.PlayCustomAnim(self, "active");
|
rb.PlayCustomAnim(self, "active");
|
||||||
self.World.AddFrameEndTask(w => w.Add(
|
self.World.AddFrameEndTask(w => w.Add(
|
||||||
new NukeLaunch(self.Owner, self, npi.MissileWeapon, self.CenterPosition + coords.LocalToWorld(npi.SpawnOffset), order.TargetLocation)));
|
new NukeLaunch(self.Owner, self, npi.MissileWeapon, self.CenterPosition + body.LocalToWorld(npi.SpawnOffset), order.TargetLocation)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class ThrowsParticleInfo : ITraitInfo, Requires<RenderSimpleInfo>, Requires<LocalCoordinatesModelInfo>
|
class ThrowsParticleInfo : ITraitInfo, Requires<RenderSimpleInfo>, Requires<IBodyOrientationInfo>
|
||||||
{
|
{
|
||||||
public readonly string Anim = null;
|
public readonly string Anim = null;
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
var self = init.self;
|
var self = init.self;
|
||||||
var rs = self.Trait<RenderSimple>();
|
var rs = self.Trait<RenderSimple>();
|
||||||
var coords = self.Trait<ILocalCoordinatesModel>();
|
var body = self.Trait<IBodyOrientation>();
|
||||||
|
|
||||||
// TODO: Carry orientation over from the parent instead of just facing
|
// TODO: Carry orientation over from the parent instead of just facing
|
||||||
var bodyFacing = init.Contains<FacingInit>() ? init.Get<FacingInit,int>() : 0;
|
var bodyFacing = init.Contains<FacingInit>() ? init.Get<FacingInit,int>() : 0;
|
||||||
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.RA
|
|||||||
var throwRotation = WRot.FromFacing(Game.CosmeticRandom.Next(1024));
|
var throwRotation = WRot.FromFacing(Game.CosmeticRandom.Next(1024));
|
||||||
var throwOffset = new WVec((int)(Game.CosmeticRandom.Gauss1D(1)*info.ThrowRange.Range), 0, 0).Rotate(throwRotation);
|
var throwOffset = new WVec((int)(Game.CosmeticRandom.Gauss1D(1)*info.ThrowRange.Range), 0, 0).Rotate(throwRotation);
|
||||||
|
|
||||||
initialPos = pos = info.Offset.Rotate(coords.QuantizeOrientation(self, WRot.FromFacing(bodyFacing)));
|
initialPos = pos = info.Offset.Rotate(body.QuantizeOrientation(self, WRot.FromFacing(bodyFacing)));
|
||||||
finalPos = initialPos + throwOffset;
|
finalPos = initialPos + throwOffset;
|
||||||
|
|
||||||
// Facing rotation
|
// Facing rotation
|
||||||
|
|||||||
@@ -84,9 +84,9 @@ namespace OpenRA.Mods.RA
|
|||||||
// Turret offset in world-space
|
// Turret offset in world-space
|
||||||
public WVec Position(Actor self)
|
public WVec Position(Actor self)
|
||||||
{
|
{
|
||||||
var coords = self.Trait<ILocalCoordinatesModel>();
|
var body = self.Trait<IBodyOrientation>();
|
||||||
var bodyOrientation = coords.QuantizeOrientation(self, self.Orientation);
|
var bodyOrientation = body.QuantizeOrientation(self, self.Orientation);
|
||||||
return coords.LocalToWorld(Offset.Rotate(bodyOrientation));
|
return body.LocalToWorld(Offset.Rotate(bodyOrientation));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Orientation in unit-space
|
// Orientation in unit-space
|
||||||
|
|||||||
Reference in New Issue
Block a user