KF2-MSK-GS/MskGs/Classes/MskGsRepInfo.uc

66 lines
1.3 KiB
Ucode
Raw Normal View History

2021-12-09 04:34:12 +00:00
class MskGsRepInfo extends ReplicationInfo;
// Server vars
var public MskGsMut Mut;
var public Controller C;
// Client vars
var private OnlineSubsystemSteamworks SW;
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());
}
if (SW == None)
{
SetTimer(0.1f, false, nameof(ClientGetOnlineSubsystem));
}
else
{
ClearTimer(nameof(ClientGetOnlineSubsystem));
ClientGetMembership();
}
}
private reliable client function ClientGetMembership()
{
local UniqueNetId GroupID;
class'OnlineSubsystem'.Static.StringToUniqueNetId("0x017000000223386E", 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()
{
if (Mut == None || C == None)
{
SetTimer(1.0f, false, nameof(ServerApplyMembership));
return;
}
ClearTimer(nameof(ServerApplyMembership));
Mut.MskGsMemberList.AddItem(C);
}
DefaultProperties
{
bAlwaysRelevant = false;
bOnlyRelevantToOwner = true;
Role = ROLE_Authority;
RemoteRole = ROLE_SimulatedProxy;
2021-12-09 04:44:41 +00:00
bSkipActorPropertyReplication = false;
2021-12-09 04:34:12 +00:00
}