Fix shroud for observers observing a player after win/loss.
This commit is contained in:
@@ -19,13 +19,17 @@ namespace OpenRA.Mods.RA
|
||||
[Desc("Milliseconds")]
|
||||
public int NotificationDelay = 1500;
|
||||
|
||||
public object Create(ActorInitializer init) { return new ConquestVictoryConditions(this); }
|
||||
public object Create(ActorInitializer init) { return new ConquestVictoryConditions(init.world, this); }
|
||||
}
|
||||
|
||||
public class ConquestVictoryConditions : ITick, IResolveOrder
|
||||
{
|
||||
ConquestVictoryConditionsInfo Info;
|
||||
public ConquestVictoryConditions(ConquestVictoryConditionsInfo info) { Info = info; }
|
||||
public ConquestVictoryConditions(World world, ConquestVictoryConditionsInfo info)
|
||||
{
|
||||
world.ObserveAfterWinOrLose = true;
|
||||
Info = info;
|
||||
}
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
@@ -63,14 +67,11 @@ namespace OpenRA.Mods.RA
|
||||
a.Kill(a);
|
||||
|
||||
if (self.Owner == self.World.LocalPlayer)
|
||||
{
|
||||
self.World.RenderPlayer = null;
|
||||
Game.RunAfterDelay(Info.NotificationDelay, () =>
|
||||
{
|
||||
if (Game.IsCurrentWorld(self.World))
|
||||
Sound.PlayNotification(self.Owner, "Speech", "Lose", self.Owner.Country.Race);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void Win(Actor self)
|
||||
@@ -80,10 +81,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
Game.Debug("{0} is victorious.".F(self.Owner.PlayerName));
|
||||
if (self.Owner == self.World.LocalPlayer)
|
||||
{
|
||||
self.World.RenderPlayer = null;
|
||||
Game.RunAfterDelay(Info.NotificationDelay, () => Sound.PlayNotification(self.Owner, "Speech", "Win", self.Owner.Country.Race));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user