function keep_item(npc, item)
local npc_community = npc:character_community()
if item==nil or alife():object(item:id())==nil then return end
if npc==nil then return end
local nname=npc:name()
if (nname=="esc_stalker") or (nname=="dsc_stalker_corps1_03") or (nname=="x16_stalker_pseudo_ghost") then return end
local section = item:section() if section=="bolt" then return false end
if always_keep_item[section]==true then return true end
local item_id = item:id()
local kond=npc_cond[npc_community]
local item_in_slot = npc:item_in_slot(1)
if item_in_slot~=nil and item_in_slot:id()==item_id then
if section=="wpn_gauss_auto" or section=="wpn_gauss" then
misc.release_obj (item_in_slot:id(), 'death')
alife():create(section.."_model",npc:position(),npc:level_vertex_id(),npc:game_vertex_id())
else
item:unload_magazine()
item:set_condition(lua_random(10,45)/100)
return true
end
end
item_in_slot = npc:item_in_slot(2)
if item_in_slot~=nil and item_in_slot:id()==item_id then
if section=="wpn_gauss_auto" or section=="wpn_gauss" then
misc.release_obj (item_in_slot:id(), 'death')
alife():create(section.."_model",npc:position(),npc:level_vertex_id(),npc:game_vertex_id())
else
item:unload_magazine()
item:set_condition(lua_random(10,45)/100)
return true
end
end
item_in_slot = npc:active_item()
if item_in_slot~=nil and item_in_slot:id()==item_id then
item:set_condition(lua_random(10,45)/100)
return true
end
if always_offs_items[section] or string.find(section,"outfit",1,true) then
alife():release(alife():object(item:id()), true)
return true
end
if string.find(section,"kolbasa") or section=="bread" or string.find(section,"^mutant_") then
item:set_condition(lua_random(30,85)/100)
end
end