my attempt

This commit is contained in:
Evil Factory
2021-01-12 20:52:35 -03:00
parent c2e181ee6d
commit a0c6794b01
11 changed files with 451 additions and 60 deletions
@@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using System;
using System.Text;
using MoonSharp.Interpreter;
namespace Barotrauma.Networking
{
@@ -169,6 +170,11 @@ namespace Barotrauma.Networking
{
GameMain.Server.SendChatMessage(txt, null, c);
}
GameMain.Lua.hook.Call("chatMessage", new DynValue[] { DynValue.NewString(txt), UserData.Create(c) });
}
public int EstimateLengthBytesServer(Client c)
@@ -308,6 +308,9 @@ namespace Barotrauma.Networking
SendConsoleMessage("Granted all permissions to " + newClient.Name + ".", newClient);
}
GameMain.Lua.hook.Call("clientConnected", new MoonSharp.Interpreter.DynValue[] { MoonSharp.Interpreter.UserData.Create(newClient) });
SendChatMessage($"ServerMessage.JoinedServer~[client]={clName}", ChatMessageType.Server, null, changeType: PlayerConnectionChangeType.Joined);
serverSettings.ServerDetailsChanged = true;
@@ -2346,6 +2349,9 @@ namespace Barotrauma.Networking
Log("Round started.", ServerLog.MessageType.ServerMessage);
GameMain.Lua.hook.Call("roundStart", new MoonSharp.Interpreter.DynValue[] { });
gameStarted = true;
initiatedStartGame = false;
GameMain.ResetFrameTime();
@@ -2461,6 +2467,9 @@ namespace Barotrauma.Networking
Log("Ending the round...", ServerLog.MessageType.ServerMessage);
}
GameMain.Lua.hook.Call("roundEnd", new MoonSharp.Interpreter.DynValue[] { });
string endMessage = TextManager.FormatServerMessage("RoundSummaryRoundHasEnded");
var traitorResults = TraitorManager?.GetEndResults() ?? new List<TraitorMissionResult>();
@@ -2713,6 +2722,8 @@ namespace Barotrauma.Networking
{
if (client == null) return;
GameMain.Lua.hook.Call("clientDisconnected", new MoonSharp.Interpreter.DynValue[] { MoonSharp.Interpreter.UserData.Create(client) });
if (gameStarted && client.Character != null)
{
client.Character.ClientDisconnected = true;