Add sound for chorus fruit teleport
[MineClone/MineClone2.git] / mods / PLAYER / mcl_player / game_api.txt
blob51c082086481a89ed464f6ffac3607ac95527713
1 Player API
2 ----------
3 This is the same as the player API from Minetest Game 0.4.16.
4 But `default` has been renamed to `mcl_player`.
6 The player API can register player models and update the player's appearence.
8 `mcl_player.player_register_model(name, def)`
10  * Register a new model to be used by players.
11  * name: model filename such as "character.x", "foo.b3d", etc.
12  * def: See [#Model definition]
14 `mcl_player.registered_player_models[name]`
16  * Get a model's definition
17  * see [#Model definition]
19 `mcl_player.player_set_model(player, model_name)`
21  * Change a player's model
22  * `player`: PlayerRef
23  * `model_name`: model registered with player_register_model()
25 `mcl_player.player_set_animation(player, anim_name [, speed])`
27  * Applies an animation to a player
28  * anim_name: name of the animation.
29  * speed: frames per second. If nil, default from the model is used
31 `mcl_player.player_set_textures(player, textures)`
33  * Sets player textures
34  * `player`: PlayerRef
35  * `textures`: array of textures, If `textures` is nil, the default textures from the model def are used
37 mcl_player.player_get_animation(player)
39  * Returns a table containing fields `model`, `textures` and `animation`.
40  * Any of the fields of the returned table may be nil.
41  * player: PlayerRef
43 ### Model Definition
45         {
46                 animation_speed = 30,            -- Default animation speed, in FPS.
47                 textures = {"character.png", },  -- Default array of textures.
48                 visual_size = {x = 1, y = 1},    -- Used to scale the model.
49                 animations = {
50                         -- <anim_name> = {x = <start_frame>, y = <end_frame>},
51                         foo = {x = 0, y = 19},
52                         bar = {x = 20, y = 39},
53                 -- ...
54                 },
55         }