-
Notifications
You must be signed in to change notification settings - Fork 0
EntryPointFunction
A lot of the wrapping ACE does for modules is in generating a complete entry point function. This page documents the order of operations generated for each phase.
Gracefully failing refers to calling unload-last (or detach-last) code before failing.
The variables _action, _mm, and arena are defined as parameters to the entry point function. These variables are available during extra-code blocks. _ad may also be defined on attach/detach blocks. 'arena' is only one of these supported for long-term use, and only during extra-attach and extra-detach blocks.
#Obtain the I_LOGMAN// interface and store it in the global //lm. Fail immediately if it could not be obtained. #Obtain each of the required global dependency interfaces. If any one can not be obtained, gracefully fail. #Obtain each of the optional global dependency interfaces. #If per-arena-data is defined, register it. If it could not be registered, gracefully fail. #If per-player-data is defined, register it. If it could not be registered, gracefully fail. #Execute all extra load-first code.
#Create a recursive mutex for the module if a $lock() appeared in the module. #Register all global callbacks. #Register all global advisers. #Register all global commands. #Execute all extra load-last code. #Register all global interface implementations.
#Unregister all global interfaces. If one fails to unregister (due to still being held by another module), fail. If multiple interfaces are registered, and some succeed to unregister but others don't, they will not be registered, which will leave the module in a weird partially functional state. This can be averted by only implementing one interface in your module (as most modules do.) #Execute all extra unload-first code. #Unregister all global commands. #Unregister all global advisers. #Unregister all global callbacks. #Destroy the module mutex if one was used.
#Execute all extra unload-last code. #Unregister any per-player-data. #Unregister any per-arena-data. #Release all optional global dependency interfaces. #Release all required global dependency interfaces (including lm.)
(Only used if there is anything defined on the arena scope)
The variable "arena" is supported on extra-attach blocks.
#Allocate dynamic per-arena-data if necessary. #Obtain each of the required arena dependency interfaces. If any one can not be obtained, gracefully fail. #Obtain each of the optional arena dependency interfaces. #Execute all extra attach-first code.
#Register any internal callback functions necessary for the arena. #Allocate dynamic per-player-data for the arena if necessary. #Register all arena callbacks. #Register all arena advisers. #Register all arena commands. #Execute all extra attach-last code. #Register all arena interface implementations.
(Only used if Attach phase is used)
The variable "arena" is supported on extra-attach blocks.
#Unregister all arena interfaces. If one fails to unregister (due to still being held by another module), fail. If multiple interfaces are registered, and some succeed to unregister but others don't, they will not be registered, which will leave the module in a weird partially functional state. This can be averted by only implementing one interface in your module (as most modules do.) #Execute all extra detach-first code. #Unregister all arena commands. #Unregister all arena advisers. #Unregister all arena callbacks. #Unregister any internal callback functions necessary for the arena. #Free dynamic per-player-data for the arena if necessary.
#Execute all extra detach-last code. #Release all optional arena dependency interfaces. #Release all required arena dependency interfaces. #Free dynamic per-arena-data if necessary.