fix 2422; tesla ignoring weapon offset
This commit is contained in:
@@ -233,18 +233,21 @@ namespace OpenRA.Mods.RA
|
|||||||
+ turret.ScreenSpacePosition);
|
+ turret.ScreenSpacePosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets the screen-space position of a barrel.
|
static PVecInt GetUnitspaceBarrelOffset(Actor self, IFacing facing, Turret turret, Barrel barrel)
|
||||||
public static PVecInt GetBarrelPosition(Actor self, IFacing facing, Turret turret, Barrel barrel)
|
|
||||||
{
|
{
|
||||||
var turreted = self.TraitOrDefault<Turreted>();
|
var turreted = self.TraitOrDefault<Turreted>();
|
||||||
|
|
||||||
if (turreted == null && facing == null)
|
if (turreted == null && facing == null)
|
||||||
return PVecInt.Zero;
|
return PVecInt.Zero;
|
||||||
|
|
||||||
var turretFacing = turreted != null ? turreted.turretFacing : facing.Facing;
|
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
|
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 )
|
public static bool IsInRange( PPos attackOrigin, float range, Actor target )
|
||||||
|
|||||||
Reference in New Issue
Block a user