From 0ff93328440864cd25eec67a54f60acfb293d044 Mon Sep 17 00:00:00 2001 From: UberWaffe Date: Wed, 6 Aug 2014 09:20:05 +0200 Subject: [PATCH] Crate actions can now define required prerequisites. --- OpenRA.Mods.RA/CrateAction.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.RA/CrateAction.cs b/OpenRA.Mods.RA/CrateAction.cs index 997220719e..d0a478b791 100644 --- a/OpenRA.Mods.RA/CrateAction.cs +++ b/OpenRA.Mods.RA/CrateAction.cs @@ -30,6 +30,9 @@ namespace OpenRA.Mods.RA [Desc("The earliest time (in ticks) that this crate action can occur on.")] public readonly int TimeDelay = 0; + + [Desc("Only allow this crate action when the collector has these prerequisites")] + public readonly string[] Prerequisites = { }; [Desc("Actor types that this crate action will not occur for.")] [ActorReference] public string[] ExcludedActorTypes = { }; @@ -52,10 +55,13 @@ namespace OpenRA.Mods.RA { if (self.World.WorldTick < info.TimeDelay) return 0; - + if (info.ExcludedActorTypes.Contains(collector.Info.Name)) return 0; + if (info.Prerequisites.Any() && !collector.Owner.PlayerActor.Trait().HasPrerequisites(info.Prerequisites)) + return 0; + return GetSelectionShares(collector); }