new hook call method + function to delegate conversion
This commit is contained in:
+3
-3
@@ -184,9 +184,9 @@ namespace Barotrauma.Networking
|
||||
|
||||
var skipDeny = false;
|
||||
{
|
||||
var result = new LuaResult(GameMain.LuaCs.HookBase.Call("lidgren.handleConnection", inc));
|
||||
if (!result.IsNull()) {
|
||||
if (result.Bool()) skipDeny = true;
|
||||
var result = GameMain.LuaCs.Hook.Call<bool?>("lidgren.handleConnection", inc);
|
||||
if (result != null) {
|
||||
if (result.Value) skipDeny = true;
|
||||
else return;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-6
@@ -206,18 +206,16 @@ namespace Barotrauma.Networking
|
||||
|
||||
protected void UpdatePendingClient(PendingClient pendingClient)
|
||||
{
|
||||
var result = new LuaResult(GameMain.LuaCs.HookBase.Call("handlePendingClient", pendingClient));
|
||||
var skipRemove = false;
|
||||
var result = GameMain.LuaCs.Hook.Call<bool?>("handlePendingClient", pendingClient);
|
||||
|
||||
if (result.Bool())
|
||||
goto ignore;
|
||||
if (result != null) skipRemove = result.Value;
|
||||
|
||||
if (connectedClients.Count >= serverSettings.MaxPlayers)
|
||||
if (!skipRemove && connectedClients.Count >= serverSettings.MaxPlayers)
|
||||
{
|
||||
RemovePendingClient(pendingClient, DisconnectReason.ServerFull, "");
|
||||
}
|
||||
|
||||
ignore:
|
||||
|
||||
if (IsPendingClientBanned(pendingClient, out string banReason))
|
||||
{
|
||||
RemovePendingClient(pendingClient, DisconnectReason.Banned, banReason);
|
||||
|
||||
Reference in New Issue
Block a user