From e69ad1cb2de768e50d8cc77098b9c10b60300263 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Tue, 20 Sep 2016 17:03:12 +0200 Subject: [PATCH] Add support for being blockable to LaserZap --- OpenRA.Mods.Common/Projectiles/LaserZap.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/OpenRA.Mods.Common/Projectiles/LaserZap.cs b/OpenRA.Mods.Common/Projectiles/LaserZap.cs index 46e8c821fe..c29b85f0d6 100644 --- a/OpenRA.Mods.Common/Projectiles/LaserZap.cs +++ b/OpenRA.Mods.Common/Projectiles/LaserZap.cs @@ -16,6 +16,7 @@ using OpenRA.GameRules; using OpenRA.Graphics; using OpenRA.Mods.Common.Effects; using OpenRA.Mods.Common.Graphics; +using OpenRA.Mods.Common.Traits; using OpenRA.Traits; namespace OpenRA.Mods.Common.Projectiles @@ -45,6 +46,12 @@ namespace OpenRA.Mods.Common.Projectiles [Desc("Maximum offset at the maximum range.")] public readonly WDist Inaccuracy = WDist.Zero; + [Desc("Extra search radius beyond beam width. Required to ensure affecting actors with large health radius.")] + public readonly WDist TargetExtraSearchRadius = new WDist(1536); + + [Desc("Beam can be blocked.")] + public readonly bool Blockable = false; + [Desc("Draw a second beam (for 'glow' effect).")] public readonly bool SecondaryBeam = false; @@ -116,6 +123,14 @@ namespace OpenRA.Mods.Common.Projectiles if (info.TracksTarget && args.GuidedTarget.IsValidFor(args.SourceActor)) target = args.GuidedTarget.CenterPosition; + // Check for blocking actors + WPos blockedPos; + if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween(world, source, target, + info.Width, info.TargetExtraSearchRadius, out blockedPos)) + { + target = blockedPos; + } + if (!doneDamage) { if (hitanim != null)