mirror of
https://github.com/mt-mods/dreambuilder_hotbar.git
synced 2024-11-29 10:03:44 +01:00
Initial commit
This commit is contained in:
commit
2d313236fe
1
depends.txt
Normal file
1
depends.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
default
|
29
init.lua
Normal file
29
init.lua
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
local hotbar_size = minetest.setting_get("hotbar_size") or 16
|
||||||
|
|
||||||
|
local function resize_hotbar(size)
|
||||||
|
if size == 8 then return "gui_hb_bg.png" end
|
||||||
|
if size == 23 then return "gui_hb_bg_23.png" end
|
||||||
|
return "gui_hb_bg_16.png"
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
player:hud_set_hotbar_itemcount(hotbar_size)
|
||||||
|
minetest.after(0.5,function()
|
||||||
|
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
|
||||||
|
player:hud_set_hotbar_image(resize_hotbar(hotbar_size))
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_chatcommand("hotbar", {
|
||||||
|
params = "[size]",
|
||||||
|
description = "Sets the size of your hotbar",
|
||||||
|
func = function(name, slots)
|
||||||
|
if slots ~= "8" and slots ~= "23" then slots = "16" end
|
||||||
|
local player = minetest.get_player_by_name(name)
|
||||||
|
player:hud_set_hotbar_itemcount(tonumber(slots))
|
||||||
|
minetest.chat_send_player(name, "[_] Hotbar size set to " .. tonumber(slots) .. ".")
|
||||||
|
player:hud_set_hotbar_image(resize_hotbar(tonumber(slots)))
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
BIN
textures/gui_hb_bg.png
Normal file
BIN
textures/gui_hb_bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 474 B |
BIN
textures/gui_hb_bg_16.png
Normal file
BIN
textures/gui_hb_bg_16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 764 B |
BIN
textures/gui_hb_bg_23.png
Normal file
BIN
textures/gui_hb_bg_23.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 971 B |
Loading…
Reference in New Issue
Block a user