Option to choose which submarine to use as the respawn shuttle, submarines can be given "tags" (atm just shuttle and HideInMenu), separate saving window in sub editor

This commit is contained in:
Regalis
2016-08-05 14:06:05 +03:00
parent 581a7d5d9f
commit d55926a352
8 changed files with 363 additions and 75 deletions

View File

@@ -905,6 +905,7 @@ namespace Barotrauma.Networking
public bool StartGameClicked(GUIButton button, object obj)
{
Submarine selectedSub = null;
Submarine selectedShuttle = GameMain.NetLobbyScreen.SelectedShuttle;
if (Voting.AllowSubVoting)
{
@@ -922,6 +923,12 @@ namespace Barotrauma.Networking
return false;
}
if (selectedShuttle == null)
{
GameMain.NetLobbyScreen.ShuttleList.Flash();
return false;
}
GameModePreset selectedMode = Voting.HighestVoted<GameModePreset>(VoteType.Mode, connectedClients);
if (selectedMode == null) selectedMode = GameMain.NetLobbyScreen.SelectedMode;
@@ -931,12 +938,12 @@ namespace Barotrauma.Networking
return false;
}
CoroutineManager.StartCoroutine(WaitForPlayersReady(selectedSub, selectedMode), "WaitForPlayersReady");
CoroutineManager.StartCoroutine(WaitForPlayersReady(selectedSub, selectedShuttle, selectedMode), "WaitForPlayersReady");
return true;
}
private IEnumerable<object> WaitForPlayersReady(Submarine selectedSub, GameModePreset selectedMode)
private IEnumerable<object> WaitForPlayersReady(Submarine selectedSub, Submarine selectedShuttle, GameModePreset selectedMode)
{
GameMain.NetLobbyScreen.StartButton.Enabled = false;
@@ -945,6 +952,9 @@ namespace Barotrauma.Networking
msg.Write(selectedSub.Name);
msg.Write(selectedSub.MD5Hash.Hash);
msg.Write(selectedShuttle.Name);
msg.Write(selectedShuttle.MD5Hash.Hash);
SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
connectedClients.ForEach(c => c.ReadyToStart = false);
@@ -974,12 +984,12 @@ namespace Barotrauma.Networking
}
}
GameMain.ShowLoading(StartGame(selectedSub, selectedMode), false);
GameMain.ShowLoading(StartGame(selectedSub, selectedShuttle, selectedMode), false);
yield return CoroutineStatus.Success;
}
private IEnumerable<object> StartGame(Submarine selectedSub, GameModePreset selectedMode)
private IEnumerable<object> StartGame(Submarine selectedSub, Submarine selectedShuttle, GameModePreset selectedMode)
{
Item.Spawner.Clear();
Item.Remover.Clear();
@@ -1001,7 +1011,7 @@ namespace Barotrauma.Networking
GameServer.Log("Game mode: " + selectedMode.Name, Color.Cyan);
GameServer.Log("Level seed: " + GameMain.NetLobbyScreen.LevelSeed, Color.Cyan);
if (AllowRespawn) respawnManager = new RespawnManager(this);
if (AllowRespawn) respawnManager = new RespawnManager(this, selectedShuttle);
yield return CoroutineStatus.Running;
@@ -1105,6 +1115,9 @@ namespace Barotrauma.Networking
msg.Write(selectedSub.Name);
msg.Write(selectedSub.MD5Hash.Hash);
msg.Write(GameMain.NetLobbyScreen.SelectedShuttle.Name);
msg.Write(GameMain.NetLobbyScreen.SelectedShuttle.MD5Hash.Hash);
msg.Write(selectedMode.Name);
msg.Write(AllowRespawn);