fix Game.RoundStarted and improve error handling

This commit is contained in:
Evil Factory
2022-05-07 15:36:47 -03:00
parent 0d560a688c
commit e7510cad76
3 changed files with 6 additions and 7 deletions

View File

@@ -119,9 +119,9 @@ namespace Barotrauma
get
{
#if SERVER
return GameMain.Server.GameStarted;
return GameMain.Server?.GameStarted == true;
#else
return GameMain.Client.GameStarted;
return GameMain.Client?.GameStarted == true;
#endif
}
}

View File

@@ -216,7 +216,7 @@ namespace Barotrauma
if (methodInfo == null)
{
string parameterNamesStr = parameterNames == null ? "" : string.Join(", ", parameterNames == null);
string parameterNamesStr = parameterNames == null ? "" : string.Join(", ", parameterNames);
GameMain.LuaCs.HandleException(new Exception($"Method '{methodName}' with parameters '{parameterNamesStr}' not found in class '{className}'"));
}

View File

@@ -89,7 +89,7 @@ namespace Barotrauma
}
else
{
GameMain.LuaCs.HandleException(new Exception("File access to \"" + path + "\" not allowed."));
throw new Exception("File access to \"" + path + "\" not allowed.");
}
}
else
@@ -100,12 +100,11 @@ namespace Barotrauma
}
else
{
GameMain.LuaCs.HandleException(new Exception("File access to \"" + path + "\" not allowed."));
throw new Exception("File access to \"" + path + "\" not allowed.");
}
}
return false;
}
public static bool IsPathAllowedLuaException(string path, bool write = true) =>
IsPathAllowedException(path, write, LuaCsSetup.ExceptionType.Lua);
public static bool IsPathAllowedCsException(string path, bool write = true) =>