KF2-ZedSpawner/ZedSpawner/Classes/ZedSpawnerRepInfo.uc

73 lines
1.3 KiB
Ucode
Raw Normal View History

2022-08-30 05:39:34 +00:00
class ZedSpawnerRepInfo extends ReplicationInfo;
2022-05-13 07:02:34 +00:00
var public ZedSpawner ZS;
var public E_LogLevel LogLevel;
var public Array<class<KFPawn_Monster> > CustomZeds;
var private int Recieved;
2022-05-13 07:02:34 +00:00
replication
{
if (bNetInitial && Role == ROLE_Authority)
LogLevel;
}
public simulated function bool SafeDestroy()
{
return (bPendingDelete || bDeleteMe || Destroy());
}
2022-05-20 20:45:26 +00:00
2022-05-13 07:02:34 +00:00
public reliable client function ClientSync(class<KFPawn_Monster> CustomZed)
{
2022-07-19 10:28:43 +00:00
`Log_Trace();
2022-05-13 07:02:34 +00:00
2022-07-13 07:00:06 +00:00
`Log_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-07-19 10:28:43 +00:00
`Log_Trace();
2022-05-13 07:02:34 +00:00
foreach CustomZeds(CustomZed)
{
2022-07-13 07:00:06 +00:00
`Log_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-07-19 10:28:43 +00:00
`Log_Trace();
2022-05-13 07:02:34 +00:00
if (bPendingDelete || bDeleteMe) return;
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-07-13 07:00:06 +00:00
`Log_Debug("Sync finished");
2022-05-13 07:02:34 +00:00
SyncFinished();
2022-08-30 05:39:34 +00:00
if (!ZS.DestroyRepInfo(Controller(Owner)))
{
SafeDestroy();
}
2022-05-13 07:02:34 +00:00
}
else
{
2022-07-13 07:00:06 +00:00
`Log_Debug("Sync:" @ CustomZeds[Recieved]);
2022-05-13 07:02:34 +00:00
ClientSync(CustomZeds[Recieved++]);
}
}
defaultproperties
{
bAlwaysRelevant = false;
bOnlyRelevantToOwner = true;
bSkipActorPropertyReplication = false;
Recieved = 0
}