|
1 | 1 | -- Minetest 0.4 mod: player
|
2 | 2 | -- See README.txt for licensing and other information.
|
3 | 3 |
|
4 |
| ---[[ |
5 |
| -
|
6 |
| -API |
7 |
| ---- |
8 |
| -
|
9 |
| -default.player_register_model(name, def) |
10 |
| -^ Register a new model to be used by players. |
11 |
| -^ <name> is the model filename such as "character.x", "foo.b3d", etc. |
12 |
| -^ See Model Definition below for format of <def>. |
13 |
| -
|
14 |
| -default.registered_player_models[name] |
15 |
| -^ See Model Definition below for format. |
16 |
| -
|
17 |
| -default.player_set_model(player, model_name) |
18 |
| -^ <player> is a PlayerRef. |
19 |
| -^ <model_name> is a model registered with player_register_model. |
20 |
| -
|
21 |
| -default.player_set_animation(player, anim_name [, speed]) |
22 |
| -^ <player> is a PlayerRef. |
23 |
| -^ <anim_name> is the name of the animation. |
24 |
| -^ <speed> is in frames per second. If nil, default from the model is used |
25 |
| -
|
26 |
| -default.player_set_textures(player, textures) |
27 |
| -^ <player> is a PlayerRef. |
28 |
| -^ <textures> is an array of textures |
29 |
| -^ If <textures> is nil, the default textures from the model def are used |
30 |
| -
|
31 |
| -default.player_get_animation(player) |
32 |
| -^ <player> is a PlayerRef. |
33 |
| -^ Returns a table containing fields "model", "textures" and "animation". |
34 |
| -^ Any of the fields of the returned table may be nil. |
35 |
| -
|
36 |
| -Model Definition |
37 |
| ----------------- |
38 |
| -
|
39 |
| -model_def = { |
40 |
| - animation_speed = 30, -- Default animation speed, in FPS. |
41 |
| - textures = {"character.png", }, -- Default array of textures. |
42 |
| - visual_size = {x=1, y=1,}, -- Used to scale the model. |
43 |
| - animations = { |
44 |
| - -- <anim_name> = { x=<start_frame>, y=<end_frame>, }, |
45 |
| - foo = { x= 0, y=19, }, |
46 |
| - bar = { x=20, y=39, }, |
47 |
| - -- ... |
48 |
| - }, |
49 |
| -} |
50 |
| -
|
51 |
| -]] |
52 |
| - |
53 | 4 | -- Player animation blending
|
54 | 5 | -- Note: This is currently broken due to a bug in Irrlicht, leave at 0
|
55 | 6 | local animation_blend = 0
|
|
0 commit comments