From 3f350aa6db82ac7367c08fedb218080e1099932e Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Fri, 7 Feb 2025 18:01:58 -0500 Subject: [PATCH] Add DreamDaemonPreLaunch event --- .../Components/Events/EventType.cs | 6 ++++++ .../Components/Session/SessionControllerFactory.cs | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Tgstation.Server.Host/Components/Events/EventType.cs b/src/Tgstation.Server.Host/Components/Events/EventType.cs index 711d6ca246..1dbfdb2b6f 100644 --- a/src/Tgstation.Server.Host/Components/Events/EventType.cs +++ b/src/Tgstation.Server.Host/Components/Events/EventType.cs @@ -173,5 +173,11 @@ /// [EventScript("EngineInstallComplete")] EngineInstallComplete, + + /// + /// Before game server process is created. No parameters. + /// + [EventScript("DreamDaemonPreLaunch")] + DreamDaemonPreLaunch, } } diff --git a/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs b/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs index 1573d4c48a..0785051b64 100644 --- a/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs +++ b/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.Linq; using System.Net.Sockets; using System.Text; using System.Threading; @@ -516,6 +517,14 @@ namespace Tgstation.Server.Host.Components.Session ? logFilePath : null); + // If this isnt a staging DD (From a Deployment), fire off events + if (!apiValidate) + await eventConsumer.HandleEvent( + EventType.DreamDaemonPreLaunch, + Enumerable.Empty(), + false, + cancellationToken); + var process = await processExecutor.LaunchProcess( engineLock.ServerExePath, dmbProvider.Directory, @@ -539,7 +548,6 @@ namespace Tgstation.Server.Host.Components.Session if (!engineLock.HasStandardOutput) networkPromptReaper.RegisterProcess(process); - // If this isnt a staging DD (From a Deployment), fire off an event if (!apiValidate) await eventConsumer.HandleEvent( EventType.DreamDaemonLaunch,