Crate actions can now define required prerequisites.
This commit is contained in:
@@ -31,6 +31,9 @@ namespace OpenRA.Mods.RA
|
|||||||
[Desc("The earliest time (in ticks) that this crate action can occur on.")]
|
[Desc("The earliest time (in ticks) that this crate action can occur on.")]
|
||||||
public readonly int TimeDelay = 0;
|
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.")]
|
[Desc("Actor types that this crate action will not occur for.")]
|
||||||
[ActorReference] public string[] ExcludedActorTypes = { };
|
[ActorReference] public string[] ExcludedActorTypes = { };
|
||||||
|
|
||||||
@@ -56,6 +59,9 @@ namespace OpenRA.Mods.RA
|
|||||||
if (info.ExcludedActorTypes.Contains(collector.Info.Name))
|
if (info.ExcludedActorTypes.Contains(collector.Info.Name))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (info.Prerequisites.Any() && !collector.Owner.PlayerActor.Trait<TechTree>().HasPrerequisites(info.Prerequisites))
|
||||||
|
return 0;
|
||||||
|
|
||||||
return GetSelectionShares(collector);
|
return GetSelectionShares(collector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user