Add a lint check for maps without playable player
This commit is contained in:
@@ -43,6 +43,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (players.Players.Count > 64)
|
||||
emitError("Defining more than 64 players is not allowed.");
|
||||
|
||||
var playablePlayerFound = false;
|
||||
var worldOwnerFound = false;
|
||||
var playerNames = players.Players.Values.Select(p => p.Name).ToHashSet();
|
||||
foreach (var player in players.Players.Values)
|
||||
@@ -55,6 +56,9 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (!playerNames.Contains(enemy))
|
||||
emitError($"Enemies contains player {enemy} that is not in list.");
|
||||
|
||||
if (player.Playable)
|
||||
playablePlayerFound = true;
|
||||
|
||||
if (player.OwnsWorld)
|
||||
{
|
||||
worldOwnerFound = true;
|
||||
@@ -71,6 +75,9 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
if (!playablePlayerFound && visibility != MapVisibility.Shellmap)
|
||||
emitError("Found no playable player.");
|
||||
|
||||
if (!worldOwnerFound)
|
||||
emitError("Found no player owning the world.");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user