fix projects and compile errors

This commit is contained in:
EvilFactory
2022-09-29 14:08:59 -03:00
parent 77c63541eb
commit faad59f20d
12 changed files with 85 additions and 29 deletions
@@ -1,5 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\BarotraumaShared\LuaCsDependencies.props" />
<ItemGroup>
<None Include="..\BarotraumaShared\LuaCsDependencies.props" />
</ItemGroup>
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
@@ -14,6 +19,7 @@
<Configurations>Debug;Release;Unstable</Configurations> <Configurations>Debug;Release;Unstable</Configurations>
<InvariantGlobalization>true</InvariantGlobalization> <InvariantGlobalization>true</InvariantGlobalization>
<WarningsAsErrors>;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</WarningsAsErrors> <WarningsAsErrors>;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</WarningsAsErrors>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -1,5 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\BarotraumaShared\LuaCsDependencies.props" />
<ItemGroup>
<None Include="..\BarotraumaShared\LuaCsDependencies.props" />
</ItemGroup>
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
@@ -14,6 +19,7 @@
<Configurations>Debug;Release;Unstable</Configurations> <Configurations>Debug;Release;Unstable</Configurations>
<InvariantGlobalization>true</InvariantGlobalization> <InvariantGlobalization>true</InvariantGlobalization>
<WarningsAsErrors>;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</WarningsAsErrors> <WarningsAsErrors>;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</WarningsAsErrors>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -16,32 +16,32 @@ namespace Barotrauma.Networking
GameMain.Server.KickClient(this.Connection, reason); 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) if (seconds == -1)
{ {
GameMain.Server.BanClient(this, reason, range, null); GameMain.Server.BanClient(this, reason, null);
} }
else 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) if (seconds == -1)
{ {
GameMain.Server.BanPlayer(player, reason, range, null); GameMain.Server.BanPlayer(player, reason, null);
} }
else else
{ {
GameMain.Server.BanPlayer(player, reason, range, TimeSpan.FromSeconds(seconds)); GameMain.Server.BanPlayer(player, reason, TimeSpan.FromSeconds(seconds));
} }
} }
@@ -27,7 +27,8 @@ namespace Barotrauma.Networking
AutoExpandMTU = false, AutoExpandMTU = false,
MaximumConnections = NetConfig.MaxPlayers * 2, MaximumConnections = NetConfig.MaxPlayers * 2,
EnableUPnP = serverSettings.EnableUPnP, EnableUPnP = serverSettings.EnableUPnP,
Port = serverSettings.Port Port = serverSettings.Port,
LocalAddress = serverSettings.ListenIPAddress,
}; };
netPeerConfiguration.DisableMessageType( netPeerConfiguration.DisableMessageType(
@@ -36,7 +36,7 @@ namespace Barotrauma.Networking
public abstract void Close(); public abstract void Close();
public abstract void Update(float deltaTime); public abstract void Update(float deltaTime);
protected sealed class PendingClient public sealed class PendingClient
{ {
public string? Name; public string? Name;
public Option<int> OwnerKey; public Option<int> OwnerKey;
@@ -285,7 +285,7 @@ namespace Barotrauma.Networking
protected virtual void CheckOwnership(PendingClient pendingClient) { } protected virtual void CheckOwnership(PendingClient pendingClient) { }
protected void RemovePendingClient(PendingClient pendingClient, PeerDisconnectPacket peerDisconnectPacket) public void RemovePendingClient(PendingClient pendingClient, PeerDisconnectPacket peerDisconnectPacket)
{ {
if (pendingClients.Contains(pendingClient)) if (pendingClients.Contains(pendingClient))
{ {
@@ -1,5 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\BarotraumaShared\LuaCsDependencies.props" />
<ItemGroup>
<None Include="..\BarotraumaShared\LuaCsDependencies.props" />
</ItemGroup>
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
@@ -14,6 +19,8 @@
<Configurations>Debug;Release;Unstable</Configurations> <Configurations>Debug;Release;Unstable</Configurations>
<InvariantGlobalization>true</InvariantGlobalization> <InvariantGlobalization>true</InvariantGlobalization>
<WarningsAsErrors>;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</WarningsAsErrors> <WarningsAsErrors>;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</WarningsAsErrors>
<DocumentationFile>Doc\BuildDocServer.xml</DocumentationFile>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -78,6 +78,9 @@ RegisterBarotrauma("FabricationRecipe+RequiredItemByTag")
RegisterBarotrauma("Submarine") RegisterBarotrauma("Submarine")
RegisterBarotrauma("INetSerializableStruct") RegisterBarotrauma("INetSerializableStruct")
RegisterBarotrauma("Networking.AccountInfo")
RegisterBarotrauma("Networking.AccountId")
RegisterBarotrauma("Networking.SteamId")
RegisterBarotrauma("Networking.Client") RegisterBarotrauma("Networking.Client")
RegisterBarotrauma("Networking.TempClient") RegisterBarotrauma("Networking.TempClient")
RegisterBarotrauma("Networking.NetworkConnection") RegisterBarotrauma("Networking.NetworkConnection")
@@ -3,12 +3,13 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using MoonSharp.Interpreter; using MoonSharp.Interpreter;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Barotrauma.Networking;
namespace Barotrauma.Networking namespace Barotrauma.Networking
{ {
partial class Client partial class Client
{ {
public static List<Client> ClientList public static IReadOnlyList<Client> ClientList
{ {
get 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;
}
}
}
} }
} }
@@ -25,12 +25,11 @@ namespace Barotrauma
} }
} }
public bool? ForceVoice = null;
public bool? ForceLocalVoice = null;
public bool Paused => GameMain.Instance?.Paused == true; public bool Paused => GameMain.Instance?.Paused == true;
public byte MyID => GameMain.Client.ID; public byte SessionId => GameMain.Client.SessionId;
public ChatMode ActiveChatMode => GameMain.ActiveChatMode; public byte MyID => SessionId; // compatibility
public ChatMode ActiveChatMode => GameMain.ActiveChatMode;
public ChatBox ChatBox public ChatBox ChatBox
{ {
@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.IO; using System.IO;
@@ -142,12 +142,12 @@ namespace Barotrauma
{ {
var message = new WriteOnlyMessage(); var message = new WriteOnlyMessage();
#if SERVER #if SERVER
message.Write((byte)ServerPacketHeader.LUA_NET_MESSAGE); message.WriteByte((byte)ServerPacketHeader.LUA_NET_MESSAGE);
#else #else
message.Write((byte)ClientPacketHeader.LUA_NET_MESSAGE); message.WriteByte((byte)ClientPacketHeader.LUA_NET_MESSAGE);
#endif #endif
message.Write(netMessageName); message.WriteString(netMessageName);
return ((IWriteMessage)message); return message;
} }
public IWriteMessage Start() public IWriteMessage Start()
@@ -274,9 +274,9 @@ namespace Barotrauma
GameMain.Server.UpdateClientPermissions(client); 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 public int FileSenderMaxPacketsPerUpdate
@@ -27,7 +27,7 @@ namespace Barotrauma
#else #else
//"C:/Users/*user*/AppData/Local/Daedalic Entertainment GmbH/" on Windows //"C:/Users/*user*/AppData/Local/Daedalic Entertainment GmbH/" on Windows
//"/home/*user*/.local/share/Daedalic Entertainment GmbH/" on Linux //"/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), Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"Daedalic Entertainment GmbH", "Daedalic Entertainment GmbH",
"Barotrauma"); "Barotrauma");
+19 -1
View File
@@ -44,7 +44,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsTest", "Barotrauma\B
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MoonSharp.Interpreter", "Libraries\moonsharp\MoonSharp.Interpreter\MoonSharp.Interpreter.csproj", "{2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MoonSharp.Interpreter", "Libraries\moonsharp\MoonSharp.Interpreter\MoonSharp.Interpreter.csproj", "{2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}"
EndProject 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 EndProject
Global Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution 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|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.ActiveCfg = Debug|Any CPU
{C7212AE2-A925-4225-A639-AE0653EF65B0}.Unstable|x64.Build.0 = 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.ActiveCfg = Debug|Any CPU
{C98FE0D0-BC7D-4806-B592-734B53016FD8}.Debug|x64.Build.0 = 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.ActiveCfg = Release|Any CPU
{C98FE0D0-BC7D-4806-B592-734B53016FD8}.Release|x64.Build.0 = 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.ActiveCfg = Debug|Any CPU
{C98FE0D0-BC7D-4806-B592-734B53016FD8}.Unstable|x64.Build.0 = Debug|Any CPU {C98FE0D0-BC7D-4806-B592-734B53016FD8}.Unstable|x64.Build.0 = Debug|Any CPU
EndGlobalSection EndGlobalSection