initial cs-lua merge work

This commit is contained in:
Oiltanker
2022-04-11 22:44:53 +03:00
parent ae2b84cceb
commit 1e6ac68e86
44 changed files with 786 additions and 1046 deletions
@@ -182,21 +182,21 @@ namespace Barotrauma.Networking
{
if (netServer == null) { return; }
var result = new LuaResult(GameMain.Lua.hook.Call("lidgren.handleConnection", inc));
if (!result.IsNull())
if (result.Bool())
goto ignore;
else
return;
var skipDeny = false;
{
var result = new LuaResult(GameMain.LuaCs.hook.Call("lidgren.handleConnection", inc));
if (!result.IsNull()) {
if (result.Bool()) skipDeny = true;
else return;
}
}
if (connectedClients.Count >= serverSettings.MaxPlayers)
if (!skipDeny && connectedClients.Count >= serverSettings.MaxPlayers)
{
inc.SenderConnection.Deny(DisconnectReason.ServerFull.ToString());
return;
}
ignore:
if (serverSettings.BanList.IsBanned(inc.SenderConnection.RemoteEndPoint.Address, 0, 0, out string banReason))
{
//IP banned: deny immediately
@@ -206,7 +206,7 @@ namespace Barotrauma.Networking
protected void UpdatePendingClient(PendingClient pendingClient)
{
var result = new LuaResult(GameMain.Lua.hook.Call("handlePendingClient", pendingClient));
var result = new LuaResult(GameMain.LuaCs.hook.Call("handlePendingClient", pendingClient));
if (result.Bool())
goto ignore;