Pass the original init dict to UnitProducedByOther.

This commit is contained in:
Paul Chote
2018-10-28 18:22:17 +00:00
committed by abcdefg30
parent 5e5183549c
commit ea3731a7cc
7 changed files with 8 additions and 7 deletions

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Cnc.Traits
faction = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : init.Self.Owner.Faction.InternalName; faction = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : init.Self.Owner.Faction.InternalName;
} }
public void UnitProducedByOther(Actor self, Actor producer, Actor produced, string productionType) public void UnitProducedByOther(Actor self, Actor producer, Actor produced, string productionType, TypeDictionary init)
{ {
// No recursive cloning! // No recursive cloning!
if (producer.Owner != self.Owner || producer.Info.HasTraitInfo<ClonesProducedUnitsInfo>()) if (producer.Owner != self.Owner || producer.Info.HasTraitInfo<ClonesProducedUnitsInfo>())

View File

@@ -405,7 +405,7 @@ namespace OpenRA.Mods.Common.Scripting
} }
} }
public void UnitProducedByOther(Actor self, Actor producee, Actor produced, string productionType) public void UnitProducedByOther(Actor self, Actor producee, Actor produced, string productionType, TypeDictionary init)
{ {
if (world.Disposing) if (world.Disposing)
return; return;

View File

@@ -11,6 +11,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.Primitives;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
@@ -120,7 +121,7 @@ namespace OpenRA.Mods.Common.Traits
tokens[a] = external.GrantCondition(a, self); tokens[a] = external.GrantCondition(a, self);
} }
public void UnitProducedByOther(Actor self, Actor producer, Actor produced, string productionType) public void UnitProducedByOther(Actor self, Actor producer, Actor produced, string productionType, TypeDictionary init)
{ {
// If the produced Actor doesn't occupy space, it can't be in range // If the produced Actor doesn't occupy space, it can't be in range
if (produced.OccupiesSpace == null) if (produced.OccupiesSpace == null)

View File

@@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Traits
var notifyOthers = self.World.ActorsWithTrait<INotifyOtherProduction>(); var notifyOthers = self.World.ActorsWithTrait<INotifyOtherProduction>();
foreach (var notify in notifyOthers) foreach (var notify in notifyOthers)
notify.Trait.UnitProducedByOther(notify.Actor, self, newUnit, productionType); notify.Trait.UnitProducedByOther(notify.Actor, self, newUnit, productionType, td);
}); });
} }

View File

@@ -101,7 +101,7 @@ namespace OpenRA.Mods.Common.Traits
var notifyOthers = self.World.ActorsWithTrait<INotifyOtherProduction>(); var notifyOthers = self.World.ActorsWithTrait<INotifyOtherProduction>();
foreach (var notify in notifyOthers) foreach (var notify in notifyOthers)
notify.Trait.UnitProducedByOther(notify.Actor, self, newUnit, productionType); notify.Trait.UnitProducedByOther(notify.Actor, self, newUnit, productionType, td);
}); });
return true; return true;

View File

@@ -157,7 +157,7 @@ namespace OpenRA.Mods.Common.Traits
var notifyOthers = self.World.ActorsWithTrait<INotifyOtherProduction>(); var notifyOthers = self.World.ActorsWithTrait<INotifyOtherProduction>();
foreach (var notify in notifyOthers) foreach (var notify in notifyOthers)
notify.Trait.UnitProducedByOther(notify.Actor, self, newUnit, productionType); notify.Trait.UnitProducedByOther(notify.Actor, self, newUnit, productionType, td);
}); });
} }
} }

View File

@@ -131,7 +131,7 @@ namespace OpenRA.Mods.Common.Traits
public interface INotifyBurstComplete { void FiredBurst(Actor self, Target target, Armament a); } public interface INotifyBurstComplete { void FiredBurst(Actor self, Target target, Armament a); }
public interface INotifyChat { bool OnChat(string from, string message); } public interface INotifyChat { bool OnChat(string from, string message); }
public interface INotifyProduction { void UnitProduced(Actor self, Actor other, CPos exit); } public interface INotifyProduction { void UnitProduced(Actor self, Actor other, CPos exit); }
public interface INotifyOtherProduction { void UnitProducedByOther(Actor self, Actor producer, Actor produced, string productionType); } public interface INotifyOtherProduction { void UnitProducedByOther(Actor self, Actor producer, Actor produced, string productionType, TypeDictionary init); }
public interface INotifyDelivery { void IncomingDelivery(Actor self); void Delivered(Actor self); } public interface INotifyDelivery { void IncomingDelivery(Actor self); void Delivered(Actor self); }
public interface INotifyDocking { void Docked(Actor self, Actor harvester); void Undocked(Actor self, Actor harvester); } public interface INotifyDocking { void Docked(Actor self, Actor harvester); void Undocked(Actor self, Actor harvester); }
public interface INotifyParachute { void OnParachute(Actor self); void OnLanded(Actor self, Actor ignore); } public interface INotifyParachute { void OnParachute(Actor self); void OnLanded(Actor self, Actor ignore); }