enable 16-slot hotbar

add custom hotbar-selected image
delete gui_hotbar.png
master
Vanessa Ezekowitz 2015-08-25 19:07:44 -04:00
parent 1460d56852
commit 04daf61102
4 changed files with 24 additions and 0 deletions

23
mods/default/commands.lua Normal file
View File

@ -0,0 +1,23 @@
hotbar_size = minetest.setting_get("hotbar_size") or 16
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")
end)
end)
minetest.register_chatcommand("hotbar", {
params = "[size]",
description = "Sets the size of your hotbar",
func = function(name, slots)
if slots == "" then slots = 16 end
if type(tonumber(slots)) ~= "number" or tonumber(slots) < 1 or tonumber(slots) > 23 then
minetest.chat_send_player(name, "[_] Hotbar size must be between 1 and 23.")
return
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) .. ".")
end,
})

View File

@ -44,5 +44,6 @@ dofile(minetest.get_modpath("default").."/crafting.lua")
dofile(minetest.get_modpath("default").."/mapgen.lua")
dofile(minetest.get_modpath("default").."/player.lua")
dofile(minetest.get_modpath("default").."/trees.lua")
dofile(minetest.get_modpath("default").."/commands.lua")
dofile(minetest.get_modpath("default").."/aliases.lua")
dofile(minetest.get_modpath("default").."/legacy.lua")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB