-
Notifications
You must be signed in to change notification settings - Fork 0
List of callbacks
Callbacks are Lua functions that are automatically called by the engine when some conditions are met. They can also be manually called with:
world:lua_callback( entity, "callback_name" )
Be careful: some callbacks for different kind of blueprints can the same name but different arguments.
Called when the entity is created. Used to initialize the entity.
function( self )
Called when the item is attached to something
function( self, parent )
Parameters:
- parent: what it’s attached to
Called when the item is detached from something
function( self, parent )
Parameters:
- parent: what it’s detached from
Called when an entity enters the same spot. Used for elevators, portals, item acquired automatically (backpack, health orb...)
function( self, entity )
Called when an entity is on an adjacent tile.
function(self,entity,inside)
Worlds are registered with "register_world" instead of "register_blueprint"
Called when the level is cleared (when the level title turns blue)
function ( self, level )
function ( self )
Called when a being moves
function ( self, who, position )
function ( self )
function ( level, entity )
Applies to: events, …
function ( self, level, entity, reenter )
function( self, player )
function( self, player, win )
function( self, player, trait_id )
Called when the entity enters a level (only useful for the player?)
function ( self, entity, reenter )
Parameters:
- entity: the entity that enters
- reenter: boolean
Called when the user waits
function ( self, entity )
Parameters:
- entity: the entity that waits
Called when the user aims
function ( self, entity, target, weapon )
Parameters:
- entity: the user
- target: the targeted being
- weapon: the weapon the perk is on (?)
Called when the being receives damage
function ( self, source, weapon, amount )
Parameters:
- source: the unit that deals the damage?
- weapon: origin of the damage
- amount: health lost
Called when the entity is about to get damage. Useful to modify resistances before the amount of lost HP is computed
function ( self, entity, source )
Called when an action is performed on the being? (like hacking for bots)
function( self, who, level, param )
Parameters:
- who: who does the action
- level: current level
- param: ?
Called before a command is performed
function ( self, entity, command, target )
Called after a command is performed
function ( self, actor, cmt, target, time )
Parameters:
- actor: entity doing the action
- cmt: the command
- target: target of the command
- time: duration of the command?
Called when the being picks up something
function( self, what )
Parameters:
- what: what is picked up
Called when the units see something for the first time
function( self, what )
Parameters:
- what: what is seen
Called when the entity can act
function ( self, entity, time_passed, last )
Parameters:
- time_passed: in-game time since the last call
- entity: the entity this object is attached to
- last: ?
Called when the entity dies
function( self, killer, current, weapon )
Parameters:
- killer: the killer of the entity
- current: ?
- weapon: the killing weapon
Called when the unit moves
function ( self, entity )
Parameters:
- entity: ?
function ( self, user )
Called when the entity swaps weapons
function(self,entity,wpn,wpn_next)
Parameters:
- entity: the swapping entity
- wpn: previous weapon
- wpn_next: next weapon
Called when the entity kills something
function ( self, entity, target, weapon, gibbed, coord )
Parameters:
- entity: killer
- target: killed
- weapon: weapon used for killing
- gibbed: boolean
- coord: of the killed?
function ( unused, weapon, who, amount, source )
Parameters: ...
Called when the weapon is swapped out
function(self)
Called when the weapon is equipped?
function( self, entity )
Parameters:
- entity: the entity that uses the weapon
Called when it deals damage
function ( weapon, who, amount, source )
Parameters:
- who: the entity that is damaged
- amount: the amount of health dealt
- source: ?
Called when it deals damage over an area
function ( self, level, c, damage, distance )
Called when the entity is attacked
on_attacked = "aitk.on_attacked",
Called when the entity can act
on_action = "aitk.standard_ai",
Called when the entity hears a noise
on_noise = "aitk.on_noise",
Unclear when it’s called
function ( self, first )
Parameters:
- first: ?
Called when the skill is bought
function(self,entity)
Called when an active skill is used
function ( self, entity, level, target )
Only used for the frozen heart
function( self, who )
Parameters:
- who: the dropper
Only used for the frozen heart
function( self, who )
Parameters:
- who: the picker
Called when a consumable is used
function(self,entity)
Called when a unique level up.
function ( self, item )
Parameters:
- item: ?
Called when the entity wants to drop the item
function ( self, owner, confirm, pickup )
Called when the entity wants to pick up an item
function( self, player, item )