init.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. -- Minetest 0.4 mod: default
  2. -- See README.txt for licensing and other information.
  3. -- The API documentation in here was moved into game_api.txt
  4. -- Load support for MT game translation.
  5. local S = minetest.get_translator("default")
  6. -- Definitions made by this mod that other mods can use too
  7. default = {}
  8. default.LIGHT_MAX = 14
  9. default.get_translator = S
  10. -- GUI related stuff
  11. minetest.register_on_joinplayer(function(player)
  12. -- Set formspec prepend
  13. local formspec = [[
  14. bgcolor[#080808BB;true]
  15. listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF] ]]
  16. local name = player:get_player_name()
  17. local info = minetest.get_player_information(name)
  18. if info.formspec_version > 1 then
  19. formspec = formspec .. "background9[5,5;1,1;gui_formbg.png;true;10]"
  20. else
  21. formspec = formspec .. "background[5,5;1,1;gui_formbg.png;true]"
  22. end
  23. player:set_formspec_prepend(formspec)
  24. -- Set hotbar textures
  25. player:hud_set_hotbar_image("gui_hotbar.png")
  26. player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
  27. end)
  28. function default.get_hotbar_bg(x,y)
  29. local out = ""
  30. for i=0,7,1 do
  31. out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]"
  32. end
  33. return out
  34. end
  35. default.gui_survival_form = "size[8,8.5]"..
  36. "list[current_player;main;0,4.25;8,1;]"..
  37. "list[current_player;main;0,5.5;8,3;8]"..
  38. "list[current_player;craft;1.75,0.5;3,3;]"..
  39. "list[current_player;craftpreview;5.75,1.5;1,1;]"..
  40. "image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
  41. "listring[current_player;main]"..
  42. "listring[current_player;craft]"..
  43. default.get_hotbar_bg(0,4.25)
  44. -- Load files
  45. local default_path = minetest.get_modpath("default")
  46. dofile(default_path.."/functions.lua")
  47. dofile(default_path.."/trees.lua")
  48. dofile(default_path.."/nodes.lua")
  49. dofile(default_path.."/chests.lua")
  50. dofile(default_path.."/furnace.lua")
  51. dofile(default_path.."/torch.lua")
  52. dofile(default_path.."/tools.lua")
  53. dofile(default_path.."/item_entity.lua")
  54. dofile(default_path.."/craftitems.lua")
  55. dofile(default_path.."/crafting.lua")
  56. dofile(default_path.."/mapgen.lua")
  57. dofile(default_path.."/aliases.lua")
  58. dofile(default_path.."/legacy.lua")