From 2d313236fe04ede6d630b1137f002ffe506cbf2b Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Sat, 10 Nov 2018 23:23:16 -0500 Subject: [PATCH] Initial commit --- depends.txt | 1 + init.lua | 29 +++++++++++++++++++++++++++++ textures/gui_hb_bg.png | Bin 0 -> 474 bytes textures/gui_hb_bg_16.png | Bin 0 -> 764 bytes textures/gui_hb_bg_23.png | Bin 0 -> 971 bytes 5 files changed, 30 insertions(+) create mode 100644 depends.txt create mode 100644 init.lua create mode 100644 textures/gui_hb_bg.png create mode 100644 textures/gui_hb_bg_16.png create mode 100644 textures/gui_hb_bg_23.png diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +default diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..f57ccc4 --- /dev/null +++ b/init.lua @@ -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, +}) + diff --git a/textures/gui_hb_bg.png b/textures/gui_hb_bg.png new file mode 100644 index 0000000000000000000000000000000000000000..9389700506b70fbfed2f5aec05ec838b65d1257c GIT binary patch literal 474 zcmeAS@N?(olHy`uVBq!ia0y~yUei|&)Qu9`Oc{pRxTWhDvf z);CZ3m2H|l_l=2c&$mmnzxo6%{`e*ZF5Kq$RrkWXy8D$|RX%(6-iE3L%3pQPVPg2> z9>B=Jp~b-9$jYFwf`NfWl!2j%i@^aQ+OU9$K>+A(s3=qsOq5PqLDm4B2D26D79zopr0Fk4JHvj+t literal 0 HcmV?d00001 diff --git a/textures/gui_hb_bg_16.png b/textures/gui_hb_bg_16.png new file mode 100644 index 0000000000000000000000000000000000000000..2624cd0e1395ba9bc412aaf50139d62cf5be4235 GIT binary patch literal 764 zcmeAS@N?(olHy`uVBq!ia0y~yU|9lWdvUM<$yTKvLk0$>!=5gVAr-gY-q@JSWFPC6+XvV{!h)k#u%sz0S?$lxbs)PzkMd=-k$TxYfJ0P z7EJcDdbtFRxST!L&wo)Z-}SxUWsY9Xf_S*I3>$ZKjJO9}< z7>hd3<>J=0JRk?O@BqESz_4VL8ZtrP$9`YlxcF}MeAQXU`SUT82{6^{y^tvz`+je} wadGAMjO?|)H#1|V6=2e-yUq!Ud^q?qIlq;AMa-MFMU5aaPgg&ebxsLQ00kJql>h($ literal 0 HcmV?d00001 diff --git a/textures/gui_hb_bg_23.png b/textures/gui_hb_bg_23.png new file mode 100644 index 0000000000000000000000000000000000000000..53f02941f590cd6fd97dc9f972152ff5a0103725 GIT binary patch literal 971 zcmeAS@N?(olHy`uVBq!ia0y~yVA}v>dvUM<$~)y}2=$*-(V_ zpucnDY=J8sj91@9U1>4i)nt9RE9`<#Maq_hf&;S|f%?!v+yN`A8`byIpZ$7PE0?|Y z{bp{fmrEx5p%b>(JHtIsXDWa8yczg?B_P$Npd z%`dS0Q8#yHWcJ@Z#e4UDe?DjZ0(9fSR-)L!SIYx&YKsKO(?H;1m;mv>groyZU=f9* z4Xj{>Ll+}An9(4@ECyyUXtL=*7(qM{5XO>GgGNvoO>chRKXd2Xz4ofJj?1TGO>ckq zPtLnH9h%f-qukl6-~T=nbKmw})a&1GnlQ2eD2<*ky>#|BC<}m+J0w}5kPnvrWlDUW UcwQoRa~?>-)78&qol`;+0QF4jrT_o{ literal 0 HcmV?d00001