Added OwnerLostAction

Allows customisation of what will happen to an actor when its owner
loses.
This commit is contained in:
Mustafa Alperen Seki
2018-03-23 11:49:20 +03:00
committed by Paul Chote
parent 0d23070c8e
commit 367a7f617c
7 changed files with 106 additions and 5 deletions

View File

@@ -70,8 +70,8 @@ namespace OpenRA.Mods.Common.Traits
public void OnPlayerLost(Player player)
{
foreach (var a in player.World.Actors.Where(a => a.Owner == player))
a.Kill(a);
foreach (var a in player.World.ActorsWithTrait<INotifyOwnerLost>().Where(a => a.Actor.Owner == player))
a.Trait.OnOwnerLost(a.Actor);
if (info.SuppressNotifications)
return;