1
0
Fork 0

drop stack instead of items

This commit is contained in:
nixnoxus 2024-02-05 00:24:27 +01:00
parent 01cace413f
commit 497f1dcd80
1 changed files with 11 additions and 12 deletions

View File

@ -149,19 +149,18 @@ local piglin = {
local c_pos = self.object:get_pos() local c_pos = self.object:get_pos()
if c_pos then if c_pos then
self.what_traded = trading_items[math.random(#trading_items)] 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)
local p = c_pos stack:set_count(math.random(self.what_traded.amount_min, self.what_traded.amount_max))
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 mcl_enchanting.is_enchanted(self.what_traded.itemstring) then
if nn and #nn > 0 then local enchantment = "soul_speed"
p = vector.offset(nn[math.random(#nn)],0,1,0) mcl_enchanting.enchant(stack, enchantment, mcl_enchanting.random(nil, 1, mcl_enchanting.enchantments[enchantment].max_level))
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
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
minetest.add_item(p, stack)
end end
end) end)
end end