This wiki is archived and useful information is being migrated to the main bzflag.org website
Editing Events (API)
Warning: The database has been locked for maintenance, so you will not be able to save your edits right now. You may wish to copy and paste your text into a text file and save it for later.
The administrator who locked it offered this explanation: Archived wiki
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | {{ | + | {{DoDoc|Fill in articles for all API events}} |
+ | |||
+ | {{BZFS_API_Doc}} | ||
+ | |||
==Overview== | ==Overview== | ||
API events are callbacks that a [[Plug-ins|plug-in]] can install into [[BZFS]] to be called in response to specific actions or state changes in the server side game world. Events are the primary method of communication from BZFS to installed plug-ins. Specific events exist for nearly all logical actions that can happen during a game of BZFlag. | API events are callbacks that a [[Plug-ins|plug-in]] can install into [[BZFS]] to be called in response to specific actions or state changes in the server side game world. Events are the primary method of communication from BZFS to installed plug-ins. Specific events exist for nearly all logical actions that can happen during a game of BZFlag. | ||
==Installation and Removal== | ==Installation and Removal== | ||
− | The callbacks for events are typically installed during the [[bz_Load]] | + | The callbacks for events are typically installed during the [[bz_Load]] entry point in a plug-in, so they can be active when a plug-in is first loaded. |
The plug-in must call the function; | The plug-in must call the function; | ||
− | |||
BZF_API bool [[bz_registerEvent]] ( bz_eEventType eventType, [[bz_EventHandler]]* eventHandler ); | BZF_API bool [[bz_registerEvent]] ( bz_eEventType eventType, [[bz_EventHandler]]* eventHandler ); | ||
− | + | The plug-in registers and event callback derived from [[bz_EventHandler]] for each specific event types it wishes to monitor. | |
− | + | ||
− | + | When a plug-in no longer needs to monitor an event, or when it is unloaded in the [[bz_Unload]] entry point, the plug-in must remove the installed callback by calling the function; | |
− | |||
− | |||
− | |||
BZF_API bool [[bz_removeEvent]] ( bz_eEventType eventType, [[bz_EventHandler]]* eventHandler ); | BZF_API bool [[bz_removeEvent]] ( bz_eEventType eventType, [[bz_EventHandler]]* eventHandler ); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
==Event Handler== | ==Event Handler== | ||
− | The plug-in must define a class that is derived from [[bz_EventHandler]] | + | The plug-in must define a class that is derived from [[bz_EventHandler]] and pass a pointer to an object of that class when ever it registers an event callback. |
− | When ever a specific event is triggered, BZFS will call the 'process' | + | When ever a specific event is triggered, BZFS will call the 'process' method of the installed callback class. |
− | |||
virtual void process ( bz_EventData *eventData ) = 0; | virtual void process ( bz_EventData *eventData ) = 0; | ||
− | |||
− | |||
− | |||
==Event Data== | ==Event Data== | ||
Line 47: | Line 36: | ||
==Events== | ==Events== | ||
− | The following list contains all the event types currently supported by BZFS version 2. | + | The following list contains all the event types currently supported by BZFS version 2.1 |
− | [[ | + | [[bz_eNullEvent]] |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
[[bz_eCaptureEvent]] | [[bz_eCaptureEvent]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[bz_ePlayerDieEvent]] | [[bz_ePlayerDieEvent]] | ||
+ | [[bz_ePlayerSpawnEvent]] | ||
+ | [[bz_eZoneEntryEvent]] | ||
+ | [[bz_eZoneExitEvent]] | ||
[[bz_ePlayerJoinEvent]] | [[bz_ePlayerJoinEvent]] | ||
[[bz_ePlayerPartEvent]] | [[bz_ePlayerPartEvent]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[bz_eRawChatMessageEvent]] | [[bz_eRawChatMessageEvent]] | ||
− | [[ | + | [[bz_eFilteredChatMessageEvent]] |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
[[bz_eUnknownSlashCommand]] | [[bz_eUnknownSlashCommand]] | ||
− | [[ | + | [[bz_eGetPlayerSpawnPosEvent]] |
− | [[ | + | [[bz_eGetAutoTeamEvent]] |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
[[bz_eAllowPlayer]] | [[bz_eAllowPlayer]] | ||
− | [[ | + | [[bz_eTickEvent]] |
+ | [[bz_eGetWorldEvent]] | ||
+ | [[bz_eGetPlayerInfoEvent]] | ||
[[bz_eAllowSpawn]] | [[bz_eAllowSpawn]] | ||
+ | [[bz_eListServerUpdateEvent]] | ||
[[bz_eBanEvent]] | [[bz_eBanEvent]] | ||
− | [[ | + | [[bz_eHostBanEvent]] |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
[[bz_eKickEvent]] | [[bz_eKickEvent]] | ||
[[bz_eKillEvent]] | [[bz_eKillEvent]] | ||
− | [[ | + | [[bz_ePlayerPausedEvent]] |
− | + | ||
− | + | ||
[[bz_eMessageFilteredEvent]] | [[bz_eMessageFilteredEvent]] | ||
− | [[ | + | [[bz_eGameStartEvent]] |
− | [[ | + | [[bz_eGameEndEvent]] |
− | [[ | + | [[bz_eSlashCommandEvent]] |
[[bz_ePlayerAuthEvent]] | [[bz_ePlayerAuthEvent]] | ||
− | [[ | + | [[bz_eServerMsgEvent]] |
− | [[ | + | [[bz_eShotFiredEvent]] |
− | [[ | + | [[bz_eAnointRabbitEvent]] |
− | [[ | + | [[bz_eNewRabbitEvent]] |
− | [[ | + | [[bz_eReloadEvent]] |
− | + | ||
[[bz_ePlayerUpdateEvent]] | [[bz_ePlayerUpdateEvent]] | ||
− | [[ | + | [[bz_eNetDataSendEvent]] |
− | [[ | + | [[bz_eNetDataReceveEvent]] |
− | [[ | + | [[bz_eLoggingEvent]] |
− | [[ | + | [[bz_eFlagTransferredEvent]] |
− | [[ | + | [[bz_eFlagGrabbedEvent]] |
− | [[ | + | [[bz_eFlagDroppedEvent]] |
− | + | ||
− | + | ||
− | + | ||
[[bz_eShotEndedEvent]] | [[bz_eShotEndedEvent]] | ||
− | [[ | + | [[bz_eNewNonPlayerConnection]] |
− | [[ | + | [[bz_eIdleNewNonPlayerConnection]] |
− | [[ | + | [[bz_ePlayerCollision]] |
− | [[ | + | [[bz_eFlagResetEvent]] |
− | + | ||
[[bz_eWorldFinalized]] | [[bz_eWorldFinalized]] | ||
− | [[ | + | [[bz_eAllowCTFCaptureEvent]] |
− | + | ||
There exists one additional event in the 'bz_eEventType' enumeration in 'bzfsAPI.h', ''bz_eLastEvent''. This event is simply used by BZFS to assist in the counting of the total number of events, it will never be called and can not be installed. | There exists one additional event in the 'bz_eEventType' enumeration in 'bzfsAPI.h', ''bz_eLastEvent''. This event is simply used by BZFS to assist in the counting of the total number of events, it will never be called and can not be installed. | ||
− | == See also == | + | ==See also== |
− | + | [[BZFS API]] | |
− | + | ||
− | + | [[plug-ins]] | |
− | [[Category: | + | [[Category:BZFS_API_Events]] |