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