Fix telemetry delivery and report loaded island names; record Workshop 0.0.130
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -89,6 +89,7 @@ class ERR_Telemetry
|
||||
protected string m_InFlight;
|
||||
protected string m_FinalEventId;
|
||||
protected string m_FinalOutcome;
|
||||
protected string m_FinalTerrain;
|
||||
protected bool m_CommunityReady;
|
||||
protected int m_Started;
|
||||
protected int m_LastSample;
|
||||
@@ -288,6 +289,18 @@ class ERR_Telemetry
|
||||
m_State.previousOutcome = outcome;
|
||||
Event("mission_finished", outcome);
|
||||
}
|
||||
protected string Terrain()
|
||||
{
|
||||
// The loaded root scene identifies the island beneath GM/Conflict scenarios.
|
||||
// Use the same terrain resolver as the mission title, on the reporting server.
|
||||
string world = GetGame().GetWorldFile();
|
||||
if (GetGame().GetWorld() && GetGame().GetWorld().GetNumSubScenes() > 0)
|
||||
{
|
||||
string root = GetGame().GetWorld().GetSubSceneName(0);
|
||||
if (!root.IsEmpty()) world = root;
|
||||
}
|
||||
return ERR_TerrainDisplayName.Resolve(world);
|
||||
}
|
||||
protected void Event(string type, string outcome = "", string previous = "", string previousOutcome = "")
|
||||
{
|
||||
if (!Enabled()) return;
|
||||
@@ -299,10 +312,12 @@ class ERR_Telemetry
|
||||
json.WriteValue("serverId", m_State.serverId); json.WriteValue("serverName", m_Config.ServerName);
|
||||
json.WriteValue("type", type); json.WriteValue("occurredAt", System.GetUnixTime());
|
||||
json.WriteValue("partial", m_Partial);
|
||||
json.WriteValue("elapsedSeconds", Math.Max(0, (System.GetTickCount() - m_Started) / 1000));
|
||||
int elapsedSeconds = Math.Max(0, (System.GetTickCount() - m_Started) / 1000);
|
||||
json.WriteValue("elapsedSeconds", elapsedSeconds);
|
||||
json.WriteValue("phase", m_Mode.Phase()); json.WriteValue("outcome", outcome);
|
||||
json.WriteValue("previousMissionId", previous); json.WriteValue("previousOutcome", previousOutcome);
|
||||
json.WriteValue("terrain", GetGame().GetWorldFile());
|
||||
string terrain = Terrain();
|
||||
json.WriteValue("terrain", terrain);
|
||||
SCR_MissionHeader header = SCR_MissionHeader.Cast(GetGame().GetMissionHeader());
|
||||
string scenario; if (header) scenario = header.m_sName;
|
||||
json.WriteValue("gameVersion", GetGame().GetBuildVersion());
|
||||
@@ -332,7 +347,7 @@ class ERR_Telemetry
|
||||
}
|
||||
if (type == "mission_finished")
|
||||
{
|
||||
m_FinalEventId = eventId; m_FinalOutcome = outcome;
|
||||
m_FinalEventId = eventId; m_FinalOutcome = outcome; m_FinalTerrain = terrain;
|
||||
// Finish can arrive while a previous request is in flight. RemoveItem on its
|
||||
// acknowledgement still removes that exact payload, leaving this final first.
|
||||
m_State.pending.InsertAt(payload, 0);
|
||||
@@ -402,7 +417,7 @@ class ERR_Telemetry
|
||||
if (m_FinalOutcome != "victory" && m_FinalOutcome != "defeat") return;
|
||||
JsonLoadContext reply = new JsonLoadContext();
|
||||
ERR_CommunityStatistics community;
|
||||
if (callback.GetData().Length() > 8192 || !reply.LoadFromString(callback.GetData()) || !reply.ReadValue("community", community) || !community || !community.Matches(m_State.serverId, m_MissionId, m_FinalEventId, GetGame().GetWorldFile(), m_FinalOutcome))
|
||||
if (callback.GetData().Length() > 8192 || !reply.LoadFromString(callback.GetData()) || !reply.ReadValue("community", community) || !community || !community.Matches(m_State.serverId, m_MissionId, m_FinalEventId, m_FinalTerrain, m_FinalOutcome))
|
||||
{
|
||||
CommunityUnavailable(); return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user