mirror of
https://github.com/minetest/minetest_game.git
synced 2024-11-05 15:23:51 +01:00
Fix TNT drops being placed inside nodes
This commit is contained in:
parent
0472e61a9d
commit
c76a91943c
@ -29,8 +29,20 @@ minetest.after(0, function()
|
||||
end)
|
||||
|
||||
local function rand_pos(center, pos, radius)
|
||||
pos.x = center.x + math.random(-radius, radius)
|
||||
pos.z = center.z + math.random(-radius, radius)
|
||||
local def
|
||||
local reg_nodes = minetest.registered_nodes
|
||||
local i = 0
|
||||
repeat
|
||||
-- Give up and use the center if this takes too long
|
||||
if i > 4 then
|
||||
pos.x, pos.z = center.x, center.z
|
||||
break
|
||||
end
|
||||
pos.x = center.x + math.random(-radius, radius)
|
||||
pos.z = center.z + math.random(-radius, radius)
|
||||
def = reg_nodes[minetest.get_node(pos).name]
|
||||
i = i + 1
|
||||
until def and not def.walkable
|
||||
end
|
||||
|
||||
local function eject_drops(drops, pos, radius)
|
||||
|
Loading…
Reference in New Issue
Block a user