Skip to content

Commit

Permalink
Add Engine Type to API (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
DEATHB4DEFEAT authored Dec 26, 2024
1 parent 1546ffa commit 8d466d7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Robust.Server/ServerStatus/StatusHost.Handlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ private async Task<bool> HandleStatus(IStatusHandlerContext context)
// Content can override these if it wants (e.g. stealthmins).
["name"] = _serverNameCache,
["players"] = _playerManager.PlayerCount,
["engine"] = buildInfo.EngineVersion // MV Launcher can filter based on engine
// MV Launcher can filter based on engine
["engine_type"] = buildInfo.EngineType,
["engine"] = buildInfo.EngineVersion,
};

// MV launcher can display auth methods:
Expand Down Expand Up @@ -136,6 +138,7 @@ private JsonObject GetExternalBuildInfo()

return new JsonObject
{
["engine_type"] = buildInfo.EngineType,
["engine_version"] = buildInfo.EngineVersion,
["fork_id"] = buildInfo.ForkId,
["version"] = buildInfo.Version,
Expand All @@ -162,6 +165,7 @@ private JsonObject GetExternalBuildInfo()
}
return new JsonObject
{
["engine_type"] = _cfg.GetCVar(CVars.BuildEngineType),
["engine_version"] = _cfg.GetCVar(CVars.BuildEngineVersion),
["fork_id"] = fork,
["version"] = acm.ManifestHash,
Expand Down
6 changes: 6 additions & 0 deletions Robust.Shared/CVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,12 @@ protected CVars()
* BUILD
*/

/// <summary>
/// Engine type the launcher needs to connect to this server.
/// </summary>
public static readonly CVarDef<string> BuildEngineType =
CVarDef.Create("build.engine_type", "Multiverse");

/// <summary>
/// Engine version that launcher needs to connect to this server.
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions Robust.Shared/Utility/GameBuildInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ internal sealed record GameBuildInformation(
string? ZipHash,
string? ZipDownload,
string ForkId,
string EngineType,
string Version,
string? ManifestHash,
string? ManifestUrl,
Expand All @@ -18,6 +19,7 @@ public static GameBuildInformation GetBuildInfoFromConfig(IConfigurationManager
var zipHash = cfg.GetCVar(CVars.BuildHash);
var manifestHash = cfg.GetCVar(CVars.BuildManifestHash);
var forkId = cfg.GetCVar(CVars.BuildForkId);
var engineType = cfg.GetCVar(CVars.BuildEngineType);
var forkVersion = cfg.GetCVar(CVars.BuildVersion);

var manifestDownloadUrl = Interpolate(cfg.GetCVar(CVars.BuildManifestDownloadUrl));
Expand All @@ -44,6 +46,7 @@ public static GameBuildInformation GetBuildInfoFromConfig(IConfigurationManager
zipHash,
zipDownload,
forkId,
engineType,
forkVersion,
manifestHash,
manifestUrl,
Expand Down

0 comments on commit 8d466d7

Please sign in to comment.