Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for RA2 Mod: cloning vats #17434

Merged
merged 1 commit into from
Dec 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions OpenRA.Mods.Cnc/Traits/Buildings/ClonesProducedUnits.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ public class ClonesProducedUnitsInfo : ConditionalTraitInfo, Requires<Production
[Desc("Uses the \"Cloneable\" trait to determine whether or not we should clone a produced unit.")]
public readonly BitSet<CloneableType> CloneableTypes = default(BitSet<CloneableType>);

[FieldLoader.Require]
[Desc("e.g. Infantry, Vehicles, Aircraft, Buildings")]
public readonly string ProductionType = "";

public override object Create(ActorInitializer init) { return new ClonesProducedUnits(init, this); }
}

Expand Down Expand Up @@ -55,7 +59,7 @@ public void UnitProducedByOther(Actor self, Actor producer, Actor produced, stri
// Stop as soon as one production trait successfully produced
foreach (var p in productionTraits)
{
if (!string.IsNullOrEmpty(productionType) && !p.Info.Produces.Contains(productionType))
if (!string.IsNullOrEmpty(Info.ProductionType) && !p.Info.Produces.Contains(Info.ProductionType))
continue;

var inits = new TypeDictionary
Expand All @@ -64,7 +68,7 @@ public void UnitProducedByOther(Actor self, Actor producer, Actor produced, stri
factionInit ?? new FactionInit(BuildableInfo.GetInitialFaction(produced.Info, p.Faction))
};

if (p.Produce(self, produced.Info, productionType, inits))
if (p.Produce(self, produced.Info, Info.ProductionType, inits))
return;
}
}
Expand Down