Added extensibility points to LayMines activity:
Provides two callbacks using INotifyMineLaying interface: MineLaying (just before laying a mine), MineLaid after mine actor has been created (in FrameEndTask)
This commit is contained in:
@@ -147,11 +147,20 @@ namespace OpenRA.Mods.Common.Activities
|
||||
pool.TakeAmmo(self, minelayer.Info.AmmoUsage);
|
||||
}
|
||||
|
||||
self.World.AddFrameEndTask(w => w.CreateActor(minelayer.Info.Mine, new TypeDictionary
|
||||
foreach (var t in self.TraitsImplementing<INotifyMineLaying>())
|
||||
t.MineLaying(self, self.Location);
|
||||
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
new LocationInit(self.Location),
|
||||
new OwnerInit(self.Owner),
|
||||
}));
|
||||
var mine = w.CreateActor(minelayer.Info.Mine, new TypeDictionary
|
||||
{
|
||||
new LocationInit(self.Location),
|
||||
new OwnerInit(self.Owner),
|
||||
});
|
||||
|
||||
foreach (var t in self.TraitsImplementing<INotifyMineLaying>())
|
||||
t.MineLaid(self, mine);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user