forked from mtcontrib/3d_armor
Only allow armor items in the armor inventory
This commit is contained in:
parent
065815eec1
commit
a2ec13e28d
|
@ -196,8 +196,10 @@ armor.init_player_armor = function(self, player)
|
||||||
end,
|
end,
|
||||||
allow_put = function(inv, listname, index, stack, player)
|
allow_put = function(inv, listname, index, stack, player)
|
||||||
local def = stack:get_definition() or {}
|
local def = stack:get_definition() or {}
|
||||||
|
local allowed = 0
|
||||||
for _, element in pairs(armor.elements) do
|
for _, element in pairs(armor.elements) do
|
||||||
if def.groups["armor_"..element] then
|
if def.groups["armor_"..element] then
|
||||||
|
allowed = 1
|
||||||
for i = 1, 6 do
|
for i = 1, 6 do
|
||||||
local item = inv:get_stack("armor", i):get_name()
|
local item = inv:get_stack("armor", i):get_name()
|
||||||
if minetest.get_item_group(item, "armor_"..element) > 0 then
|
if minetest.get_item_group(item, "armor_"..element) > 0 then
|
||||||
|
@ -206,7 +208,7 @@ armor.init_player_armor = function(self, player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return 1
|
return allowed
|
||||||
end,
|
end,
|
||||||
allow_take = function(inv, listname, index, stack, player)
|
allow_take = function(inv, listname, index, stack, player)
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user