Currently, Minetest has on_activate, on_step, on_punch, and on_rightclick.
Additional callbacks that are useful are:
- on_collide_node(dir) - When an entity hits a wall. Useful for projectiles (arrows, or bombs that explode on contact). dir = collision direction (bottom, north, top, ...)
- on_collide_object(obj) - When an entity touches/hits another entity. Only for entities with physical = true. Useful for projectiles.
- on_remove() - When an entity is removed. (by object:remove or by the engine (as in too many objects))
- on_death() - When an entity dies. (by obj:punch or obj:set_hp)
- on_deactivate() - Opposite of activate
- on_create() - Maybe this is redundant
In the current state of the engine, these (except on_remove) can be done in Lua, by adding code into the on_step function (on_punch for on_death). But it is better (and faster) if these are called by the engine, because the calculations are already done by the engine.
PS
Another thing I wish to be added to the engine
- get_standing() - Whether the entity is on the ground. Very useful for mobs code.