From f337c7fb406481115e5aa2d08ec6337d4288078d Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 7 Oct 2012 19:23:50 +1300 Subject: [PATCH] fix 2422; tesla ignoring weapon offset --- OpenRA.Mods.RA/Combat.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.RA/Combat.cs b/OpenRA.Mods.RA/Combat.cs index b011ba258c..b8071db40e 100755 --- a/OpenRA.Mods.RA/Combat.cs +++ b/OpenRA.Mods.RA/Combat.cs @@ -233,18 +233,21 @@ namespace OpenRA.Mods.RA + turret.ScreenSpacePosition); } - // gets the screen-space position of a barrel. - public static PVecInt GetBarrelPosition(Actor self, IFacing facing, Turret turret, Barrel barrel) + static PVecInt GetUnitspaceBarrelOffset(Actor self, IFacing facing, Turret turret, Barrel barrel) { var turreted = self.TraitOrDefault(); - if (turreted == null && facing == null) return PVecInt.Zero; var turretFacing = turreted != null ? turreted.turretFacing : facing.Facing; + return (PVecInt)(PVecFloat)Util.RotateVectorByFacing(barrel.TurretSpaceOffset.ToFloat2(), turretFacing, .7f); + } + // gets the screen-space position of a barrel. + public static PVecInt GetBarrelPosition(Actor self, IFacing facing, Turret turret, Barrel barrel) + { return GetTurretPosition(self, facing, turret) + barrel.ScreenSpaceOffset - + (PVecInt)(PVecFloat)Util.RotateVectorByFacing(barrel.TurretSpaceOffset.ToFloat2(), turretFacing, .7f); + + GetUnitspaceBarrelOffset(self, facing, turret, barrel); } public static bool IsInRange( PPos attackOrigin, float range, Actor target )