init.lua 899 B

12345678910111213141516171819202122232425262728
  1. dofile(minetest.get_modpath("player_api") .. "/api.lua")
  2. -- Default player appearance
  3. player_api.register_model("character.b3d", {
  4. animation_speed = 30,
  5. textures = {"character.png", },
  6. animations = {
  7. -- Standard animations.
  8. stand = { x= 0, y= 79, },
  9. lay = { x=162, y=166, },
  10. walk = { x=168, y=187, },
  11. mine = { x=189, y=198, },
  12. walk_mine = { x=200, y=219, },
  13. sit = { x= 81, y=160, },
  14. },
  15. collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.77, 0.3},
  16. })
  17. -- Update appearance when the player joins
  18. minetest.register_on_joinplayer(function(player)
  19. player_api.player_attached[player:get_player_name()] = false
  20. player_api.set_model(player, "character.b3d")
  21. player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
  22. player:hud_set_hotbar_image("gui_hotbar.png")
  23. player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
  24. end)