Mission refactoring (mission prefabs) and option to select which types of missions can be selected when mission type is set to random (TODO: a way to set the allowed types from the UI).
This commit is contained in:
@@ -993,7 +993,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
outmsg.WriteRangedInteger(0, 2, (int)TraitorsEnabled);
|
||||
|
||||
outmsg.WriteRangedInteger(0, Mission.MissionTypes.Count - 1, (GameMain.NetLobbyScreen.MissionTypeIndex));
|
||||
outmsg.WriteRangedInteger(0, MissionPrefab.MissionTypes.Count - 1, (GameMain.NetLobbyScreen.MissionTypeIndex));
|
||||
|
||||
outmsg.Write((byte)GameMain.NetLobbyScreen.SelectedModeIndex);
|
||||
outmsg.Write(GameMain.NetLobbyScreen.LevelSeed);
|
||||
@@ -1213,7 +1213,7 @@ namespace Barotrauma.Networking
|
||||
//don't instantiate a new gamesession if we're playing a campaign
|
||||
if (campaign == null || GameMain.GameSession == null)
|
||||
{
|
||||
GameMain.GameSession = new GameSession(selectedSub, "", selectedMode, Mission.MissionTypes[GameMain.NetLobbyScreen.MissionTypeIndex]);
|
||||
GameMain.GameSession = new GameSession(selectedSub, "", selectedMode, MissionPrefab.MissionTypes[GameMain.NetLobbyScreen.MissionTypeIndex]);
|
||||
}
|
||||
|
||||
if (GameMain.GameSession.GameMode.Mission != null &&
|
||||
@@ -1402,6 +1402,8 @@ namespace Barotrauma.Networking
|
||||
msg.Write(GameMain.NetLobbyScreen.SelectedShuttle.MD5Hash.Hash);
|
||||
|
||||
msg.Write(selectedMode.Name);
|
||||
msg.Write((short)(GameMain.GameSession.GameMode?.Mission == null ?
|
||||
-1 : MissionPrefab.List.IndexOf(GameMain.GameSession.GameMode.Mission.Prefab)));
|
||||
|
||||
MultiPlayerCampaign campaign = GameMain.GameSession?.GameMode as MultiPlayerCampaign;
|
||||
|
||||
|
||||
@@ -254,6 +254,12 @@ namespace Barotrauma.Networking
|
||||
set;
|
||||
}
|
||||
|
||||
public List<string> AllowedRandomMissionTypes
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize(60f, true)]
|
||||
public float AutoBanTime
|
||||
{
|
||||
@@ -287,6 +293,8 @@ namespace Barotrauma.Networking
|
||||
|
||||
doc.Root.SetAttributeValue("TraitorsEnabled", TraitorsEnabled.ToString());
|
||||
|
||||
doc.Root.SetAttributeValue("AllowedRandomMissionTypes", string.Join(",", AllowedRandomMissionTypes));
|
||||
|
||||
#if SERVER
|
||||
doc.Root.SetAttributeValue("password", password);
|
||||
#endif
|
||||
@@ -334,18 +342,22 @@ namespace Barotrauma.Networking
|
||||
#endif
|
||||
|
||||
subSelectionMode = SelectionMode.Manual;
|
||||
Enum.TryParse<SelectionMode>(doc.Root.GetAttributeString("SubSelection", "Manual"), out subSelectionMode);
|
||||
Enum.TryParse(doc.Root.GetAttributeString("SubSelection", "Manual"), out subSelectionMode);
|
||||
Voting.AllowSubVoting = subSelectionMode == SelectionMode.Vote;
|
||||
|
||||
modeSelectionMode = SelectionMode.Manual;
|
||||
Enum.TryParse<SelectionMode>(doc.Root.GetAttributeString("ModeSelection", "Manual"), out modeSelectionMode);
|
||||
Enum.TryParse(doc.Root.GetAttributeString("ModeSelection", "Manual"), out modeSelectionMode);
|
||||
Voting.AllowModeVoting = modeSelectionMode == SelectionMode.Vote;
|
||||
|
||||
var traitorsEnabled = TraitorsEnabled;
|
||||
Enum.TryParse<YesNoMaybe>(doc.Root.GetAttributeString("TraitorsEnabled", "No"), out traitorsEnabled);
|
||||
Enum.TryParse(doc.Root.GetAttributeString("TraitorsEnabled", "No"), out traitorsEnabled);
|
||||
TraitorsEnabled = traitorsEnabled;
|
||||
GameMain.NetLobbyScreen.SetTraitorsEnabled(traitorsEnabled);
|
||||
|
||||
AllowedRandomMissionTypes = doc.Root.GetAttributeStringArray(
|
||||
"AllowedRandomMissionTypes",
|
||||
MissionPrefab.MissionTypes.ToArray()).ToList();
|
||||
|
||||
if (GameMain.NetLobbyScreen != null
|
||||
#if CLIENT
|
||||
&& GameMain.NetLobbyScreen.ServerMessage != null
|
||||
|
||||
Reference in New Issue
Block a user