Update template.

This commit is contained in:
moonheart08 2024-02-19 05:42:24 -06:00
parent 8a286956ae
commit 97640c17e2
10 changed files with 68 additions and 34 deletions

View file

@ -13,7 +13,6 @@
<Configurations>Debug;Release;Tools;DebugOpt</Configurations>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.DefineConstants.targets" />
<ItemGroup>
<PackageReference Include="Nett" Version="0.15.0" />
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" PrivateAssets="All" />
@ -25,6 +24,5 @@
<ProjectReference Include="..\RobustToolbox\Robust.Client\Robust.Client.csproj" />
<ProjectReference Include="..\Content.Shared\Content.Shared.csproj" />
</ItemGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.Engine.targets" />
<Import Project="..\RobustToolbox\MSBuild\XamlIL.targets" />
</Project>

View file

@ -3,6 +3,7 @@
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ServerGarbageCollection>True</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>

View file

@ -3,6 +3,7 @@ using Robust.Packaging.AssetProcessing;
namespace Content.Packaging;
// Used both for manual packaging, and server-provided automatic packaging.
public static class ContentPackaging
{
public static async Task WriteResources(
@ -18,12 +19,12 @@ public static class ContentPackaging
var inputPass = graph.Input;
await RobustClientPackaging.WriteContentAssemblies(
await RobustSharedPackaging.WriteContentAssemblies(
inputPass,
contentDir,
"Content.Client",
new[] { "Content.Client", "Content.Shared" },
cancel);
cancel: cancel);
await RobustClientPackaging.WriteClientResources(contentDir, inputPass, cancel);

10
Content.Packaging/README Normal file
View file

@ -0,0 +1,10 @@
Relatively barebones packaging script. Does not contain a server packaging script.
Packaging a (sandboxed) client is generally very easy, but the server is a bit more complex due to likely depending on assets unique to your project.
Here's a few notes to help:
- It's recommended to build specific to your target OS, especially if depending on natives (i.e. sqlite).
- If using hybrid ACZ, you will need to include a client package in the server package's root directory for it to use.
- RobustServerPackaging is your friend, but be aware it will specifically omit texture resources.
- Familiarize yourself with AssetGraph and RobustServerAssetGraph, it allows for asset preprocessing, postprocessing of the final build, etc.
- The default asset passes will automatically compute metadata for audio without actually including the audio files in the server build. This allows your server to know how long sound clips are.
It is additionally recommended to properly configure StatusHost to use a custom provider. The default works, but cannot handle complex cases.

View file

@ -10,7 +10,6 @@
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<OutputType Condition="'$(FullRelease)' != 'True'">Exe</OutputType>
</PropertyGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.DefineConstants.targets" />
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" PrivateAssets="All" />
</ItemGroup>

View file

@ -13,10 +13,6 @@ public sealed class EntryPoint : GameServer
{
base.Init();
// Configure ACZ correctly.
IoCManager.Resolve<IStatusHost>().SetAczInfo(
"Content.Client", new []{"Content.Client", "Content.Shared"});
var factory = IoCManager.Resolve<IComponentFactory>();
factory.DoAutoRegistrations();

View file

@ -1,7 +1,12 @@
using System.Net;
using System.Diagnostics;
using System.Net;
using JetBrains.Annotations;
using Robust.Server.Console;
using Robust.Server.Player;
using Robust.Shared.Player;
using Robust.Shared.Toolshed;
using Robust.Shared.Toolshed.Errors;
using Robust.Shared.Utility;
namespace Content.Server;
@ -10,32 +15,32 @@ namespace Content.Server;
/// </summary>
[UsedImplicitly]
public sealed class LocalHostConGroup : IConGroupControllerImplementation, IPostInjectInit {
public bool CanCommand(IPlayerSession session, string cmdName) {
public bool CanCommand(ICommonSession session, string cmdName) {
return IsLocal(session);
}
public bool CanViewVar(IPlayerSession session) {
public bool CanViewVar(ICommonSession session) {
return IsLocal(session);
}
public bool CanAdminPlace(IPlayerSession session) {
public bool CanAdminPlace(ICommonSession session) {
return IsLocal(session);
}
public bool CanScript(IPlayerSession session) {
public bool CanScript(ICommonSession session) {
return IsLocal(session);
}
public bool CanAdminMenu(IPlayerSession session) {
public bool CanAdminMenu(ICommonSession session) {
return IsLocal(session);
}
public bool CanAdminReloadPrototypes(IPlayerSession session) {
public bool CanAdminReloadPrototypes(ICommonSession session) {
return IsLocal(session);
}
private static bool IsLocal(IPlayerSession player) {
var ep = player.ConnectedClient.RemoteEndPoint;
private static bool IsLocal(ICommonSession player) {
var ep = player.Channel.RemoteEndPoint;
var addr = ep.Address;
if (addr.IsIPv4MappedToIPv6) {
addr = addr.MapToIPv4();
@ -47,4 +52,30 @@ public sealed class LocalHostConGroup : IConGroupControllerImplementation, IPost
void IPostInjectInit.PostInject() {
IoCManager.Resolve<IConGroupController>().Implementation = this;
}
private record NotLocalError : IConError
{
public FormattedMessage DescribeInner()
{
return FormattedMessage.FromUnformatted("Not the local user, refusing!");
}
public string Expression { get; set; }
public Vector2i? IssueSpan { get; set; }
public StackTrace Trace { get; set; }
}
public bool CheckInvokable(CommandSpec command, ICommonSession user, out IConError error)
{
if (!IsLocal(user))
{
error = new NotLocalError();
return false;
}
error = null;
return true;
}
}

View file

@ -9,7 +9,6 @@
<WarningsAsErrors>nullable</WarningsAsErrors>
<Nullable>enable</Nullable>
</PropertyGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.DefineConstants.targets" />
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" PrivateAssets="All" />
</ItemGroup>
@ -25,6 +24,5 @@
</ProjectReference>
</ItemGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
<Import Project="..\RobustToolbox\MSBuild\Robust.CompNetworkGenerator.targets" />
</Project>

View file

@ -13,8 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RobustToolbox", "RobustTool
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Client", "RobustToolbox\Robust.Client\Robust.Client.csproj", "{2A829DE3-FCB2-4FEA-A6F3-B85122C8D11E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Physics", "RobustToolbox\Robust.Physics\Robust.Physics.csproj", "{97EBBD32-8980-4243-9F90-BC7075B3EC8F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Shared", "RobustToolbox\Robust.Shared\Robust.Shared.csproj", "{B4D5BABE-B7C5-4D73-9F8F-B5411866A1BE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Server", "RobustToolbox\Robust.Server\Robust.Server.csproj", "{68AA41CC-6095-4889-8114-B9E1B3F08B75}"
@ -61,6 +59,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Packaging", "RobustT
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Content.Packaging", "Content.Packaging\Content.Packaging.csproj", "{424445D4-F5D9-4CA9-A435-0A36E8AA28F3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Serialization.Generator", "RobustToolbox\Robust.Serialization.Generator\Robust.Serialization.Generator.csproj", "{066A19F7-7D5B-4C2B-BFC5-DE8C6FD3E186}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -104,14 +104,6 @@ Global
{2A829DE3-FCB2-4FEA-A6F3-B85122C8D11E}.DebugOpt|Any CPU.Build.0 = DebugOpt|Any CPU
{2A829DE3-FCB2-4FEA-A6F3-B85122C8D11E}.Tools|Any CPU.ActiveCfg = Tools|Any CPU
{2A829DE3-FCB2-4FEA-A6F3-B85122C8D11E}.Tools|Any CPU.Build.0 = Tools|Any CPU
{97EBBD32-8980-4243-9F90-BC7075B3EC8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97EBBD32-8980-4243-9F90-BC7075B3EC8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97EBBD32-8980-4243-9F90-BC7075B3EC8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97EBBD32-8980-4243-9F90-BC7075B3EC8F}.Release|Any CPU.Build.0 = Release|Any CPU
{97EBBD32-8980-4243-9F90-BC7075B3EC8F}.DebugOpt|Any CPU.ActiveCfg = DebugOpt|Any CPU
{97EBBD32-8980-4243-9F90-BC7075B3EC8F}.DebugOpt|Any CPU.Build.0 = DebugOpt|Any CPU
{97EBBD32-8980-4243-9F90-BC7075B3EC8F}.Tools|Any CPU.ActiveCfg = Tools|Any CPU
{97EBBD32-8980-4243-9F90-BC7075B3EC8F}.Tools|Any CPU.Build.0 = Tools|Any CPU
{B4D5BABE-B7C5-4D73-9F8F-B5411866A1BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4D5BABE-B7C5-4D73-9F8F-B5411866A1BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4D5BABE-B7C5-4D73-9F8F-B5411866A1BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -264,10 +256,17 @@ Global
{424445D4-F5D9-4CA9-A435-0A36E8AA28F3}.DebugOpt|Any CPU.Build.0 = DebugOpt|Any CPU
{424445D4-F5D9-4CA9-A435-0A36E8AA28F3}.Tools|Any CPU.ActiveCfg = Tools|Any CPU
{424445D4-F5D9-4CA9-A435-0A36E8AA28F3}.Tools|Any CPU.Build.0 = Tools|Any CPU
{066A19F7-7D5B-4C2B-BFC5-DE8C6FD3E186}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{066A19F7-7D5B-4C2B-BFC5-DE8C6FD3E186}.Debug|Any CPU.Build.0 = Debug|Any CPU
{066A19F7-7D5B-4C2B-BFC5-DE8C6FD3E186}.Release|Any CPU.ActiveCfg = Release|Any CPU
{066A19F7-7D5B-4C2B-BFC5-DE8C6FD3E186}.Release|Any CPU.Build.0 = Release|Any CPU
{066A19F7-7D5B-4C2B-BFC5-DE8C6FD3E186}.DebugOpt|Any CPU.ActiveCfg = Debug|Any CPU
{066A19F7-7D5B-4C2B-BFC5-DE8C6FD3E186}.DebugOpt|Any CPU.Build.0 = Debug|Any CPU
{066A19F7-7D5B-4C2B-BFC5-DE8C6FD3E186}.Tools|Any CPU.ActiveCfg = Debug|Any CPU
{066A19F7-7D5B-4C2B-BFC5-DE8C6FD3E186}.Tools|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{2A829DE3-FCB2-4FEA-A6F3-B85122C8D11E} = {F5F87A9D-C304-4833-B107-D666317F6931}
{97EBBD32-8980-4243-9F90-BC7075B3EC8F} = {F5F87A9D-C304-4833-B107-D666317F6931}
{B4D5BABE-B7C5-4D73-9F8F-B5411866A1BE} = {F5F87A9D-C304-4833-B107-D666317F6931}
{68AA41CC-6095-4889-8114-B9E1B3F08B75} = {F5F87A9D-C304-4833-B107-D666317F6931}
{09D5BA00-5066-4FDF-81C5-DC5E469DB11F} = {F5F87A9D-C304-4833-B107-D666317F6931}
@ -290,5 +289,6 @@ Global
{BDF16A97-6269-4CA1-8D67-785DDD357B30} = {F5F87A9D-C304-4833-B107-D666317F6931}
{81E28D82-BB23-44C7-AFFC-6CC1BB04CDF5} = {F5F87A9D-C304-4833-B107-D666317F6931}
{D7F76B45-DAF9-49E1-A910-632DB0BDF471} = {F5F87A9D-C304-4833-B107-D666317F6931}
{066A19F7-7D5B-4C2B-BFC5-DE8C6FD3E186} = {F5F87A9D-C304-4833-B107-D666317F6931}
EndGlobalSection
EndGlobal

@ -1 +1 @@
Subproject commit d4902a97148a35a422f9b0e9844951099575a3c5
Subproject commit ef0bc1a2e4878eedc24dd6fedc0631be56aca072