Skip to content

Commit 77f1599

Browse files
committed
Update UID util to return actual data for local server, placeholder for peertools
1 parent 8378fb7 commit 77f1599

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

src/Scripts/Game/EPF_Utils.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ class EPF_Utils
1515
string uid = GetGame().GetBackendApi().GetPlayerUID(playerId);
1616
if (!uid)
1717
{
18-
if (RplSession.Mode() == RplMode.Dedicated)
18+
if (RplSession.Mode() != RplMode.Dedicated)
1919
{
20-
Debug.Error("Dedicated server is not correctly configuted to connect to the BI backend.\nSee https://community.bistudio.com/wiki/Arma_Reforger:Server_Hosting#gameHostRegisterBindAddress");
21-
return string.Empty;
20+
// Peer tool support
21+
uid = string.Format("bbbbdddd-0000-0000-0000-%1", playerId.ToString(12));
22+
}
23+
else
24+
{
25+
Debug.Error("Dedicated server is not correctly configuted to connect to the BI backend.\nSee https://community.bistudio.com/wiki/Arma_Reforger:Server_Hosting");
2226
}
23-
24-
uid = string.Format("bbbbdddd-0000-0000-0000-%1", playerId.ToString(12));
2527
}
2628

2729
return uid;
@@ -88,7 +90,7 @@ class EPF_Utils
8890

8991
if (!EPF_Const.IsNan(yaw))
9092
{
91-
Math3D.AnglesToMatrix(Vector(yaw, 0 ,0), transform);
93+
Math3D.AnglesToMatrix(Vector(yaw, 0, 0), transform);
9294
}
9395
else
9496
{
@@ -247,4 +249,4 @@ class EPF_Utils
247249

248250
return data.Substring(0, data.Length() - amount);
249251
}
250-
};
252+
}

src/Scripts/Game/RespawnSystem/EPF_BasicRespawnSystemComponent.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ class EPF_BasicRespawnSystemComponent : SCR_RespawnSystemComponent
1818

1919
if (RplSession.Mode() != RplMode.Dedicated)
2020
{
21-
OnUidAvailable(playerId);
21+
WaitForUid(playerId);
2222
}
2323
else
2424
{
25-
EDF_ScriptInvokerCallback1<int> callback(this, "OnUidAvailable");
26-
m_pGameMode.GetOnPlayerAuditSuccess().Insert(callback.Invoke)
25+
EDF_ScriptInvokerCallback1<int> callback(this, "WaitForUid");
26+
m_pGameMode.GetOnPlayerAuditSuccess().Insert(callback.Invoke);
2727
}
2828
}
2929

@@ -81,13 +81,17 @@ class EPF_BasicRespawnSystemComponent : SCR_RespawnSystemComponent
8181
}
8282

8383
//------------------------------------------------------------------------------------------------
84-
protected void OnUidAvailable(int playerId)
84+
protected void WaitForUid(int playerId)
8585
{
86-
string playerUid = EPF_Utils.GetPlayerUID(playerId);
87-
if (!playerUid)
88-
return;
86+
// Wait one frame after audit/sp join, then it is available.
87+
// TODO: Remove this method once https://feedback.bistudio.com/T165590 is fixed.
88+
GetGame().GetCallqueue().Call(OnUidAvailable, playerId);
89+
}
8990

90-
Tuple2<int, string> characterContext(playerId, playerUid);
91+
//------------------------------------------------------------------------------------------------
92+
protected void OnUidAvailable(int playerId)
93+
{
94+
Tuple2<int, string> characterContext(playerId, EPF_Utils.GetPlayerUID(playerId));
9195

9296
EPF_PersistenceManager persistenceManager = EPF_PersistenceManager.GetInstance();
9397
if (persistenceManager.GetState() < EPF_EPersistenceManagerState.ACTIVE)

0 commit comments

Comments
 (0)