mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-04 23:31:05 +01:00
drop stack instead of items
This commit is contained in:
parent
01cace413f
commit
497f1dcd80
1 changed files with 11 additions and 12 deletions
|
@ -149,20 +149,19 @@ local piglin = {
|
|||
local c_pos = self.object:get_pos()
|
||||
if c_pos then
|
||||
self.what_traded = trading_items[math.random(#trading_items)]
|
||||
for x = 1, math.random(self.what_traded.amount_min, self.what_traded.amount_max) do
|
||||
local stack = ItemStack(self.what_traded.itemstring)
|
||||
stack:set_count(math.random(self.what_traded.amount_min, self.what_traded.amount_max))
|
||||
if mcl_enchanting.is_enchanted(self.what_traded.itemstring) then
|
||||
local enchantment = "soul_speed"
|
||||
mcl_enchanting.enchant(stack, enchantment, mcl_enchanting.random(nil, 1, mcl_enchanting.enchantments[enchantment].max_level))
|
||||
end
|
||||
local p = c_pos
|
||||
local nn=minetest.find_nodes_in_area_under_air(vector.offset(c_pos,-1,-1,-1),vector.offset(c_pos,1,1,1),{"group:solid"})
|
||||
if nn and #nn > 0 then
|
||||
p = vector.offset(nn[math.random(#nn)],0,1,0)
|
||||
end
|
||||
local stack = ItemStack(self.what_traded.itemstring)
|
||||
if mcl_enchanting.is_enchanted(self.what_traded.itemstring) then
|
||||
local enchantment = "soul_speed"
|
||||
mcl_enchanting.enchant(stack, enchantment, mcl_enchanting.random(nil, 1, mcl_enchanting.enchantments[enchantment].max_level))
|
||||
end
|
||||
minetest.add_item(p, stack)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
return it
|
||||
|
|
Loading…
Reference in a new issue