forked from MineClone5/MineClone5
[extra_mobs] Fix critical attempt to index local c_pos (a nil value)
This commit is contained in:
parent
ed8d79395d
commit
4de3bfda8e
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue