Add custom DeathTypes/DamageTypes support to RevealOnDeath
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Traits;
|
||||
@@ -30,6 +31,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Can this actor be revealed through shroud generated by the GeneratesShroud trait?")]
|
||||
public readonly bool RevealGeneratedShroud = true;
|
||||
|
||||
[Desc("DeathTypes for which shroud will be revealed.",
|
||||
"Use an empty list (the default) to allow all DeathTypes.")]
|
||||
public readonly HashSet<string> DeathTypes = new HashSet<string>();
|
||||
|
||||
public override object Create(ActorInitializer init) { return new RevealOnDeath(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -51,6 +56,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!self.IsInWorld)
|
||||
return;
|
||||
|
||||
if (info.DeathTypes.Count > 0 && !attack.Damage.DamageTypes.Overlaps(info.DeathTypes))
|
||||
return;
|
||||
|
||||
var owner = self.Owner;
|
||||
if (owner != null && owner.WinState == WinState.Undefined)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user