Remove segmentation of limbs, because I don't like how the arms appeared to shrink...
[oweals/minetest_game.git] / mods / default / player.lua
1 -- Minetest 0.4 mod: player
2 -- See README.txt for licensing and other information.
3
4 -- The API documentation in here was moved into doc/lua_api.txt
5
6 -- Default animation speed. Special animations (such as the walk animation) should be offset from this factor
7 animation_speed = 30
8
9 -- Animation blending / transitioning amount
10 animation_blend = 0
11
12 -- Animations frame ranges:
13 animation_stand_START = 0
14 animation_stand_END = 79
15 animation_walk_forward_START = 81
16 animation_walk_forward_END = 100
17 animation_walk_backward_START = 102
18 animation_walk_backward_END = 121
19 animation_walk_right_START = 123
20 animation_walk_right_END = 142
21 animation_walk_left_START = 144
22 animation_walk_left_END = 163
23 animation_mine_START = 165
24 animation_mine_END = 179
25
26 -- Set mesh for all players
27 function switch_player_visual()
28         prop = {
29                 mesh = "character.x",
30                 textures = {"character.png", },
31                 visual = "mesh",
32                 visual_size = {x=1, y=1},
33         }
34
35         for _, obj in pairs(minetest.get_connected_players()) do
36                 obj:set_properties(prop)
37                 obj:set_animation({x=animation_stand_START, y=animation_stand_END}, animation_speed, animation_blend)
38         end
39
40         minetest.after(10.0, switch_player_visual)
41 end
42 minetest.after(10.0, switch_player_visual)
43
44 -- Definitions made by this mod that other mods can use too
45 default = {}
46
47 -- Load other files
48 dofile(minetest.get_modpath("default").."/mapgen.lua")
49 dofile(minetest.get_modpath("default").."/leafdecay.lua")
50
51 -- END