Combat missions don't reset the "allow respawn" setting

This commit is contained in:
Regalis
2016-11-06 15:57:28 +02:00
parent a32198ff80
commit fa6bf60032
3 changed files with 21 additions and 12 deletions
@@ -19,6 +19,11 @@ namespace Barotrauma
private static string[] teamNames; private static string[] teamNames;
public override bool AllowRespawn
{
get { return false; }
}
public override string Description public override string Description
{ {
get get
@@ -126,11 +131,6 @@ namespace Barotrauma
public override void Start(Level level) public override void Start(Level level)
{ {
if (GameMain.Server != null)
{
GameMain.Server.AllowRespawn = false;
}
if (GameMain.NetworkMember == null) if (GameMain.NetworkMember == null)
{ {
DebugConsole.ThrowError("Combat missions cannot be played in the single player mode."); DebugConsole.ThrowError("Combat missions cannot be played in the single player mode.");
@@ -154,11 +154,6 @@ namespace Barotrauma
{ {
if (crews[0].Count == 0 && crews[1].Count == 0) if (crews[0].Count == 0 && crews[1].Count == 0)
{ {
if (GameMain.Server != null)
{
GameMain.Server.AllowRespawn = false;
}
foreach (Character character in Character.CharacterList) foreach (Character character in Character.CharacterList)
{ {
if (character.TeamID == 1) if (character.TeamID == 1)
@@ -48,6 +48,11 @@ namespace Barotrauma
set { completed = value; } set { completed = value; }
} }
public virtual bool AllowRespawn
{
get { return true; }
}
public virtual string RadarLabel public virtual string RadarLabel
{ {
get { return radarLabel; } get { return radarLabel; }
+11 -2
View File
@@ -923,7 +923,11 @@ namespace Barotrauma.Networking
GameServer.Log("Game mode: " + selectedMode.Name, Color.Cyan); GameServer.Log("Game mode: " + selectedMode.Name, Color.Cyan);
GameServer.Log("Level seed: " + GameMain.NetLobbyScreen.LevelSeed, Color.Cyan); GameServer.Log("Level seed: " + GameMain.NetLobbyScreen.LevelSeed, Color.Cyan);
if (AllowRespawn) respawnManager = new RespawnManager(this, selectedShuttle); bool missionAllowRespawn =
!(GameMain.GameSession.gameMode is MissionMode) ||
((MissionMode)GameMain.GameSession.gameMode).Mission.AllowRespawn;
if (AllowRespawn && missionAllowRespawn) respawnManager = new RespawnManager(this, selectedShuttle);
for (int teamID = 1; teamID <= teamCount; teamID++) for (int teamID = 1; teamID <= teamCount; teamID++)
{ {
@@ -1072,7 +1076,12 @@ namespace Barotrauma.Networking
msg.Write(selectedMode.Name); msg.Write(selectedMode.Name);
msg.Write(AllowRespawn);
bool missionAllowRespawn =
!(GameMain.GameSession.gameMode is MissionMode) ||
((MissionMode)GameMain.GameSession.gameMode).Mission.AllowRespawn;
msg.Write(AllowRespawn && missionAllowRespawn);
msg.Write(Submarine.MainSubs[1] != null); //loadSecondSub msg.Write(Submarine.MainSubs[1] != null); //loadSecondSub
//msg.Write(GameMain.NetLobbyScreen.GameDuration.TotalMinutes); //msg.Write(GameMain.NetLobbyScreen.GameDuration.TotalMinutes);