57 lines
1.6 KiB
Lua
57 lines
1.6 KiB
Lua
local S = minetest.get_translator("lzr_gui")
|
|
local F = minetest.formspec_escape
|
|
|
|
lzr_gui = {}
|
|
|
|
local hud_ids = {}
|
|
|
|
lzr_gui.set_play_gui = function(player)
|
|
player:hud_set_hotbar_itemcount(3)
|
|
player:hud_set_hotbar_image("lzr_gui_hotbar_3.png")
|
|
local name = player:get_player_name()
|
|
if hud_ids[name].editor_mode then
|
|
player:hud_remove(hud_ids[name].editor_mode)
|
|
hud_ids[name].editor_mode = nil
|
|
end
|
|
end
|
|
lzr_gui.set_editor_gui = function(player)
|
|
player:hud_set_hotbar_itemcount(8)
|
|
player:hud_set_hotbar_image("lzr_gui_hotbar_8.png")
|
|
local id = player:hud_add({
|
|
hud_elem_type = "text",
|
|
position = { x = 0, y = 1 },
|
|
name = "editor_mode",
|
|
text = S("Level Editor"),
|
|
number = 0xFFFFFF,
|
|
alignment = { x = 1, y = -1 },
|
|
offset = { x = 5, y = -5 },
|
|
scale = { x = 100, y = 100 },
|
|
size = { x = 3, y = 3 },
|
|
z_index = 0,
|
|
})
|
|
local name = player:get_player_name()
|
|
hud_ids[name].editor_mode = id
|
|
end
|
|
|
|
minetest.register_on_joinplayer(function(player)
|
|
player:hud_set_flags({minimap = false, minimap_radar = false, healthbar = false, breathbar = false})
|
|
player:set_inventory_formspec(
|
|
"formspec_version[4]size[11,6.4]label[0.5,0.5;"..F(S("Inventory")).."]list[current_player;main;0.5,0.9;8,4]"
|
|
)
|
|
player:set_formspec_prepend([=[
|
|
listcolors[#5c4432;#a87d5d;#3b2b20;#b75647;#ffffff]
|
|
bgcolor[#503b2c;false]
|
|
style_type[button;bgcolor=#5c4432]]=])
|
|
player:hud_set_hotbar_selected_image("lzr_gui_hotbar_selected.png")
|
|
|
|
local name = player:get_player_name()
|
|
hud_ids[name] = {}
|
|
|
|
lzr_gui.set_play_gui(player)
|
|
end)
|
|
|
|
minetest.register_on_leaveplayer(function(player)
|
|
local name = player:get_player_name()
|
|
hud_ids[name] = nil
|
|
end)
|