Add the possibility to deny spawning actors for dead players

This commit is contained in:
abcdefg30
2017-05-11 14:15:16 +02:00
committed by reaperrr
parent e42e766bb6
commit bd52e56aaf

View File

@@ -50,6 +50,9 @@ namespace OpenRA.Mods.Common.Traits
"lead to unexpected behaviour.")] "lead to unexpected behaviour.")]
public readonly CVec Offset = CVec.Zero; public readonly CVec Offset = CVec.Zero;
[Desc("Should an actor spawn after the player has been defeated (e.g. after surrendering)?")]
public readonly bool SpawnAfterDefeat = true;
public override object Create(ActorInitializer init) { return new SpawnActorOnDeath(init, this); } public override object Create(ActorInitializer init) { return new SpawnActorOnDeath(init, this); }
} }
@@ -87,7 +90,7 @@ namespace OpenRA.Mods.Common.Traits
// Don't add the new actor to the world before all RemovedFromWorld callbacks have run // Don't add the new actor to the world before all RemovedFromWorld callbacks have run
void INotifyRemovedFromWorld.RemovedFromWorld(Actor self) void INotifyRemovedFromWorld.RemovedFromWorld(Actor self)
{ {
if (attackingPlayer == null) if (attackingPlayer == null || (!info.SpawnAfterDefeat && self.Owner.WinState != WinState.Undefined))
return; return;
var td = new TypeDictionary var td = new TypeDictionary