This commit is contained in:
BuckarooBanzay
2020-05-01 16:30:35 +02:00
15 changed files with 38 additions and 9 deletions

View File

@ -478,7 +478,8 @@ end
armor.load_armor_inventory = function(self, player)
local _, inv = self:get_valid_player(player, "[load_armor_inventory]")
if inv then
local armor_list_string = player:get_attribute("3d_armor_inventory")
local meta = player:get_meta()
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))
@ -490,7 +491,8 @@ end
armor.save_armor_inventory = function(self, player)
local _, inv = self:get_valid_player(player, "[save_armor_inventory]")
if inv then
player:set_attribute("3d_armor_inventory",
local meta = player:get_meta()
meta:set_string("3d_armor_inventory",
self:serialize_inventory_list(inv:get_list("armor")))
end
end
@ -531,7 +533,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

View File

@ -128,7 +128,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
@ -429,7 +430,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

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.