KF2-ZedSpawner/ZedSpawner/Classes/ZedSpawnerRepLink.uc
GenZmeY 90a69ef739 ...
- now the type of unit affects the choice of spawn location
- bSpawnAtPlayerStart removed from spawn list
- SpawnAtPlayerStart can be set separately for specified maps or zed classes
- optimized spawn list loading
- added handling of the situation when the player leaves the game before preloadcontent synchronization ends
- fixed calculation of the number of zeds in some cases
2022-06-13 17:07:55 +03:00

74 lines
1.4 KiB
Ucode

class ZedSpawnerRepLink extends ReplicationInfo;
var public ZedSpawner ZS;
var public E_LogLevel LogLevel;
var public Array<class<KFPawn_Monster> > CustomZeds;
var private int Recieved;
replication
{
if (bNetInitial && Role == ROLE_Authority)
LogLevel;
}
public simulated function bool SafeDestroy()
{
`ZS_Debug(`Location @ "bPendingDelete:" @ bPendingDelete @ "bDeleteMe" @ bDeleteMe);
return (bPendingDelete || bDeleteMe || Destroy());
}
public reliable client function ClientSync(class<KFPawn_Monster> CustomZed)
{
`ZS_Trace(`Location);
`ZS_Debug("Received:" @ CustomZed);
CustomZeds.AddItem(CustomZed);
ServerSync();
}
public reliable client function SyncFinished()
{
local class<KFPawn_Monster> CustomZed;
`ZS_Trace(`Location);
foreach CustomZeds(CustomZed)
{
`ZS_Debug("Preload Content for" @ CustomZed);
CustomZed.static.PreloadContent();
}
SafeDestroy();
}
public reliable server function ServerSync()
{
`ZS_Trace(`Location);
if (bPendingDelete || bDeleteMe) return;
if (CustomZeds.Length == Recieved || WorldInfo.NetMode == NM_StandAlone)
{
`ZS_Debug("Sync finished");
SyncFinished();
if (!ZS.DestroyRepLink(Controller(Owner)))
{
SafeDestroy();
}
}
else
{
`ZS_Debug("Sync:" @ CustomZeds[Recieved]);
ClientSync(CustomZeds[Recieved++]);
}
}
defaultproperties
{
bAlwaysRelevant = false;
bOnlyRelevantToOwner = true;
bSkipActorPropertyReplication = false;
Recieved = 0
}