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.
This commit is contained in:
Panquesito7 2019-06-16 15:17:21 -05:00 committed by GitHub
parent 47ecef46f7
commit e248752ee4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 38 additions and 9 deletions

View File

@ -465,8 +465,9 @@ end
armor.load_armor_inventory = function(self, player) armor.load_armor_inventory = function(self, player)
local _, inv = self:get_valid_player(player, "[load_armor_inventory]") local _, inv = self:get_valid_player(player, "[load_armor_inventory]")
local meta = player:get_meta()
if inv then 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 if armor_list_string then
inv:set_list("armor", inv:set_list("armor",
self:deserialize_inventory_list(armor_list_string)) self:deserialize_inventory_list(armor_list_string))
@ -477,8 +478,9 @@ end
armor.save_armor_inventory = function(self, player) armor.save_armor_inventory = function(self, player)
local _, inv = self:get_valid_player(player, "[save_armor_inventory]") local _, inv = self:get_valid_player(player, "[save_armor_inventory]")
local meta = player:get_meta()
if inv then if inv then
player:set_attribute("3d_armor_inventory", meta:set_string("3d_armor_inventory",
self:serialize_inventory_list(inv:get_list("armor"))) self:serialize_inventory_list(inv:get_list("armor")))
end end
end end
@ -519,7 +521,7 @@ armor.drop_armor = function(pos, stack)
if node then if node then
local obj = minetest.add_item(pos, stack) local obj = minetest.add_item(pos, stack)
if obj then 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 end
end end

View File

@ -114,7 +114,8 @@ local function validate_armor_inventory(player)
return return
end end
local armor_prev = {} 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 if armor_list_string then
local armor_list = armor:deserialize_inventory_list(armor_list_string) local armor_list = armor:deserialize_inventory_list(armor_list_string)
for i, stack in ipairs(armor_list) do for i, stack in ipairs(armor_list) do
@ -406,7 +407,7 @@ minetest.register_globalstep(function(dtime)
end end
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 if armor.config.fire_protect == true then
-- override hot nodes so they do not hurt player anywhere but mod -- override hot nodes so they do not hurt player anywhere but mod

4
3d_armor/mod.conf Normal file
View File

@ -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.

View File

@ -1 +1 @@
Adds 3d_armor page to the inventory plus Adds 3d_armor page to the inventory plus.

4
3d_armor_ip/mod.conf Normal file
View File

@ -0,0 +1,4 @@
name = 3d_armor_ip
depends = 3d_armor
optional_depends = inventory_plus
description = Adds 3d_armor page to the inventory plus.

View File

@ -1 +1 @@
Adds 3d_armor page to the sfinv inventory Adds 3d_armor page to the sfinv inventory.

4
3d_armor_sfinv/mod.conf Normal file
View File

@ -0,0 +1,4 @@
name = 3d_armor_sfinv
depends = 3d_armor
optional_depends = sfinv
description = Adds 3d_armor page to the sfinv inventory.

View File

@ -97,7 +97,7 @@ local function update_entity(pos)
yaw = math.pi / 2 yaw = math.pi / 2
end end
end end
object:setyaw(yaw) object:set_yaw(yaw)
object:set_properties({textures={texture}}) object:set_properties({textures={texture}})
end end
end end

2
3d_armor_stand/mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = 3d_armor_stand
depends = 3d_armor

View File

@ -1 +1 @@
Adds 3d_armor page to the unified inventory Adds 3d_armor page to the unified inventory.

4
3d_armor_ui/mod.conf Normal file
View File

@ -0,0 +1,4 @@
name = 3d_armor_ui
depends = 3d_armor
optional_depends = unified_inventory
description = Adds 3d_armor page to the unified inventory.

2
modpack.conf Normal file
View File

@ -0,0 +1,2 @@
name = minetest-3d_armor
description = Visible player armor & wielded items.

View File

3
shields/mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = shields
depends = default, 3d_armor
description = Adds visible shields to 3d armor.

3
wieldview/mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = wieldview
depends = 3d_armor
description = Makes hand wielded items visible to other players.