diff --git a/Barotrauma/BarotraumaServer/LinuxServer.csproj b/Barotrauma/BarotraumaServer/LinuxServer.csproj index 717ebde2c..3698ceabd 100644 --- a/Barotrauma/BarotraumaServer/LinuxServer.csproj +++ b/Barotrauma/BarotraumaServer/LinuxServer.csproj @@ -1,5 +1,10 @@ + + + + + Exe net6.0 @@ -14,6 +19,7 @@ Debug;Release;Unstable true ;NU1605;CS0114;CS0108CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765 + en diff --git a/Barotrauma/BarotraumaServer/MacServer.csproj b/Barotrauma/BarotraumaServer/MacServer.csproj index dc3dd32d7..b8ec90d01 100644 --- a/Barotrauma/BarotraumaServer/MacServer.csproj +++ b/Barotrauma/BarotraumaServer/MacServer.csproj @@ -1,5 +1,10 @@ + + + + + Exe net6.0 @@ -14,6 +19,7 @@ Debug;Release;Unstable true ;NU1605;CS0114;CS0108CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765 + en diff --git a/Barotrauma/BarotraumaServer/ServerSource/LuaCs/Lua/LuaBarotraumaAdditions.cs b/Barotrauma/BarotraumaServer/ServerSource/LuaCs/Lua/LuaBarotraumaAdditions.cs index 1fc7fbd58..62289624f 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/LuaCs/Lua/LuaBarotraumaAdditions.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/LuaCs/Lua/LuaBarotraumaAdditions.cs @@ -16,32 +16,32 @@ namespace Barotrauma.Networking GameMain.Server.KickClient(this.Connection, reason); } - public void Ban(string reason = "", bool range = false, float seconds = -1) + public void Ban(string reason = "", float seconds = -1) { if (seconds == -1) { - GameMain.Server.BanClient(this, reason, range, null); + GameMain.Server.BanClient(this, reason, null); } else { - GameMain.Server.BanClient(this, reason, range, TimeSpan.FromSeconds(seconds)); + GameMain.Server.BanClient(this, reason, TimeSpan.FromSeconds(seconds)); } } - public static void Unban(string player, string endpoint) + public static void UnbanPlayer(string playerName) { - GameMain.Server.UnbanPlayer(player, endpoint); + GameMain.Server.UnbanPlayer(playerName); } - public static void Ban(string player, string reason, bool range = false, float seconds = -1) + public static void BanPlayer(string player, string reason, bool range = false, float seconds = -1) { if (seconds == -1) { - GameMain.Server.BanPlayer(player, reason, range, null); + GameMain.Server.BanPlayer(player, reason, null); } else { - GameMain.Server.BanPlayer(player, reason, range, TimeSpan.FromSeconds(seconds)); + GameMain.Server.BanPlayer(player, reason, TimeSpan.FromSeconds(seconds)); } } diff --git a/Barotrauma/BarotraumaServer/ServerSource/Networking/Primitives/Peers/Server/LidgrenServerPeer.cs b/Barotrauma/BarotraumaServer/ServerSource/Networking/Primitives/Peers/Server/LidgrenServerPeer.cs index 71a305d05..160eaf8a3 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Networking/Primitives/Peers/Server/LidgrenServerPeer.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Networking/Primitives/Peers/Server/LidgrenServerPeer.cs @@ -27,7 +27,8 @@ namespace Barotrauma.Networking AutoExpandMTU = false, MaximumConnections = NetConfig.MaxPlayers * 2, EnableUPnP = serverSettings.EnableUPnP, - Port = serverSettings.Port + Port = serverSettings.Port, + LocalAddress = serverSettings.ListenIPAddress, }; netPeerConfiguration.DisableMessageType( @@ -489,4 +490,4 @@ namespace Barotrauma.Networking return netServer.SendMessage(msg.ToLidgren(netServer), conn.NetConnection, deliveryMethod.ToLidgren()); } } -} \ No newline at end of file +} diff --git a/Barotrauma/BarotraumaServer/ServerSource/Networking/Primitives/Peers/Server/ServerPeer.cs b/Barotrauma/BarotraumaServer/ServerSource/Networking/Primitives/Peers/Server/ServerPeer.cs index fb81b889c..0a6a78003 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Networking/Primitives/Peers/Server/ServerPeer.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Networking/Primitives/Peers/Server/ServerPeer.cs @@ -36,7 +36,7 @@ namespace Barotrauma.Networking public abstract void Close(); public abstract void Update(float deltaTime); - protected sealed class PendingClient + public sealed class PendingClient { public string? Name; public Option OwnerKey; @@ -285,7 +285,7 @@ namespace Barotrauma.Networking protected virtual void CheckOwnership(PendingClient pendingClient) { } - protected void RemovePendingClient(PendingClient pendingClient, PeerDisconnectPacket peerDisconnectPacket) + public void RemovePendingClient(PendingClient pendingClient, PeerDisconnectPacket peerDisconnectPacket) { if (pendingClients.Contains(pendingClient)) { @@ -305,4 +305,4 @@ namespace Barotrauma.Networking public abstract void Send(IWriteMessage msg, NetworkConnection conn, DeliveryMethod deliveryMethod, bool compressPastThreshold = true); public abstract void Disconnect(NetworkConnection conn, PeerDisconnectPacket peerDisconnectPacket); } -} \ No newline at end of file +} diff --git a/Barotrauma/BarotraumaServer/WindowsServer.csproj b/Barotrauma/BarotraumaServer/WindowsServer.csproj index 12f6075f1..7fa61287a 100644 --- a/Barotrauma/BarotraumaServer/WindowsServer.csproj +++ b/Barotrauma/BarotraumaServer/WindowsServer.csproj @@ -1,5 +1,10 @@ + + + + + Exe net6.0 @@ -14,6 +19,8 @@ Debug;Release;Unstable true ;NU1605;CS0114;CS0108CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765 + Doc\BuildDocServer.xml + en diff --git a/Barotrauma/BarotraumaShared/Lua/DefaultRegister/RegisterShared.lua b/Barotrauma/BarotraumaShared/Lua/DefaultRegister/RegisterShared.lua index abdf5387b..8b19176f7 100644 --- a/Barotrauma/BarotraumaShared/Lua/DefaultRegister/RegisterShared.lua +++ b/Barotrauma/BarotraumaShared/Lua/DefaultRegister/RegisterShared.lua @@ -78,6 +78,9 @@ RegisterBarotrauma("FabricationRecipe+RequiredItemByTag") RegisterBarotrauma("Submarine") RegisterBarotrauma("INetSerializableStruct") +RegisterBarotrauma("Networking.AccountInfo") +RegisterBarotrauma("Networking.AccountId") +RegisterBarotrauma("Networking.SteamId") RegisterBarotrauma("Networking.Client") RegisterBarotrauma("Networking.TempClient") RegisterBarotrauma("Networking.NetworkConnection") diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaBarotraumaAdditions.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaBarotraumaAdditions.cs index 7907ce025..da9fd5097 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaBarotraumaAdditions.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaBarotraumaAdditions.cs @@ -3,12 +3,13 @@ using System.Collections.Generic; using System.Text; using MoonSharp.Interpreter; using Microsoft.Xna.Framework; +using Barotrauma.Networking; namespace Barotrauma.Networking { partial class Client { - public static List ClientList + public static IReadOnlyList ClientList { get { @@ -20,6 +21,21 @@ namespace Barotrauma.Networking } } + public ulong SteamID + { + get + { + if (AccountId.TryUnwrap(out AccountId outValue) && outValue is SteamId steamId) + { + return steamId.Value; + } + else + { + return 0; + } + } + } + } } diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaClasses/LuaGame.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaClasses/LuaGame.cs index 10b8a34b0..7f580aadd 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaClasses/LuaGame.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaClasses/LuaGame.cs @@ -25,12 +25,11 @@ namespace Barotrauma } } - public bool? ForceVoice = null; - public bool? ForceLocalVoice = null; - public bool Paused => GameMain.Instance?.Paused == true; - public byte MyID => GameMain.Client.ID; - public ChatMode ActiveChatMode => GameMain.ActiveChatMode; + public byte SessionId => GameMain.Client.SessionId; + public byte MyID => SessionId; // compatibility + + public ChatMode ActiveChatMode => GameMain.ActiveChatMode; public ChatBox ChatBox { diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsNetworking.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsNetworking.cs index 339873483..c720b3505 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsNetworking.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsNetworking.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Specialized; using System.IO; @@ -142,12 +142,12 @@ namespace Barotrauma { var message = new WriteOnlyMessage(); #if SERVER - message.Write((byte)ServerPacketHeader.LUA_NET_MESSAGE); + message.WriteByte((byte)ServerPacketHeader.LUA_NET_MESSAGE); #else - message.Write((byte)ClientPacketHeader.LUA_NET_MESSAGE); + message.WriteByte((byte)ClientPacketHeader.LUA_NET_MESSAGE); #endif - message.Write(netMessageName); - return ((IWriteMessage)message); + message.WriteString(netMessageName); + return message; } public IWriteMessage Start() @@ -274,9 +274,9 @@ namespace Barotrauma GameMain.Server.UpdateClientPermissions(client); } - public void RemovePendingClient(ServerPeer.PendingClient pendingClient, DisconnectReason reason, string msg) + public void RemovePendingClient(ServerPeer.PendingClient pendingClient, PeerDisconnectPacket peerDisconnectPacket) { - GameMain.Server.ServerPeer.RemovePendingClient(pendingClient, reason, msg); + GameMain.Server.ServerPeer.RemovePendingClient(pendingClient, peerDisconnectPacket); } public int FileSenderMaxPacketsPerUpdate @@ -293,4 +293,4 @@ namespace Barotrauma set { GameMain.NetworkMember.LastClientListUpdateID = value; } } } -} \ No newline at end of file +} diff --git a/Barotrauma/BarotraumaShared/SharedSource/Utils/SaveUtil.cs b/Barotrauma/BarotraumaShared/SharedSource/Utils/SaveUtil.cs index 8df000e58..979a607b1 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Utils/SaveUtil.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Utils/SaveUtil.cs @@ -27,7 +27,7 @@ namespace Barotrauma #else //"C:/Users/*user*/AppData/Local/Daedalic Entertainment GmbH/" on Windows //"/home/*user*/.local/share/Daedalic Entertainment GmbH/" on Linux - public static readonly string SaveFolder = Path.Combine( + public static string SaveFolder = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Daedalic Entertainment GmbH", "Barotrauma"); diff --git a/WindowsSolution.sln b/WindowsSolution.sln index 7f6b6b376..88ab69c22 100644 --- a/WindowsSolution.sln +++ b/WindowsSolution.sln @@ -44,7 +44,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsTest", "Barotrauma\B EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MoonSharp.Interpreter", "Libraries\moonsharp\MoonSharp.Interpreter\MoonSharp.Interpreter.csproj", "{2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeployAll", "Deploy\DeployAll\DeployAll.csproj", "{C98FE0D0-BC7D-4806-B592-734B53016FD8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DeployAll", "Deploy\DeployAll\DeployAll.csproj", "{C98FE0D0-BC7D-4806-B592-734B53016FD8}" EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution @@ -203,10 +203,28 @@ Global {C7212AE2-A925-4225-A639-AE0653EF65B0}.Unstable|Any CPU.Build.0 = Release|Any CPU {C7212AE2-A925-4225-A639-AE0653EF65B0}.Unstable|x64.ActiveCfg = Debug|Any CPU {C7212AE2-A925-4225-A639-AE0653EF65B0}.Unstable|x64.Build.0 = Debug|Any CPU + {2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Debug|x64.ActiveCfg = Debug|Any CPU + {2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Debug|x64.Build.0 = Debug|Any CPU + {2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Release|Any CPU.Build.0 = Release|Any CPU + {2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Release|x64.ActiveCfg = Release|Any CPU + {2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Release|x64.Build.0 = Release|Any CPU + {2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Unstable|Any CPU.ActiveCfg = Debug|Any CPU + {2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Unstable|Any CPU.Build.0 = Debug|Any CPU + {2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Unstable|x64.ActiveCfg = Debug|Any CPU + {2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Unstable|x64.Build.0 = Debug|Any CPU + {C98FE0D0-BC7D-4806-B592-734B53016FD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C98FE0D0-BC7D-4806-B592-734B53016FD8}.Debug|Any CPU.Build.0 = Debug|Any CPU {C98FE0D0-BC7D-4806-B592-734B53016FD8}.Debug|x64.ActiveCfg = Debug|Any CPU {C98FE0D0-BC7D-4806-B592-734B53016FD8}.Debug|x64.Build.0 = Debug|Any CPU + {C98FE0D0-BC7D-4806-B592-734B53016FD8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C98FE0D0-BC7D-4806-B592-734B53016FD8}.Release|Any CPU.Build.0 = Release|Any CPU {C98FE0D0-BC7D-4806-B592-734B53016FD8}.Release|x64.ActiveCfg = Release|Any CPU {C98FE0D0-BC7D-4806-B592-734B53016FD8}.Release|x64.Build.0 = Release|Any CPU + {C98FE0D0-BC7D-4806-B592-734B53016FD8}.Unstable|Any CPU.ActiveCfg = Release|Any CPU + {C98FE0D0-BC7D-4806-B592-734B53016FD8}.Unstable|Any CPU.Build.0 = Release|Any CPU {C98FE0D0-BC7D-4806-B592-734B53016FD8}.Unstable|x64.ActiveCfg = Debug|Any CPU {C98FE0D0-BC7D-4806-B592-734B53016FD8}.Unstable|x64.Build.0 = Debug|Any CPU EndGlobalSection