Minor projectile clean-ups and perf optimizations
This commit is contained in:
@@ -103,20 +103,19 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
readonly BulletInfo info;
|
||||
readonly ProjectileArgs args;
|
||||
readonly Animation anim;
|
||||
[Sync] readonly WAngle angle;
|
||||
[Sync] readonly WDist speed;
|
||||
readonly int facing;
|
||||
readonly WAngle angle;
|
||||
readonly WDist speed;
|
||||
readonly string trailPalette;
|
||||
readonly ContrailRenderable contrail;
|
||||
|
||||
ContrailRenderable contrail;
|
||||
string trailPalette;
|
||||
[Sync]
|
||||
WPos pos, target, source;
|
||||
|
||||
[Sync] WPos pos, target, source;
|
||||
int length;
|
||||
[Sync] int facing;
|
||||
int ticks, smokeTicks;
|
||||
int remainingBounces;
|
||||
|
||||
public Actor SourceActor { get { return args.SourceActor; } }
|
||||
|
||||
public Bullet(BulletInfo info, ProjectileArgs args)
|
||||
{
|
||||
this.info = info;
|
||||
|
||||
@@ -51,8 +51,10 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
readonly Animation anim;
|
||||
readonly ProjectileArgs args;
|
||||
readonly WVec acceleration;
|
||||
[Sync] WVec velocity;
|
||||
[Sync] WPos pos;
|
||||
WVec velocity;
|
||||
|
||||
[Sync]
|
||||
WPos pos;
|
||||
|
||||
public GravityBomb(GravityBombInfo info, ProjectileArgs args)
|
||||
{
|
||||
|
||||
@@ -43,20 +43,18 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
readonly InstantHitInfo info;
|
||||
|
||||
Target target;
|
||||
WPos source;
|
||||
|
||||
public InstantHit(InstantHitInfo info, ProjectileArgs args)
|
||||
{
|
||||
this.args = args;
|
||||
this.info = info;
|
||||
source = args.Source;
|
||||
|
||||
if (args.Weapon.TargetActorCenter)
|
||||
target = args.GuidedTarget;
|
||||
else if (info.Inaccuracy.Length > 0)
|
||||
{
|
||||
var inaccuracy = Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
|
||||
var maxOffset = inaccuracy * (args.PassiveTarget - source).Length / args.Weapon.Range.Length;
|
||||
var maxOffset = inaccuracy * (args.PassiveTarget - args.Source).Length / args.Weapon.Range.Length;
|
||||
target = Target.FromPos(args.PassiveTarget + WVec.FromPDF(args.SourceActor.World.SharedRandom, 2) * maxOffset / 1024);
|
||||
}
|
||||
else
|
||||
@@ -67,7 +65,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
{
|
||||
// Check for blocking actors
|
||||
WPos blockedPos;
|
||||
if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween(world, source, target.CenterPosition,
|
||||
if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween(world, args.Source, target.CenterPosition,
|
||||
info.Width, out blockedPos))
|
||||
{
|
||||
target = Target.FromPos(blockedPos);
|
||||
|
||||
@@ -103,12 +103,16 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
readonly Animation hitanim;
|
||||
readonly Color color;
|
||||
readonly Color secondaryColor;
|
||||
int ticks = 0;
|
||||
readonly bool hasLaunchEffect;
|
||||
int ticks;
|
||||
int interval;
|
||||
bool showHitAnim;
|
||||
bool hasLaunchEffect;
|
||||
[Sync] WPos target;
|
||||
[Sync] WPos source;
|
||||
|
||||
[Sync]
|
||||
WPos target;
|
||||
|
||||
[Sync]
|
||||
WPos source;
|
||||
|
||||
public LaserZap(LaserZapInfo info, ProjectileArgs args, Color color)
|
||||
{
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
|
||||
States state;
|
||||
bool targetPassedBy;
|
||||
bool lockOn = false;
|
||||
bool lockOn;
|
||||
bool allowPassBy; // TODO: use this also with high minimum launch angle settings
|
||||
|
||||
WPos targetPosition;
|
||||
@@ -187,7 +187,9 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
WVec tarVel;
|
||||
WVec predVel;
|
||||
|
||||
[Sync] WPos pos;
|
||||
[Sync]
|
||||
WPos pos;
|
||||
|
||||
WVec velocity;
|
||||
int speed;
|
||||
int loopRadius;
|
||||
@@ -195,11 +197,12 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
WDist rangeLimit;
|
||||
|
||||
int renderFacing;
|
||||
[Sync] int hFacing;
|
||||
[Sync] int vFacing;
|
||||
|
||||
public Actor SourceActor { get { return args.SourceActor; } }
|
||||
public Target GuidedTarget { get { return args.GuidedTarget; } }
|
||||
[Sync]
|
||||
int hFacing;
|
||||
|
||||
[Sync]
|
||||
int vFacing;
|
||||
|
||||
public Missile(MissileInfo info, ProjectileArgs args)
|
||||
{
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
public readonly Color BeamColor;
|
||||
public readonly Color HelixColor;
|
||||
|
||||
int ticks = 0;
|
||||
int ticks;
|
||||
bool animationComplete;
|
||||
WPos target;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user