2021-12-09 04:34:12 +00:00
|
|
|
class MskGsRepInfo extends ReplicationInfo;
|
|
|
|
|
2021-12-26 04:18:50 +00:00
|
|
|
const GroupUIDStr = "0x017000000223386E";
|
|
|
|
const MaxRetries = 10;
|
|
|
|
const TimerDelay = 1.0f;
|
|
|
|
|
2021-12-09 04:34:12 +00:00
|
|
|
// Server vars
|
|
|
|
var public MskGsMut Mut;
|
|
|
|
var public Controller C;
|
2021-12-26 04:18:50 +00:00
|
|
|
var private int ServerApplyMembershipRetries;
|
2021-12-09 04:34:12 +00:00
|
|
|
|
|
|
|
// Client vars
|
|
|
|
var private OnlineSubsystemSteamworks SW;
|
2021-12-26 04:18:50 +00:00
|
|
|
var private int ClientGetOnlineSubsystemRetries;
|
2021-12-09 04:34:12 +00:00
|
|
|
|
|
|
|
simulated event PostBeginPlay()
|
|
|
|
{
|
|
|
|
super.PostBeginPlay();
|
|
|
|
|
|
|
|
if (bDeleteMe) return;
|
|
|
|
|
|
|
|
if (Role < ROLE_Authority || WorldInfo.NetMode == NM_StandAlone)
|
|
|
|
{
|
|
|
|
ClientGetOnlineSubsystem();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private reliable client function ClientGetOnlineSubsystem()
|
|
|
|
{
|
|
|
|
if (SW == None)
|
|
|
|
{
|
|
|
|
SW = OnlineSubsystemSteamworks(class'GameEngine'.static.GetOnlineSubsystem());
|
|
|
|
}
|
|
|
|
|
2021-12-26 04:18:50 +00:00
|
|
|
if (SW == None && ClientGetOnlineSubsystemRetries < MaxRetries)
|
2021-12-09 04:34:12 +00:00
|
|
|
{
|
2021-12-26 04:18:50 +00:00
|
|
|
ClientGetOnlineSubsystemRetries++;
|
|
|
|
SetTimer(TimerDelay, false, nameof(ClientGetOnlineSubsystem));
|
2021-12-09 04:34:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ClearTimer(nameof(ClientGetOnlineSubsystem));
|
2021-12-26 04:18:50 +00:00
|
|
|
if (SW != None) ClientGetMembership();
|
2021-12-09 04:34:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private reliable client function ClientGetMembership()
|
|
|
|
{
|
|
|
|
local UniqueNetId GroupID;
|
2021-12-26 04:18:50 +00:00
|
|
|
class'OnlineSubsystem'.Static.StringToUniqueNetId(GroupUIDStr, GroupID);
|
2021-12-09 04:44:41 +00:00
|
|
|
if (SW.CheckPlayerGroup(GroupID)) ServerApplyMembership();
|
2021-12-09 04:34:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private simulated reliable server function ServerApplyMembership()
|
|
|
|
{
|
2021-12-26 04:18:50 +00:00
|
|
|
if ((Mut == None || C == None) && ServerApplyMembershipRetries < MaxRetries)
|
2021-12-09 04:34:12 +00:00
|
|
|
{
|
2021-12-26 04:18:50 +00:00
|
|
|
ServerApplyMembershipRetries++;
|
|
|
|
SetTimer(TimerDelay, false, nameof(ServerApplyMembership));
|
2021-12-09 04:34:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ClearTimer(nameof(ServerApplyMembership));
|
2021-12-26 04:18:50 +00:00
|
|
|
|
|
|
|
if (Mut != None && C != None) Mut.AddMskGsMember(C);
|
2021-12-09 04:34:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DefaultProperties
|
|
|
|
{
|
|
|
|
bAlwaysRelevant = false;
|
|
|
|
bOnlyRelevantToOwner = true;
|
|
|
|
Role = ROLE_Authority;
|
|
|
|
RemoteRole = ROLE_SimulatedProxy;
|
2021-12-09 04:44:41 +00:00
|
|
|
bSkipActorPropertyReplication = false;
|
2021-12-26 04:18:50 +00:00
|
|
|
|
|
|
|
ServerApplyMembershipRetries = 0
|
|
|
|
ClientGetOnlineSubsystemRetries = 0
|
2021-12-09 04:34:12 +00:00
|
|
|
}
|