Fixed mutliplayer-only missions being taken into account in the eventprobability calculation even in single player mode, which missions are sp/mp-only is determined in the mission config files

This commit is contained in:
Regalis
2016-10-06 15:32:38 +03:00
parent 91539c5b84
commit 5e88d91cb8
6 changed files with 25 additions and 16 deletions
+9 -9
View File
@@ -148,8 +148,15 @@ namespace Barotrauma
matchingElements = doc.Root.Elements().ToList().FindAll(m => m.Name.ToString().ToLowerInvariant().Replace("mission", "") == missionType);
}
if (isSinglePlayer)
{
matchingElements.RemoveAll(m => ToolBox.GetAttributeBool(m, "multiplayeronly", false));
}
else
{
matchingElements.RemoveAll(m => ToolBox.GetAttributeBool(m, "singleplayeronly", false));
}
int i = 0;
foreach (XElement element in matchingElements)
{
@@ -185,8 +192,6 @@ namespace Barotrauma
continue;
}
if (isSinglePlayer && t.GetInterface("Barotrauma.SinglePlayerMission")==null) continue;
ConstructorInfo constructor = t.GetConstructor(new[] { typeof(XElement) });
object instance = constructor.Invoke(new object[] { element });
@@ -253,9 +258,4 @@ namespace Barotrauma
mode.Money += reward;
}
}
interface SinglePlayerMission
{
//all valid single player missions should inherit this
}
}