From cf45fdd3ec9bc4bbbddbdcad968d53b84ca925d5 Mon Sep 17 00:00:00 2001 From: thunderdog1138 <58536412+thunderdog1138@users.noreply.github.com> Date: Sun, 15 Dec 2019 18:29:06 -0500 Subject: [PATCH] Add files via upload --- .../minetest-3d_armor/3d_armor_ip/LICENSE.txt | 18 +++++++++ .../3d_armor_ip/description.txt | 1 + mods/minetest-3d_armor/3d_armor_ip/init.lua | 38 +++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 mods/minetest-3d_armor/3d_armor_ip/LICENSE.txt create mode 100644 mods/minetest-3d_armor/3d_armor_ip/description.txt create mode 100644 mods/minetest-3d_armor/3d_armor_ip/init.lua diff --git a/mods/minetest-3d_armor/3d_armor_ip/LICENSE.txt b/mods/minetest-3d_armor/3d_armor_ip/LICENSE.txt new file mode 100644 index 00000000..b924ac07 --- /dev/null +++ b/mods/minetest-3d_armor/3d_armor_ip/LICENSE.txt @@ -0,0 +1,18 @@ +[mod] 3d Armor integration to inventory plus [3d_armor_ip] +========================================================== + +Copyright (C) 2012-2019 stujones11, Stuart Jones + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. diff --git a/mods/minetest-3d_armor/3d_armor_ip/description.txt b/mods/minetest-3d_armor/3d_armor_ip/description.txt new file mode 100644 index 00000000..01e1b54c --- /dev/null +++ b/mods/minetest-3d_armor/3d_armor_ip/description.txt @@ -0,0 +1 @@ +Adds 3d_armor page to the inventory plus diff --git a/mods/minetest-3d_armor/3d_armor_ip/init.lua b/mods/minetest-3d_armor/3d_armor_ip/init.lua new file mode 100644 index 00000000..7701a707 --- /dev/null +++ b/mods/minetest-3d_armor/3d_armor_ip/init.lua @@ -0,0 +1,38 @@ +-- support for i18n +local S = armor_i18n.gettext +local F = minetest.formspec_escape + +if not minetest.global_exists("inventory_plus") then + minetest.log("warning", S("3d_armor_ip: Mod loaded but unused.")) + return +end + +armor.formspec = "size[8,8.5]button[6,0;2,0.5;main;"..F(S("Back")).."]"..armor.formspec +armor:register_on_update(function(player) + local name = player:get_player_name() + local formspec = armor:get_armor_formspec(name, true) + local page = player:get_inventory_formspec() + if page:find("detached:"..name.."_armor") then + inventory_plus.set_inventory_formspec(player, formspec) + end +end) + +if minetest.get_modpath("crafting") then + inventory_plus.get_formspec = function(player, page) + end +end + +minetest.register_on_joinplayer(function(player) + inventory_plus.register_button(player,"armor", S("Armor")) +end) + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if fields.armor then + local name = armor:get_valid_player(player, "[on_player_receive_fields]") + if not name then + return + end + local formspec = armor:get_armor_formspec(name, true) + inventory_plus.set_inventory_formspec(player, formspec) + end +end)