Late Loading
To support lade loading, modules will need to replay essential events that were fired before they were loaded. SourceMod already handles the basic stuff like OnMapStart, OnConfigsExecuted, OnClientConnected and others, but some custom zombie events must be replayed too.
This is not a responsibility for the event manager, but individual feature modules. The event manager don't know which events to forward.
I'm thinking of creating a new event in the module manager for notifying modules that a module was late loaded. The module manager itself can't detect it either (or maybe shouldn't), so it should provide a native where late loaded modules can notify the module manager themselves that they were late loaded. The module manager will then send the event so feature modules can replay events.
The tricky part is to replay essential events only for late loaded modules. This might imply that the event manager must support filtered events, so it can send an event to certain modules only. Forwards won't work for this, since they're global. We have to use callbacks and let feature modules fire individual events to a specific module. The module ID is passed as a parameter in the late load event.
Edit: Forwards may still work, since I didn't know about
private forwards. The code will run a lot more efficient if we delegate most of the work to SourceMod.
Essential events to replay in the Zombie API (so far):
- OnGameModeActivated - Lets the module initialize according to a certain game mode. More about game modes some other time.
- OnPlayerTeam
- OnRoundStart, OnRoundFreezeEnd - If it has started.
- OnPlayerSpawn, OnPlayerSpawnPost
- OnClientZombie, OnClientHuman - Tricky, some players may be dead or haven't spawned yet. Actual conditions for when these are fired are not completely defined yet.
Note that the event names are just examples.
__________________