diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2016-04-01 20:42:31 -0400 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2016-04-01 20:47:00 -0400 |
commit | 2b20886b4109225dcbc1bf75be11d44dca647bc0 (patch) | |
tree | b06766b4a77db46a2c1e6916138cdb49659df28f /dreambuilder_mp_extras/init.lua | |
parent | debe14368f67dbb169342ce942a6b1926be92363 (diff) | |
download | dreambuilder_modpack-2b20886b4109225dcbc1bf75be11d44dca647bc0.tar dreambuilder_modpack-2b20886b4109225dcbc1bf75be11d44dca647bc0.tar.gz dreambuilder_modpack-2b20886b4109225dcbc1bf75be11d44dca647bc0.tar.bz2 dreambuilder_modpack-2b20886b4109225dcbc1bf75be11d44dca647bc0.tar.xz dreambuilder_modpack-2b20886b4109225dcbc1bf75be11d44dca647bc0.zip |
enable 16-slot hotbar
add custom hotbar-selected image
blank-out gui_hotbar.png
reset alpha and fullscreen
add modpack.txt
Diffstat (limited to 'dreambuilder_mp_extras/init.lua')
-rw-r--r-- | dreambuilder_mp_extras/init.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/dreambuilder_mp_extras/init.lua b/dreambuilder_mp_extras/init.lua new file mode 100644 index 0000000..168bcf5 --- /dev/null +++ b/dreambuilder_mp_extras/init.lua @@ -0,0 +1,28 @@ + +local hotbar_size = minetest.setting_get("hotbar_size") or 16 + +local function resize_hotbar(size) + if size > 8 then return "gui_hb_bg_16.png" end + return "gui_hb_bg.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" 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, +}) + |