mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-21 06:43:17 -04:00
Add documentation
This commit is contained in:
parent
ca97ea92ec
commit
930b0f1eee
2 changed files with 14 additions and 14 deletions
26
game_api.txt
26
game_api.txt
|
@ -445,13 +445,13 @@ The player API can register player models and update the player's appearance.
|
||||||
* `player_api.set_model(player, model_name)`
|
* `player_api.set_model(player, model_name)`
|
||||||
* Change a player's model
|
* Change a player's model
|
||||||
* `player`: PlayerRef
|
* `player`: PlayerRef
|
||||||
* `model_name`: model registered with player_api.register_model()
|
* `model_name`: model registered with `player_api.register_model`
|
||||||
|
|
||||||
* `player_api.set_animation(player, anim_name, speed)`
|
* `player_api.set_animation(player, anim_name, speed)`
|
||||||
* Applies an animation to a player
|
* Applies an animation to a player if speed or anim_name differ from the currently playing animation
|
||||||
* `player`: PlayerRef
|
* `player`: PlayerRef
|
||||||
* `anim_name`: name of the animation
|
* `anim_name`: name of the animation
|
||||||
* `speed`: frames per second. If nil, the default from the model def is used
|
* `speed`: keyframes per second. If nil, the default from the model def is used
|
||||||
|
|
||||||
* `player_api.set_textures(player, textures)`
|
* `player_api.set_textures(player, textures)`
|
||||||
* Sets player textures
|
* Sets player textures
|
||||||
|
@ -473,18 +473,18 @@ The player API can register player models and update the player's appearance.
|
||||||
### Model Definition
|
### Model Definition
|
||||||
|
|
||||||
{
|
{
|
||||||
animation_speed = 30, -- Default animation speed, in FPS
|
animation_speed = 30, -- Default animation speed, in keyframes per second
|
||||||
textures = {"character.png", }, -- Default array of textures
|
textures = {"character.png"}, -- Default array of textures
|
||||||
visual_size = {x = 1, y = 1}, -- Used to scale the model
|
|
||||||
animations = {
|
animations = {
|
||||||
-- <anim_name> = {x = <start_frame>, y = <end_frame>},
|
-- [anim_name] = {x = <start_frame>, y = <end_frame>, collisionbox = default collisionbox, eye_height = default eye height},
|
||||||
foo = {x = 0, y = 19},
|
stand = ..., lay = ..., walk = ..., mine = ..., walk_mine = ..., -- required animations
|
||||||
bar = {x = 20, y = 39},
|
sit = ... -- used by boats and other MTG mods
|
||||||
-- ...
|
|
||||||
},
|
},
|
||||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}, -- In nodes from feet position
|
-- Default object properties, see lua_api.txt
|
||||||
stepheight = 0.6, -- In nodes
|
visual_size = {x = 1, y = 1},
|
||||||
eye_height = 1.47, -- In nodes above feet position
|
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
||||||
|
stepheight = 0.6,
|
||||||
|
eye_height = 1.47
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
name = player_api
|
name = player_api
|
||||||
description = Minetest Game mod: player_api
|
description = Minetest Game mod: Manages player visuals
|
||||||
|
|
Loading…
Add table
Reference in a new issue