Added support for filtering exits by production type.
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Primitives;
|
||||
@@ -44,16 +43,15 @@ namespace OpenRA.Mods.Common.Traits
|
||||
rp = Exts.Lazy(() => init.Self.IsDead ? null : init.Self.TraitOrDefault<RallyPoint>());
|
||||
}
|
||||
|
||||
public override bool Produce(Actor self, ActorInfo producee, TypeDictionary inits)
|
||||
public override bool Produce(Actor self, ActorInfo producee, string productionType, TypeDictionary inits)
|
||||
{
|
||||
var owner = self.Owner;
|
||||
|
||||
// Assume a single exit point for simplicity
|
||||
var exit = self.Info.TraitInfos<ExitInfo>().First();
|
||||
var exit = SelectExit(self, producee, productionType);
|
||||
|
||||
// Start a fixed distance away: the width of the map.
|
||||
// This makes the production timing independent of spawnpoint
|
||||
var dropPos = self.Location + exit.ExitCell;
|
||||
var dropPos = exit != null ? self.Location + exit.ExitCell : self.Location;
|
||||
var startPos = dropPos + new CVec(owner.World.Map.Bounds.Width, 0);
|
||||
var endPos = new CPos(owner.World.Map.Bounds.Left - 5, dropPos.Y);
|
||||
|
||||
@@ -85,7 +83,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
foreach (var cargo in self.TraitsImplementing<INotifyDelivery>())
|
||||
cargo.Delivered(self);
|
||||
|
||||
self.World.AddFrameEndTask(ww => DoProduction(self, producee, exit, inits));
|
||||
self.World.AddFrameEndTask(ww => DoProduction(self, producee, exit, productionType, inits));
|
||||
Game.Sound.Play(SoundType.World, info.ChuteSound, self.CenterPosition);
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.ReadyAudio, self.Owner.Faction.InternalName);
|
||||
}));
|
||||
@@ -97,7 +95,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void DoProduction(Actor self, ActorInfo producee, ExitInfo exitinfo, TypeDictionary inits)
|
||||
public override void DoProduction(Actor self, ActorInfo producee, ExitInfo exitinfo, string productionType, TypeDictionary inits)
|
||||
{
|
||||
var exit = CPos.Zero;
|
||||
var exitLocation = CPos.Zero;
|
||||
@@ -155,7 +153,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
var notifyOthers = self.World.ActorsWithTrait<INotifyOtherProduction>();
|
||||
foreach (var notify in notifyOthers)
|
||||
notify.Trait.UnitProducedByOther(notify.Actor, self, newUnit);
|
||||
notify.Trait.UnitProducedByOther(notify.Actor, self, newUnit, productionType);
|
||||
|
||||
foreach (var t in newUnit.TraitsImplementing<INotifyBuildComplete>())
|
||||
t.BuildingComplete(newUnit);
|
||||
|
||||
Reference in New Issue
Block a user