KF2-ZedSpawner/ZedSpawner/Classes/ZedSpawnerRepLink.uc

64 lines
1.2 KiB
Ucode
Raw Normal View History

2022-05-13 07:02:34 +00:00
class ZedSpawnerRepLink extends ReplicationInfo;
var public E_LogLevel LogLevel;
var public Array<class<KFPawn_Monster> > CustomZeds;
var private int Recieved;
replication
{
if (bNetInitial && Role == ROLE_Authority)
LogLevel;
}
2022-05-20 20:45:26 +00:00
public simulated function bool SafeDestroy() { if (!bPendingDelete) return Destroy(); else return true; }
2022-05-13 07:02:34 +00:00
public reliable client function ClientSync(class<KFPawn_Monster> CustomZed)
{
2022-05-17 09:56:31 +00:00
`ZS_Trace(`Location);
2022-05-13 07:02:34 +00:00
2022-05-17 09:56:31 +00:00
`ZS_Debug("Received:" @ CustomZed);
2022-05-13 07:02:34 +00:00
CustomZeds.AddItem(CustomZed);
ServerSync();
}
public reliable client function SyncFinished()
{
local class<KFPawn_Monster> CustomZed;
2022-05-17 09:56:31 +00:00
`ZS_Trace(`Location);
2022-05-13 07:02:34 +00:00
foreach CustomZeds(CustomZed)
{
2022-05-17 09:56:31 +00:00
`ZS_Debug("Preload Content for" @ CustomZed);
2022-05-13 07:02:34 +00:00
CustomZed.static.PreloadContent();
}
2022-05-20 20:45:26 +00:00
SafeDestroy();
2022-05-13 07:02:34 +00:00
}
public reliable server function ServerSync()
{
2022-05-17 09:56:31 +00:00
`ZS_Trace(`Location);
2022-05-13 07:02:34 +00:00
2022-05-20 20:45:26 +00:00
if (CustomZeds.Length == Recieved || WorldInfo.NetMode == NM_StandAlone)
2022-05-13 07:02:34 +00:00
{
2022-05-17 09:56:31 +00:00
`ZS_Debug("Sync finished");
2022-05-13 07:02:34 +00:00
SyncFinished();
2022-05-20 20:45:26 +00:00
SafeDestroy();
2022-05-13 07:02:34 +00:00
}
else
{
2022-05-17 09:56:31 +00:00
`ZS_Debug("Sync:" @ CustomZeds[Recieved]);
2022-05-13 07:02:34 +00:00
ClientSync(CustomZeds[Recieved++]);
}
}
defaultproperties
{
bAlwaysRelevant = false;
bOnlyRelevantToOwner = true;
bSkipActorPropertyReplication = false;
Recieved = 0
}