Skip to content

Commit

Permalink
Update UID util to return actual data for local server, placeholder f…
Browse files Browse the repository at this point in the history
…or peertools
  • Loading branch information
Arkensor committed Jul 21, 2023
1 parent 8378fb7 commit 77f1599
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
16 changes: 9 additions & 7 deletions src/Scripts/Game/EPF_Utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ class EPF_Utils
string uid = GetGame().GetBackendApi().GetPlayerUID(playerId);
if (!uid)
{
if (RplSession.Mode() == RplMode.Dedicated)
if (RplSession.Mode() != RplMode.Dedicated)
{
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");
return string.Empty;
// Peer tool support
uid = string.Format("bbbbdddd-0000-0000-0000-%1", playerId.ToString(12));
}
else
{
Debug.Error("Dedicated server is not correctly configuted to connect to the BI backend.\nSee https://community.bistudio.com/wiki/Arma_Reforger:Server_Hosting");
}

uid = string.Format("bbbbdddd-0000-0000-0000-%1", playerId.ToString(12));
}

return uid;
Expand Down Expand Up @@ -88,7 +90,7 @@ class EPF_Utils

if (!EPF_Const.IsNan(yaw))
{
Math3D.AnglesToMatrix(Vector(yaw, 0 ,0), transform);
Math3D.AnglesToMatrix(Vector(yaw, 0, 0), transform);
}
else
{
Expand Down Expand Up @@ -247,4 +249,4 @@ class EPF_Utils

return data.Substring(0, data.Length() - amount);
}
};
}
20 changes: 12 additions & 8 deletions src/Scripts/Game/RespawnSystem/EPF_BasicRespawnSystemComponent.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ class EPF_BasicRespawnSystemComponent : SCR_RespawnSystemComponent

if (RplSession.Mode() != RplMode.Dedicated)
{
OnUidAvailable(playerId);
WaitForUid(playerId);
}
else
{
EDF_ScriptInvokerCallback1<int> callback(this, "OnUidAvailable");
m_pGameMode.GetOnPlayerAuditSuccess().Insert(callback.Invoke)
EDF_ScriptInvokerCallback1<int> callback(this, "WaitForUid");
m_pGameMode.GetOnPlayerAuditSuccess().Insert(callback.Invoke);
}
}

Expand Down Expand Up @@ -81,13 +81,17 @@ class EPF_BasicRespawnSystemComponent : SCR_RespawnSystemComponent
}

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

Tuple2<int, string> characterContext(playerId, playerUid);
//------------------------------------------------------------------------------------------------
protected void OnUidAvailable(int playerId)
{
Tuple2<int, string> characterContext(playerId, EPF_Utils.GetPlayerUID(playerId));

EPF_PersistenceManager persistenceManager = EPF_PersistenceManager.GetInstance();
if (persistenceManager.GetState() < EPF_EPersistenceManagerState.ACTIVE)
Expand Down

0 comments on commit 77f1599

Please sign in to comment.