Merge pull request #6189 from UberWaffe/6066_CratePrerequisites
6066 Crate Prerequisites
This commit is contained in:
@@ -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<TechTree>().HasPrerequisites(info.Prerequisites))
|
||||
return 0;
|
||||
|
||||
return GetSelectionShares(collector);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,12 @@ namespace OpenRA.Mods.RA.Crates
|
||||
readonly List<CPos> usedCells = new List<CPos>();
|
||||
|
||||
public GiveUnitCrateAction(Actor self, GiveUnitCrateActionInfo info)
|
||||
: base(self, info) { Info = info; }
|
||||
: base(self, info)
|
||||
{
|
||||
Info = info;
|
||||
if (!Info.Units.Any())
|
||||
throw new YamlException("A GiveUnitCrateAction does not specify any units to give. This might be because the yaml is referring to 'Unit' rather than 'Units'.");
|
||||
}
|
||||
|
||||
public bool CanGiveTo(Actor collector)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user