Prepare short game code for trait-defined lobby options.
This commit is contained in:
@@ -18,7 +18,8 @@ namespace OpenRA.Mods.Common
|
|||||||
{
|
{
|
||||||
public static bool HasNoRequiredUnits(this Player player)
|
public static bool HasNoRequiredUnits(this Player player)
|
||||||
{
|
{
|
||||||
if (player.World.LobbyInfo.GlobalSettings.ShortGame)
|
var mapOptions = player.World.WorldActor.Trait<MapOptions>();
|
||||||
|
if (mapOptions.ShortGame)
|
||||||
return !player.World.ActorsHavingTrait<MustBeDestroyed>(t => t.Info.RequiredForShortGame).Any(a => a.Owner == player);
|
return !player.World.ActorsHavingTrait<MustBeDestroyed>(t => t.Info.RequiredForShortGame).Any(a => a.Owner == player);
|
||||||
return !player.World.ActorsHavingTrait<MustBeDestroyed>().Any(a => a.Owner == player && a.IsInWorld);
|
return !player.World.ActorsHavingTrait<MustBeDestroyed>().Any(a => a.Owner == player && a.IsInWorld);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,5 +39,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public readonly bool DifficultyLocked = false;
|
public readonly bool DifficultyLocked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MapOptions { }
|
public class MapOptions : INotifyCreated
|
||||||
|
{
|
||||||
|
public bool ShortGame { get; private set; }
|
||||||
|
|
||||||
|
void INotifyCreated.Created(Actor self)
|
||||||
|
{
|
||||||
|
ShortGame = self.World.LobbyInfo.GlobalSettings.ShortGame;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user