1
0
Fork 0

[extra_mobs] Fix critical attempt to index local c_pos (a nil value)

This commit is contained in:
kay27 2021-06-21 02:47:20 +04:00
parent ed8d79395d
commit 4de3bfda8e
1 changed files with 5 additions and 3 deletions

View File

@ -127,9 +127,11 @@ local piglin = {
self.state = "stand" self.state = "stand"
end end
local c_pos = self.object:get_pos() local c_pos = self.object:get_pos()
self.what_traded = trading_items[math.random(#trading_items)] if c_pos then
for x = 1, math.random(self.what_traded.amount_min, self.what_traded.amount_max) do self.what_traded = trading_items[math.random(#trading_items)]
minetest.add_item({x=math.random(c_pos.x - 1, c_pos.x + 1), y=math.random(c_pos.y - 1, c_pos.y + 1), z= math.random(c_pos.z - 1, c_pos.z + 1)}, self.what_traded.itemstring) for x = 1, math.random(self.what_traded.amount_min, self.what_traded.amount_max) do
minetest.add_item({x=math.random(c_pos.x - 1, c_pos.x + 1), y=math.random(c_pos.y - 1, c_pos.y + 1), z= math.random(c_pos.z - 1, c_pos.z + 1)}, self.what_traded.itemstring)
end
end end
end) end)
end end