implements flashing on healing units
This commit is contained in:
committed by
Gustas
parent
d83a871520
commit
da638a495c
60
OpenRA.Mods.Common/Warheads/FlashTargetsInRadiusWarhead.cs
Normal file
60
OpenRA.Mods.Common/Warheads/FlashTargetsInRadiusWarhead.cs
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright (c) The OpenRA Developers and Contributors
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation, either version 3 of
|
||||||
|
* the License, or (at your option) any later version. For more
|
||||||
|
* information, see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.GameRules;
|
||||||
|
using OpenRA.Mods.Common.Effects;
|
||||||
|
using OpenRA.Primitives;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.Warheads
|
||||||
|
{
|
||||||
|
[Desc("Trigger a flash effect on the targeted actor, or actors within a circle.")]
|
||||||
|
public class FlashTargetsInRadiusWarhead : Warhead
|
||||||
|
{
|
||||||
|
[Desc("The overlay color to display when ActorFlashType is Overlay.")]
|
||||||
|
public readonly Color ActorFlashOverlayColor = Color.White;
|
||||||
|
|
||||||
|
[Desc("The overlay transparency to display when ActorFlashType is Overlay.")]
|
||||||
|
public readonly float ActorFlashOverlayAlpha = 0.5f;
|
||||||
|
|
||||||
|
[Desc("The tint to apply when ActorFlashType is Tint.")]
|
||||||
|
public readonly float3 ActorFlashTint = new(1.4f, 1.4f, 1.4f);
|
||||||
|
|
||||||
|
[Desc("Number of times to flash actors.")]
|
||||||
|
public readonly int ActorFlashCount = 2;
|
||||||
|
|
||||||
|
[Desc("Number of ticks between actor flashes.")]
|
||||||
|
public readonly int ActorFlashInterval = 2;
|
||||||
|
|
||||||
|
[Desc("Radius of an area at which effect will be applied. If left default effect applies only to target actor.")]
|
||||||
|
public readonly WDist Radius = new(0);
|
||||||
|
|
||||||
|
[Desc("Controls the way damage is calculated. Possible values are 'HitShape', 'ClosestTargetablePosition' and 'CenterPosition'.")]
|
||||||
|
public readonly DamageCalculationType DamageCalculationType = DamageCalculationType.HitShape;
|
||||||
|
|
||||||
|
public override void DoImpact(in Target target, WarheadArgs args)
|
||||||
|
{
|
||||||
|
var targetActor = target.Actor;
|
||||||
|
var firedBy = args.SourceActor;
|
||||||
|
var victims = Radius == WDist.Zero && targetActor != null ? new Actor[] { targetActor } : firedBy.World.FindActorsInCircle(target.CenterPosition, Radius);
|
||||||
|
|
||||||
|
foreach (var victim in victims)
|
||||||
|
{
|
||||||
|
if (!IsValidAgainst(victim, firedBy))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
victim.World.AddFrameEndTask(w => w.Add(new FlashTarget(
|
||||||
|
victim, ActorFlashOverlayColor, ActorFlashOverlayAlpha,
|
||||||
|
ActorFlashCount, ActorFlashInterval)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -128,7 +128,11 @@ Heal:
|
|||||||
ValidTargets: Heal
|
ValidTargets: Heal
|
||||||
Projectile: Bullet
|
Projectile: Bullet
|
||||||
Speed: 1c682
|
Speed: 1c682
|
||||||
Warhead@1Dam: SpreadDamage
|
Warhead@1Eff: FlashTargetsInRadius
|
||||||
|
Radius: 1065
|
||||||
|
ValidRelationships: Ally
|
||||||
|
ValidTargets: Heal
|
||||||
|
Warhead@2Dam: SpreadDamage
|
||||||
Spread: 213
|
Spread: 213
|
||||||
Damage: -5000
|
Damage: -5000
|
||||||
ValidRelationships: Ally
|
ValidRelationships: Ally
|
||||||
@@ -139,7 +143,9 @@ Repair:
|
|||||||
Inherits: Heal
|
Inherits: Heal
|
||||||
Report: fixit1.aud
|
Report: fixit1.aud
|
||||||
ValidTargets: Repair
|
ValidTargets: Repair
|
||||||
Warhead@1Dam: SpreadDamage
|
Warhead@1Eff: FlashTargetsInRadius
|
||||||
|
ValidTargets: Repair
|
||||||
|
Warhead@2Dam: SpreadDamage
|
||||||
Damage: -2000
|
Damage: -2000
|
||||||
ValidTargets: Repair
|
ValidTargets: Repair
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,14 @@
|
|||||||
ValidTargets: Heal
|
ValidTargets: Heal
|
||||||
TargetActorCenter: true
|
TargetActorCenter: true
|
||||||
Projectile: InstantHit
|
Projectile: InstantHit
|
||||||
Warhead@1Dam: TargetDamage
|
Warhead@1Eff: FlashTargetsInRadius
|
||||||
|
ValidTargets: Heal
|
||||||
|
ValidRelationships: Ally
|
||||||
|
Warhead@2Dam: TargetDamage
|
||||||
DebugOverlayColor: 00FF00
|
DebugOverlayColor: 00FF00
|
||||||
Damage: -5000
|
Damage: -5000
|
||||||
ValidTargets: Heal
|
ValidTargets: Heal
|
||||||
|
ValidRelationships: Ally
|
||||||
|
|
||||||
Heal:
|
Heal:
|
||||||
Inherits: ^HealWeapon
|
Inherits: ^HealWeapon
|
||||||
@@ -18,5 +22,7 @@ Repair:
|
|||||||
Range: 1c819
|
Range: 1c819
|
||||||
Report: repair11.aud
|
Report: repair11.aud
|
||||||
ValidTargets: Repair
|
ValidTargets: Repair
|
||||||
Warhead@1Dam: TargetDamage
|
Warhead@1Eff: FlashTargetsInRadius
|
||||||
|
ValidTargets: Repair
|
||||||
|
Warhead@2Dam: TargetDamage
|
||||||
ValidTargets: Repair
|
ValidTargets: Repair
|
||||||
|
|||||||
Reference in New Issue
Block a user