Sync monster spawn settings

This commit is contained in:
juanjp600
2017-04-06 16:50:11 -03:00
parent 4ad373294c
commit e1d5d63dbd
6 changed files with 47 additions and 8 deletions
+3 -3
View File
@@ -52,13 +52,13 @@ namespace Barotrauma
spawnDeep = ToolBox.GetAttributeBool(element, "spawndeep", false);
if (GameMain.Server != null)
if (GameMain.NetworkMember != null)
{
List<string> monsterNames = GameMain.Server.monsterEnabled.Keys.ToList();
List<string> monsterNames = GameMain.NetworkMember.monsterEnabled.Keys.ToList();
string tryKey = monsterNames.Find(s => characterFile.ToLower().Contains(s.ToLower()));
if (!string.IsNullOrWhiteSpace(tryKey))
{
if (!GameMain.Server.monsterEnabled[tryKey]) disallowed = true; //spawn was disallowed by host
if (!GameMain.NetworkMember.monsterEnabled[tryKey]) disallowed = true; //spawn was disallowed by host
}
}
}
+9 -1
View File
@@ -137,7 +137,15 @@ namespace Barotrauma
}
ConstructorInfo constructor = t.GetConstructor(new[] { typeof(XElement) });
object instance = constructor.Invoke(new object[] { element });
object instance = null;
try
{
instance = constructor.Invoke(new object[] { element });
}
catch (Exception ex)
{
DebugConsole.ThrowError(ex.InnerException!=null ? ex.InnerException.ToString() : ex.ToString());
}
//previousEvents.Add(i);