-
Notifications
You must be signed in to change notification settings - Fork 42
Default Game Events
Below is the listing of default game events for RockMUD core. To understand the event system please read Building with Behaviors and AI.
Each event fires at a specific time; however, onAlive() can be considered the generic heartbeat AI check. By default onAlive() fires every 700 milliseconds.
##Area events## These are typically setup or persistence related:
###afterLoaded()### When the area is fully loaded on initial boot. This means the items and mobs are rolled and in their final place.
###onReloaded()### When the area respawns.
###beforeSave()### If the area is persisted this runs before it saves
###onDay(area)### When the MUD switches from night to day.
###onNight(area)### When the MUD switches from day to night.
##Player Events## Player events can be attached to any game entity. Both game creatures and players.
###onAlive(gameEntity, roomObj)### Fires every 700 milliseconds. RockMUD limits player onAlive() events from running 50% of the time. You can change this in ticks.js.
###onCommand(player, roomObj, command)### Fired on each entered command from a player. This is limited to players only. In-game mobs currently cannot leverage onCommand() or onSkill().
###onSkill(player, roomObj, skillObj)### Fired when a player uses a skill. This does not fire when passives are checked; just when a player uses a skill. Casting spells will not trigger this event.
###onSpell(gameEntity, roomObj, skillObj)### Fired when something casts a spell via cast, brandish, recite, etc.
###beforeSell(gameEntity, roomObj, entityRequestingItem)### Fired when the gameEntity is called on to sell something. Must return true or the command will fail silently.
###onSell(gameEntity, roomObj, entityRequestingItem, item)### Fired when the gameEntity sells something.
###onBuy### ###beforeMove### ###onMove### ###onVisit### ###onWear### ###onRemove### ###onGet### ###onGive### ###onDrop### ###onSay### ###onHunger### ###onThirst### ###onAttacked### ###onCrit### ###onRound### ###onWin### ###onDeath### ###onFlee### ###onOpponentFlee### ###onSkil### ###onTired### ###onCommand### ###onSkill### ###onSpell###
##Item events## These events are specific to game items. ###onPut### ###beforeDrop### ###onDrop### ###beforeWear### ###onWear### ###onHit### ###onCrit### ###beforeRemove### ###onRemove###