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:
michaeldgg2
2023-06-24 14:23:00 +02:00
committed by abcdefg30
parent 22b39f35aa
commit dccb3ce9ce
2 changed files with 16 additions and 4 deletions

View File

@@ -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);
});
}
}
}