diff --git a/OpenDreamPackaging/DreamPackaging.cs b/OpenDreamPackaging/DreamPackaging.cs index 13004e1e97..e171bb0208 100644 --- a/OpenDreamPackaging/DreamPackaging.cs +++ b/OpenDreamPackaging/DreamPackaging.cs @@ -1,5 +1,6 @@ using Robust.Packaging; using Robust.Packaging.AssetProcessing; +using Robust.Packaging.AssetProcessing.Passes; namespace OpenDreamPackaging; @@ -19,13 +20,21 @@ public static async Task WriteResources( var inputPass = graph.Input; - await RobustClientPackaging.WriteClientResources( - contentDir, + await RobustSharedPackaging.WriteContentAssemblies( inputPass, - cancel); + contentDir, + "Content.Client", + new[] { "OpenDreamClient", "OpenDreamShared" }, + cancel: cancel); await RobustClientPackaging.WriteClientResources(contentDir, inputPass, cancel); + WriteRscResources(dreamRootDir, resources, inputPass); + + inputPass.InjectFinished(); + } + + public static void WriteRscResources(string dreamRootDir, string[] resources, AssetPassPipe inputPass) { for (var i = 0; i < resources.Length; i++) { var resource = resources[i].Replace('\\', Path.DirectorySeparatorChar); // The game client only knows a resource ID, so that's what we name the files. @@ -35,7 +44,5 @@ await RobustClientPackaging.WriteClientResources( inputPass.InjectFileFromDisk(path, diskPath); } - - inputPass.InjectFinished(); } } diff --git a/OpenDreamRuntime/DreamAczProvider.cs b/OpenDreamRuntime/DreamAczProvider.cs new file mode 100644 index 0000000000..c85182a556 --- /dev/null +++ b/OpenDreamRuntime/DreamAczProvider.cs @@ -0,0 +1,43 @@ +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using OpenDreamPackaging; +using Robust.Packaging; +using Robust.Packaging.AssetProcessing; +using Robust.Server.ServerStatus; + +namespace OpenDreamRuntime; + +public sealed class DreamAczProvider : IMagicAczProvider, IFullHybridAczProvider { + private readonly IDependencyCollection _dependencies; + private readonly string _rootPath; + private readonly string[] _resources; + + public DreamAczProvider(IDependencyCollection dependencies, string rootPath, string[] resources) { + _dependencies = dependencies; + _rootPath = rootPath; + _resources = resources; + } + + public async Task Package(AssetPass pass, IPackageLogger logger, CancellationToken cancel) { + var contentDir = DefaultMagicAczProvider.FindContentRootPath(_dependencies); + + await DreamPackaging.WriteResources(contentDir, _rootPath, _resources, pass, logger, cancel); + } + + public Task Package(AssetPass hybridPackageInput, AssetPass output, IPackageLogger logger, CancellationToken cancel) { + var clientAssetGraph = new RobustClientAssetGraph(); + var resourceInput = clientAssetGraph.Input; + output.AddDependency(clientAssetGraph.Output); + output.AddDependency(hybridPackageInput); + + AssetGraph.CalculateGraph( + clientAssetGraph.AllPasses.Concat(new[] { hybridPackageInput, output }).ToArray(), + logger); + + DreamPackaging.WriteRscResources(_rootPath, _resources, resourceInput); + resourceInput.InjectFinished(); + + return Task.CompletedTask; + } +} diff --git a/OpenDreamRuntime/DreamMagicAczProvider.cs b/OpenDreamRuntime/DreamMagicAczProvider.cs deleted file mode 100644 index 965f6aa8b6..0000000000 --- a/OpenDreamRuntime/DreamMagicAczProvider.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using OpenDreamPackaging; -using Robust.Packaging; -using Robust.Packaging.AssetProcessing; -using Robust.Server.ServerStatus; - -namespace OpenDreamRuntime; - -public sealed class DreamMagicAczProvider : IMagicAczProvider { - private readonly IDependencyCollection _dependencies; - private readonly string _rootPath; - private readonly string[] _resources; - - public DreamMagicAczProvider(IDependencyCollection dependencies, string rootPath, string[] resources) { - _dependencies = dependencies; - _rootPath = rootPath; - _resources = resources; - } - - public async Task Package(AssetPass pass, IPackageLogger logger, CancellationToken cancel) { - var contentDir = DefaultMagicAczProvider.FindContentRootPath(_dependencies); - - await DreamPackaging.WriteResources(contentDir, _rootPath, _resources, pass, logger, cancel); - } -} diff --git a/OpenDreamRuntime/DreamManager.cs b/OpenDreamRuntime/DreamManager.cs index 5befb8d19f..7453ae3c70 100644 --- a/OpenDreamRuntime/DreamManager.cs +++ b/OpenDreamRuntime/DreamManager.cs @@ -116,7 +116,7 @@ public bool LoadJson(string? jsonPath) { } _compiledJson = json; - var rootPath = Path.GetDirectoryName(jsonPath)!; + var rootPath = Path.GetFullPath(Path.GetDirectoryName(jsonPath)!); var resources = _compiledJson.Resources ?? Array.Empty(); _dreamResourceManager.Initialize(rootPath, resources); if(!string.IsNullOrEmpty(_compiledJson.Interface) && !_dreamResourceManager.DoesFileExist(_compiledJson.Interface)) @@ -146,9 +146,9 @@ public bool LoadJson(string? jsonPath) { _dreamMapManager.LoadMaps(_compiledJson.Maps); - _statusHost.SetMagicAczProvider(new DreamMagicAczProvider( - _dependencyCollection, rootPath, resources - )); + var aczProvider = new DreamAczProvider(_dependencyCollection, rootPath, resources); + _statusHost.SetMagicAczProvider(aczProvider); + _statusHost.SetFullHybridAczProvider(aczProvider); return true; } diff --git a/OpenDreamRuntime/EntryPoint.cs b/OpenDreamRuntime/EntryPoint.cs index 6f962e645e..6a54f0db18 100644 --- a/OpenDreamRuntime/EntryPoint.cs +++ b/OpenDreamRuntime/EntryPoint.cs @@ -25,10 +25,6 @@ public sealed class EntryPoint : GameServer { private DreamCommandSystem? _commandSystem; public override void Init() { - IoCManager.Resolve().SetMagicAczProvider(new DefaultMagicAczProvider( - new DefaultMagicAczInfo("Content.Client", new[] {"OpenDreamClient", "OpenDreamShared"}), - IoCManager.Resolve())); - IComponentFactory componentFactory = IoCManager.Resolve(); componentFactory.DoAutoRegistrations(); diff --git a/RobustToolbox b/RobustToolbox index eb092e90ef..a891cacae5 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit eb092e90efc7ac4ae562bc46f9b760745a29e289 +Subproject commit a891cacae53d704f1d0afa85bd3bc10820c38881