1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-05 10:00:26 +01:00

[3d_armor & dropondie] Let pclasses decide about drop on death

This commit is contained in:
LeMagnesium 2015-11-25 23:53:32 +01:00
parent 576d732088
commit aef57f6277
3 changed files with 11 additions and 5 deletions

View File

@ -192,7 +192,7 @@ armor.set_player_armor = function(self, player)
local texture = item:gsub("%:", "_")
table.insert(textures, texture..".png")
if preview == "" then
preview = texture .. "_preview.png"
preview = texture .. "_preview.png"
elseif stack:get_name():find("shield") then -- //MFF(Mg|09/05/15)
preview = preview.. "^" .. texture.."_preview.png"
else
@ -606,10 +606,13 @@ if ARMOR_DROP == true or ARMOR_DESTROY == true then
local drop = {}
for i=1, player_inv:get_size("armor") do
local stack = armor_inv:get_stack("armor", i)
if stack:get_count() > 0 then
if stack:get_count() > 0 and (not pclasses.data.reserved_items[player_inv:get_stack("main", i):get_name()] or
not pclasses.api.util.can_have_item(name, player_inv:get_stack("main", i):get_name())) then
table.insert(drop, stack)
armor_inv:set_stack("armor", i, nil)
player_inv:set_stack("armor", i, nil)
else
print(dump(stack))
end
end
armor:set_player_armor(player)
@ -654,4 +657,3 @@ local function tick()
end
tick()

View File

@ -1 +1,2 @@
default
pclasses

View File

@ -31,8 +31,11 @@ minetest.register_on_dieplayer(function(player)
local player_inv = player:get_inventory()
for i=1,player_inv:get_size("main") do
drop(pos, player_inv:get_stack("main", i))
player_inv:set_stack("main", i, nil)
if not pclasses.data.reserved_items[player_inv:get_stack("main", i):get_name()] or
not pclasses.api.util.can_have_item(player:get_player_name(), player_inv:get_stack("main", i):get_name()) then
drop(pos, player_inv:get_stack("main", i))
player_inv:set_stack("main", i, nil)
end
end
for i=1,player_inv:get_size("craft") do