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:
@@ -286,7 +286,8 @@ namespace Barotrauma.Networking
|
||||
|
||||
submarines.Add(new Submarine(mySubPath, subHash, false));
|
||||
}
|
||||
GameMain.NetLobbyScreen.UpdateSubList(submarines);
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.SubList, Submarine.SavedSubmarines);
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.ShuttleList.ListBox, Submarine.SavedSubmarines);
|
||||
|
||||
//add the name of own client to the lobby screen
|
||||
GameMain.NetLobbyScreen.AddPlayer(name);
|
||||
@@ -367,7 +368,9 @@ namespace Barotrauma.Networking
|
||||
List<Submarine> subList = GameMain.NetLobbyScreen.GetSubList();
|
||||
|
||||
GameMain.NetLobbyScreen = new NetLobbyScreen();
|
||||
GameMain.NetLobbyScreen.UpdateSubList(subList);
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.SubList, subList);
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.ShuttleList.ListBox, subList);
|
||||
|
||||
GameMain.NetLobbyScreen.Select();
|
||||
}
|
||||
connected = true;
|
||||
@@ -486,7 +489,11 @@ namespace Barotrauma.Networking
|
||||
string subName = inc.ReadString();
|
||||
string subHash = inc.ReadString();
|
||||
|
||||
if (GameMain.NetLobbyScreen.TrySelectSub(subName,subHash))
|
||||
string shuttleName = inc.ReadString();
|
||||
string shuttleHash = inc.ReadString();
|
||||
|
||||
if (GameMain.NetLobbyScreen.TrySelectSub(subName,subHash,GameMain.NetLobbyScreen.SubList) &&
|
||||
GameMain.NetLobbyScreen.TrySelectSub(shuttleName, shuttleHash, GameMain.NetLobbyScreen.ShuttleList.ListBox))
|
||||
{
|
||||
NetOutgoingMessage readyToStartMsg = client.CreateMessage();
|
||||
readyToStartMsg.Write((byte)PacketTypes.StartGame);
|
||||
@@ -636,8 +643,11 @@ namespace Barotrauma.Networking
|
||||
|
||||
int missionTypeIndex = inc.ReadByte();
|
||||
|
||||
string mapName = inc.ReadString();
|
||||
string mapHash = inc.ReadString();
|
||||
string subName = inc.ReadString();
|
||||
string subHash = inc.ReadString();
|
||||
|
||||
string shuttleName = inc.ReadString();
|
||||
string shuttleHash = inc.ReadString();
|
||||
|
||||
string modeName = inc.ReadString();
|
||||
|
||||
@@ -651,11 +661,15 @@ namespace Barotrauma.Networking
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
|
||||
if (!GameMain.NetLobbyScreen.TrySelectSub(mapName, mapHash))
|
||||
if (!GameMain.NetLobbyScreen.TrySelectSub(subName, subHash, GameMain.NetLobbyScreen.SubList))
|
||||
{
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
|
||||
if (!GameMain.NetLobbyScreen.TrySelectSub(shuttleName, shuttleHash, GameMain.NetLobbyScreen.ShuttleList.ListBox))
|
||||
{
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
|
||||
Rand.SetSyncedSeed(seed);
|
||||
//int gameModeIndex = inc.ReadInt32();
|
||||
@@ -663,7 +677,7 @@ namespace Barotrauma.Networking
|
||||
GameMain.GameSession = new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, Mission.MissionTypes[missionTypeIndex]);
|
||||
GameMain.GameSession.StartShift(levelSeed);
|
||||
|
||||
if (respawnAllowed) respawnManager = new RespawnManager(this);
|
||||
if (respawnAllowed) respawnManager = new RespawnManager(this, GameMain.NetLobbyScreen.SelectedShuttle);
|
||||
|
||||
|
||||
//myCharacter = ReadCharacterData(inc);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -61,11 +61,11 @@ namespace Barotrauma.Networking
|
||||
|
||||
private float updateReturnTimer;
|
||||
|
||||
public RespawnManager(NetworkMember networkMember)
|
||||
public RespawnManager(NetworkMember networkMember, Submarine shuttle)
|
||||
{
|
||||
this.networkMember = networkMember;
|
||||
|
||||
respawnShuttle = new Submarine("Submarines/Shuttle Mark I.sub");
|
||||
respawnShuttle = shuttle;
|
||||
respawnShuttle.Load(false);
|
||||
|
||||
ResetShuttle();
|
||||
@@ -398,7 +398,9 @@ namespace Barotrauma.Networking
|
||||
msg.Write((byte)characterInfos.Count);
|
||||
for (int i = 0; i < characterInfos.Count; i++)
|
||||
{
|
||||
var character = Character.Create(characterInfos[i], waypoints[i].WorldPosition, true, false);
|
||||
bool myCharacter = i >= clients.Count;
|
||||
|
||||
var character = Character.Create(characterInfos[i], waypoints[i].WorldPosition, !myCharacter, false);
|
||||
|
||||
if (divingSuitPrefab != null && oxyPrefab != null)
|
||||
{
|
||||
@@ -416,17 +418,17 @@ namespace Barotrauma.Networking
|
||||
Item.Spawner.AddToSpawnedList(oxyTank);
|
||||
}
|
||||
|
||||
if (i < clients.Count)
|
||||
{
|
||||
msg.Write((byte)clients[i].ID);
|
||||
clients[i].Character = character;
|
||||
}
|
||||
else
|
||||
if (myCharacter)
|
||||
{
|
||||
msg.Write((byte)0);
|
||||
server.Character = character;
|
||||
Character.Controlled = character;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Write((byte)clients[i].ID);
|
||||
clients[i].Character = character;
|
||||
}
|
||||
|
||||
character.GiveJobItems(waypoints[i]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user