From e248752ee45945416d849090f2b22050ec6570bd Mon Sep 17 00:00:00 2001 From: Panquesito7 <51391473+Panquesito7@users.noreply.github.com> Date: Sun, 16 Jun 2019 15:17:21 -0500 Subject: [PATCH 1/2] Use newer functions from MT/MTG 5.0.0+ These commits create more compatibility with MT/MTG 5.0.0+. However, these commits (may) break compatibility with the 0.4-series. --- 3d_armor/api.lua | 8 +++++--- 3d_armor/init.lua | 5 +++-- 3d_armor/mod.conf | 4 ++++ 3d_armor_ip/description.txt | 2 +- 3d_armor_ip/mod.conf | 4 ++++ 3d_armor_sfinv/description.txt | 2 +- 3d_armor_sfinv/mod.conf | 4 ++++ 3d_armor_stand/init.lua | 2 +- 3d_armor_stand/mod.conf | 2 ++ 3d_armor_ui/description.txt | 2 +- 3d_armor_ui/mod.conf | 4 ++++ modpack.conf | 2 ++ modpack.txt | 0 shields/mod.conf | 3 +++ wieldview/mod.conf | 3 +++ 15 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 3d_armor/mod.conf create mode 100644 3d_armor_ip/mod.conf create mode 100644 3d_armor_sfinv/mod.conf create mode 100644 3d_armor_stand/mod.conf create mode 100644 3d_armor_ui/mod.conf create mode 100644 modpack.conf delete mode 100644 modpack.txt create mode 100644 shields/mod.conf create mode 100644 wieldview/mod.conf diff --git a/3d_armor/api.lua b/3d_armor/api.lua index e460a24..674118e 100644 --- a/3d_armor/api.lua +++ b/3d_armor/api.lua @@ -465,8 +465,9 @@ end armor.load_armor_inventory = function(self, player) local _, inv = self:get_valid_player(player, "[load_armor_inventory]") + local meta = player:get_meta() if inv then - local armor_list_string = player:get_attribute("3d_armor_inventory") + local armor_list_string = meta:get_string("3d_armor_inventory") if armor_list_string then inv:set_list("armor", self:deserialize_inventory_list(armor_list_string)) @@ -477,8 +478,9 @@ end armor.save_armor_inventory = function(self, player) local _, inv = self:get_valid_player(player, "[save_armor_inventory]") + local meta = player:get_meta() if inv then - player:set_attribute("3d_armor_inventory", + meta:set_string("3d_armor_inventory", self:serialize_inventory_list(inv:get_list("armor"))) end end @@ -519,7 +521,7 @@ armor.drop_armor = function(pos, stack) if node then local obj = minetest.add_item(pos, stack) if obj then - obj:setvelocity({x=math.random(-1, 1), y=5, z=math.random(-1, 1)}) + obj:set_velocity({x=math.random(-1, 1), y=5, z=math.random(-1, 1)}) end end end diff --git a/3d_armor/init.lua b/3d_armor/init.lua index 646a286..c341a8e 100644 --- a/3d_armor/init.lua +++ b/3d_armor/init.lua @@ -114,7 +114,8 @@ local function validate_armor_inventory(player) return end local armor_prev = {} - local armor_list_string = player:get_attribute("3d_armor_inventory") + local attribute_meta = player:get_meta() -- I know, the function's name is weird but let it be like that. ;) + local armor_list_string = attribute_meta:get_string("3d_armor_inventory") if armor_list_string then local armor_list = armor:deserialize_inventory_list(armor_list_string) for i, stack in ipairs(armor_list) do @@ -406,7 +407,7 @@ minetest.register_globalstep(function(dtime) end end) --- Fire Protection and water breating, added by TenPlus1 +-- Fire Protection and water breathing, added by TenPlus1. if armor.config.fire_protect == true then -- override hot nodes so they do not hurt player anywhere but mod diff --git a/3d_armor/mod.conf b/3d_armor/mod.conf new file mode 100644 index 0000000..56f7973 --- /dev/null +++ b/3d_armor/mod.conf @@ -0,0 +1,4 @@ +name = 3d_armor +depends = default +optional_depends = player_monoids, armor_monoid, pova, fire, ethereal, bakedclay, intllib +description = Adds craftable armor that is visible to other players. diff --git a/3d_armor_ip/description.txt b/3d_armor_ip/description.txt index 01e1b54..58b700e 100644 --- a/3d_armor_ip/description.txt +++ b/3d_armor_ip/description.txt @@ -1 +1 @@ -Adds 3d_armor page to the inventory plus +Adds 3d_armor page to the inventory plus. diff --git a/3d_armor_ip/mod.conf b/3d_armor_ip/mod.conf new file mode 100644 index 0000000..0fe7f4e --- /dev/null +++ b/3d_armor_ip/mod.conf @@ -0,0 +1,4 @@ +name = 3d_armor_ip +depends = 3d_armor +optional_depends = inventory_plus +description = Adds 3d_armor page to the inventory plus. diff --git a/3d_armor_sfinv/description.txt b/3d_armor_sfinv/description.txt index 0ef2ae9..15f4e96 100644 --- a/3d_armor_sfinv/description.txt +++ b/3d_armor_sfinv/description.txt @@ -1 +1 @@ -Adds 3d_armor page to the sfinv inventory +Adds 3d_armor page to the sfinv inventory. diff --git a/3d_armor_sfinv/mod.conf b/3d_armor_sfinv/mod.conf new file mode 100644 index 0000000..bc0eb89 --- /dev/null +++ b/3d_armor_sfinv/mod.conf @@ -0,0 +1,4 @@ +name = 3d_armor_sfinv +depends = 3d_armor +optional_depends = sfinv +description = Adds 3d_armor page to the sfinv inventory. diff --git a/3d_armor_stand/init.lua b/3d_armor_stand/init.lua index 1dd3ef6..ab4549b 100644 --- a/3d_armor_stand/init.lua +++ b/3d_armor_stand/init.lua @@ -97,7 +97,7 @@ local function update_entity(pos) yaw = math.pi / 2 end end - object:setyaw(yaw) + object:set_yaw(yaw) object:set_properties({textures={texture}}) end end diff --git a/3d_armor_stand/mod.conf b/3d_armor_stand/mod.conf new file mode 100644 index 0000000..d1f1a4e --- /dev/null +++ b/3d_armor_stand/mod.conf @@ -0,0 +1,2 @@ +name = 3d_armor_stand +depends = 3d_armor diff --git a/3d_armor_ui/description.txt b/3d_armor_ui/description.txt index 873f876..e6bf11c 100644 --- a/3d_armor_ui/description.txt +++ b/3d_armor_ui/description.txt @@ -1 +1 @@ -Adds 3d_armor page to the unified inventory +Adds 3d_armor page to the unified inventory. diff --git a/3d_armor_ui/mod.conf b/3d_armor_ui/mod.conf new file mode 100644 index 0000000..68eff85 --- /dev/null +++ b/3d_armor_ui/mod.conf @@ -0,0 +1,4 @@ +name = 3d_armor_ui +depends = 3d_armor +optional_depends = unified_inventory +description = Adds 3d_armor page to the unified inventory. diff --git a/modpack.conf b/modpack.conf new file mode 100644 index 0000000..4e64251 --- /dev/null +++ b/modpack.conf @@ -0,0 +1,2 @@ +name = minetest-3d_armor +description = Visible player armor & wielded items. diff --git a/modpack.txt b/modpack.txt deleted file mode 100644 index e69de29..0000000 diff --git a/shields/mod.conf b/shields/mod.conf new file mode 100644 index 0000000..9a95629 --- /dev/null +++ b/shields/mod.conf @@ -0,0 +1,3 @@ +name = shields +depends = default, 3d_armor +description = Adds visible shields to 3d armor. diff --git a/wieldview/mod.conf b/wieldview/mod.conf new file mode 100644 index 0000000..c5f4812 --- /dev/null +++ b/wieldview/mod.conf @@ -0,0 +1,3 @@ +name = wieldview +depends = 3d_armor +description = Makes hand wielded items visible to other players. From 4adc6027049c7a427ad7af261419e6ccd6c4291d Mon Sep 17 00:00:00 2001 From: Panquesito7 <51391473+Panquesito7@users.noreply.github.com> Date: Mon, 17 Jun 2019 13:03:27 -0500 Subject: [PATCH 2/2] Update api.lua --- 3d_armor/api.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/3d_armor/api.lua b/3d_armor/api.lua index 674118e..42c0c58 100644 --- a/3d_armor/api.lua +++ b/3d_armor/api.lua @@ -465,8 +465,8 @@ end armor.load_armor_inventory = function(self, player) local _, inv = self:get_valid_player(player, "[load_armor_inventory]") - local meta = player:get_meta() if inv then + local meta = player:get_meta() local armor_list_string = meta:get_string("3d_armor_inventory") if armor_list_string then inv:set_list("armor", @@ -478,8 +478,8 @@ end armor.save_armor_inventory = function(self, player) local _, inv = self:get_valid_player(player, "[save_armor_inventory]") - local meta = player:get_meta() if inv then + local meta = player:get_meta() meta:set_string("3d_armor_inventory", self:serialize_inventory_list(inv:get_list("armor"))) end