diff --git a/gui_plain.lua b/gui_plain.lua new file mode 100644 index 0000000..5ba905e --- /dev/null +++ b/gui_plain.lua @@ -0,0 +1,12 @@ +minetest.register_chatcommand("upgrade_packs", { + description = "Allows inserting upgrade packs without CSM", + func = function(name, param) + minetest.show_formspec(name, "upgrade_packs:gui_plain", + "size[8,7]" .. + "label[3,0;Upgrade Packs]" .. + "list[current_player;ugpacks;2,1;4,1;]" .. + "list[current_player;main;0,3;8,4;]" .. + "listring[]" + ) + end +}) \ No newline at end of file diff --git a/gui_sfinv.lua b/gui_sfinv.lua index 09f50ce..9b85aeb 100644 --- a/gui_sfinv.lua +++ b/gui_sfinv.lua @@ -1,2 +1,12 @@ --- TODO -return \ No newline at end of file +sfinv.register_page("upgrade_packs:ugpacks", { + title = "Upgrade Packs", + get = function(self, player, context) + local name = player:get_player_name() + return sfinv.make_formspec(player, context, + "label[3,0;Upgrade Packs]" .. + "list[current_player;ugpacks;3,1;2,2;]" .. + "list[current_player;main;0,5;8,4;]" .. + "listring[]" + , false) + end +}) \ No newline at end of file diff --git a/gui_unified_inventory.lua b/gui_unified_inventory.lua index 3ba9636..1978915 100644 --- a/gui_unified_inventory.lua +++ b/gui_unified_inventory.lua @@ -13,9 +13,9 @@ unified_inventory.register_page("ugpacks", { local y = perplayer_formspec.formspec_y return { formspec = ( - "label[1,0;Upgrade Packs]".. - "list[current_player;ugpacks;1," ..(y + 1) .. ";2,2;]".. - "listring[current_player;main]".. + "label[3,0;Upgrade Packs]" .. + "list[current_player;ugpacks;3," .. (y + 1) .. ";2,2;]" .. + "listring[current_player;main]" .. "listring[current_player;ugpacks]" )} end diff --git a/init.lua b/init.lua index 24c8c6b..09660c9 100644 --- a/init.lua +++ b/init.lua @@ -9,6 +9,8 @@ if minetest.get_modpath("unified_inventory") then dofile(modpath .. "/gui_unified_inventory.lua") elseif minetest.get_modpath("sfinv") then dofile(modpath .. "/gui_sfinv.lua") +else + dofile(modpath .. "/gui_plain.lua") end upgrade_packs.register_pack("upgrade_packs:hp_10", "health", { @@ -51,12 +53,11 @@ minetest.register_on_joinplayer(function(player) end) minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack, user) - print(dump(hp_change)) if hp_change == 0 then return end -- Undo some of the wear when eating instead of dying - upgrade_packs.add_wear(user, "health", hp_change * -10) + upgrade_packs.add_wear(user, "health", hp_change * -2) end) minetest.register_on_player_hpchange(function(player, hp_change, reason) @@ -71,7 +72,6 @@ minetest.register_on_player_hpchange(function(player, hp_change, reason) end, false) minetest.register_allow_player_inventory_action(function(player, action, inv, data) - print(dump(data)) if data.to_list ~= "ugpacks" then return -- Not interesting for this mod end