--- The API documentation in here was moved into doc/lua_api.txt
-
--- Default animation speed. Special animations (such as the walk animation) should be offset from this factor
-animation_speed = 30
-
--- Animation blending / transitioning amount
-animation_blend = 0
-
--- Animations frame ranges:
-animation_stand_START = 0
-animation_stand_END = 79
-animation_walk_forward_START = 81
-animation_walk_forward_END = 100
-animation_walk_backward_START = 102
-animation_walk_backward_END = 121
-animation_walk_right_START = 123
-animation_walk_right_END = 142
-animation_walk_left_START = 144
-animation_walk_left_END = 163
-animation_mine_START = 165
-animation_mine_END = 179
-
--- Set mesh for all players
-function switch_player_visual()
- prop = {
- mesh = "character.x",
- textures = {"character.png", },
- visual = "mesh",
- visual_size = {x=1, y=1},
+-- Player animation blending
+-- Note: This is currently broken due to a bug in Irrlicht, leave at 0
+local animation_blend = 0
+
+default.registered_player_models = { }
+
+-- Local for speed.
+local models = default.registered_player_models
+
+function default.player_register_model(name, def)
+ models[name] = def
+end
+
+-- Default player appearance
+default.player_register_model("character.b3d", {
+ animation_speed = 30,
+ textures = {"character.png", },
+ animations = {
+ -- Standard animations.
+ stand = { x= 0, y= 79, },
+ lay = { x=162, y=166, },
+ walk = { x=168, y=187, },
+ mine = { x=189, y=198, },
+ walk_mine = { x=200, y=219, },
+ -- Extra animations (not currently used by the game).
+ sit = { x= 81, y=160, },
+ },
+})
+
+-- Player stats and animations
+local player_model = {}
+local player_textures = {}
+local player_anim = {}
+local player_sneak = {}
+default.player_attached = {}
+
+function default.player_get_animation(player)
+ local name = player:get_player_name()
+ return {
+ model = player_model[name],
+ textures = player_textures[name],
+ animation = player_anim[name],