Add Required slot checking in lobby logic. Set up needed player slots as Required for missions

This commit is contained in:
Scott_NZ
2013-04-19 00:16:13 +12:00
parent 1db4cb1867
commit 493811c0d0
11 changed files with 12 additions and 2 deletions

View File

@@ -94,7 +94,7 @@ namespace OpenRA.Mods.RA.Server
if (server.lobbyInfo.Slots.Any(sl => sl.Value.Required && if (server.lobbyInfo.Slots.Any(sl => sl.Value.Required &&
server.lobbyInfo.ClientInSlot(sl.Key) == null)) server.lobbyInfo.ClientInSlot(sl.Key) == null))
{ {
server.SendChat(conn, "Unable to start the game until required slots are full."); server.SendChatTo(conn, "Unable to start the game until required slots are full.");
return true; return true;
} }
server.StartGame(); server.StartGame();

View File

@@ -258,7 +258,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var startGameButton = lobby.Get<ButtonWidget>("START_GAME_BUTTON"); var startGameButton = lobby.Get<ButtonWidget>("START_GAME_BUTTON");
startGameButton.IsVisible = () => Game.IsHost; startGameButton.IsVisible = () => Game.IsHost;
startGameButton.IsDisabled = () => gameStarting; startGameButton.IsDisabled = () => gameStarting
|| orderManager.LobbyInfo.Slots.Any(sl => sl.Value.Required && orderManager.LobbyInfo.ClientInSlot(sl.Key) == null);
startGameButton.OnClick = () => startGameButton.OnClick = () =>
{ {
gameStarting = true; gameStarting = true;

View File

@@ -42,6 +42,7 @@ Players:
InitialCash: 20 InitialCash: 20
Allies: GoodGuy Allies: GoodGuy
Enemies: BadGuy,Creeps Enemies: BadGuy,Creeps
Required: True
PlayerReference@Neutral: PlayerReference@Neutral:
Name: Neutral Name: Neutral
OwnsWorld: True OwnsWorld: True

View File

@@ -45,6 +45,7 @@ Players:
LockSpawn: True LockSpawn: True
LockTeam: True LockTeam: True
Enemies: GDI,Neutral Enemies: GDI,Neutral
Required: True
Actors: Actors:
Actor0: rock2 Actor0: rock2

View File

@@ -41,6 +41,7 @@ Players:
LockSpawn: True LockSpawn: True
LockTeam: True LockTeam: True
Enemies: Soviets Enemies: Soviets
Required: True
PlayerReference@Soviets: PlayerReference@Soviets:
Name: Soviets Name: Soviets
Race: soviet Race: soviet

View File

@@ -44,6 +44,7 @@ Players:
LockTeam: True LockTeam: True
Allies: Creeps Allies: Creeps
Enemies: Soviets Enemies: Soviets
Required: True
PlayerReference@Soviets: PlayerReference@Soviets:
Name: Soviets Name: Soviets
Race: soviet Race: soviet

View File

@@ -38,6 +38,7 @@ Players:
LockTeam: True LockTeam: True
Allies: Allies2,Allies Allies: Allies2,Allies
Enemies: Soviets Enemies: Soviets
Required: True
PlayerReference@Allies2: PlayerReference@Allies2:
Name: Allies2 Name: Allies2
Playable: True Playable: True

View File

@@ -40,6 +40,7 @@ Players:
LockTeam: True LockTeam: True
Allies: Allies2,Allies Allies: Allies2,Allies
Enemies: Soviets Enemies: Soviets
Required: True
PlayerReference@Allies2: PlayerReference@Allies2:
Name: Allies2 Name: Allies2
Playable: True Playable: True

View File

@@ -45,6 +45,7 @@ Players:
LockTeam: True LockTeam: True
Allies: Allies2,Allies Allies: Allies2,Allies
Enemies: Soviets Enemies: Soviets
Required: True
PlayerReference@Allies2: PlayerReference@Allies2:
Name: Allies2 Name: Allies2
Playable: True Playable: True

View File

@@ -32,6 +32,7 @@ Players:
LockSpawn: True LockSpawn: True
LockTeam: True LockTeam: True
Enemies: BadGuy,USSR,Ukraine,Turkey Enemies: BadGuy,USSR,Ukraine,Turkey
Required: True
PlayerReference@BadGuy: PlayerReference@BadGuy:
Name: BadGuy Name: BadGuy
Race: soviet Race: soviet

View File

@@ -50,6 +50,7 @@ Players:
LockSpawn: True LockSpawn: True
LockTeam: True LockTeam: True
Enemies: GoodGuy,France,Germany,Turkey Enemies: GoodGuy,France,Germany,Turkey
Required: True
PlayerReference@Turkey: PlayerReference@Turkey:
Name: Turkey Name: Turkey
Race: allies Race: allies