ITelemetrySink with the null, log and JSON Lines sinks, FTelemetryEvent and the envelope, TelemetryEvents, UTelemetrySubsystem on the game instance, ASaltyGameMode minting the session id into the replicated ASaltyGameState, bs.TelemetryTest, the git hash in the build string (D-42) and four Salty.Core.Telemetry tests replacing the placeholder. Proved standalone and with a headless server plus client sharing one session id. Also enables the engine's Editor, AutomationTest, GameplayTags, ConfigSettings and LiveCoding MCP toolsets (D-43) so the editor's MCP server exposes more than the skills toolset. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
38 lines
823 B
C++
38 lines
823 B
C++
#include "Core/SaltyGameState.h"
|
|
#include "Core/TelemetrySubsystem.h"
|
|
#include "Engine/GameInstance.h"
|
|
#include "Engine/World.h"
|
|
#include "Net/UnrealNetwork.h"
|
|
|
|
void ASaltyGameState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
|
|
{
|
|
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
|
|
DOREPLIFETIME(ASaltyGameState, SessionId);
|
|
}
|
|
|
|
void ASaltyGameState::SetSessionId(const FGuid& InSessionId)
|
|
{
|
|
if (!HasAuthority())
|
|
{
|
|
return;
|
|
}
|
|
SessionId = InSessionId;
|
|
AdoptSessionId();
|
|
}
|
|
|
|
void ASaltyGameState::OnRep_SessionId()
|
|
{
|
|
AdoptSessionId();
|
|
}
|
|
|
|
void ASaltyGameState::AdoptSessionId()
|
|
{
|
|
if (const UGameInstance* GameInstance = GetGameInstance())
|
|
{
|
|
if (UTelemetrySubsystem* Telemetry = GameInstance->GetSubsystem<UTelemetrySubsystem>())
|
|
{
|
|
Telemetry->BeginSession(SessionId);
|
|
}
|
|
}
|
|
}
|