From 8e1dce4bbef221a557269a2774cfb8f8b82cbbdd Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Wed, 29 Jun 2022 20:59:10 +0200 Subject: [PATCH] Add a lint check for maps without playable player --- OpenRA.Mods.Common/Lint/CheckPlayers.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OpenRA.Mods.Common/Lint/CheckPlayers.cs b/OpenRA.Mods.Common/Lint/CheckPlayers.cs index fddc550eef..b2e8e39e3d 100644 --- a/OpenRA.Mods.Common/Lint/CheckPlayers.cs +++ b/OpenRA.Mods.Common/Lint/CheckPlayers.cs @@ -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.");