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);
|
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),
|
var mine = w.CreateActor(minelayer.Info.Mine, new TypeDictionary
|
||||||
new OwnerInit(self.Owner),
|
{
|
||||||
}));
|
new LocationInit(self.Location),
|
||||||
|
new OwnerInit(self.Owner),
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (var t in self.TraitsImplementing<INotifyMineLaying>())
|
||||||
|
t.MineLaid(self, mine);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,6 +158,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public interface INotifyOtherProduction { void UnitProducedByOther(Actor self, Actor producer, Actor produced, string productionType, TypeDictionary init); }
|
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); }
|
||||||
|
|
||||||
|
[RequireExplicitImplementation]
|
||||||
|
public interface INotifyMineLaying { void MineLaying(Actor self, CPos location); void MineLaid(Actor self, Actor mine); }
|
||||||
|
|
||||||
[RequireExplicitImplementation]
|
[RequireExplicitImplementation]
|
||||||
public interface INotifyDockHost { void Docked(Actor self, Actor client); void Undocked(Actor self, Actor client); }
|
public interface INotifyDockHost { void Docked(Actor self, Actor client); void Undocked(Actor self, Actor client); }
|
||||||
[RequireExplicitImplementation]
|
[RequireExplicitImplementation]
|
||||||
|
|||||||
Reference in New Issue
Block a user