2012-10-24 14:23:45 +02:00
|
|
|
-- Minetest 0.4 mod: player
|
|
|
|
-- See README.txt for licensing and other information.
|
|
|
|
|
|
|
|
-- The API documentation in here was moved into doc/lua_api.txt
|
|
|
|
|
2012-11-14 20:31:55 +01:00
|
|
|
-- 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
|
|
|
|
|
2012-10-24 14:23:45 +02:00
|
|
|
-- Set mesh for all players
|
|
|
|
function switch_player_visual()
|
|
|
|
prop = {
|
2012-11-15 15:09:39 +01:00
|
|
|
mesh = "character.x",
|
|
|
|
textures = {"character.png", },
|
2012-10-24 22:12:03 +02:00
|
|
|
visual = "mesh",
|
|
|
|
visual_size = {x=1, y=1},
|
2012-10-24 14:23:45 +02:00
|
|
|
}
|
2012-11-15 15:09:39 +01:00
|
|
|
|
2012-10-24 14:23:45 +02:00
|
|
|
for _, obj in pairs(minetest.get_connected_players()) do
|
|
|
|
obj:set_properties(prop)
|
2012-11-15 15:09:39 +01:00
|
|
|
obj:set_animation({x=animation_stand_START, y=animation_stand_END}, animation_speed, animation_blend)
|
2012-10-24 22:12:03 +02:00
|
|
|
end
|
|
|
|
|
2012-11-14 20:31:55 +01:00
|
|
|
minetest.after(10.0, switch_player_visual)
|
2012-10-24 22:12:03 +02:00
|
|
|
end
|
2012-11-14 20:31:55 +01:00
|
|
|
minetest.after(10.0, switch_player_visual)
|
2012-10-24 22:12:03 +02:00
|
|
|
|
2012-10-24 14:23:45 +02:00
|
|
|
-- Definitions made by this mod that other mods can use too
|
|
|
|
default = {}
|
|
|
|
|
|
|
|
-- Load other files
|
|
|
|
dofile(minetest.get_modpath("default").."/mapgen.lua")
|
|
|
|
dofile(minetest.get_modpath("default").."/leafdecay.lua")
|
|
|
|
|
|
|
|
-- END
|