forked from Mineclonia/Mineclonia
Merge pull request 'mcl_explosions: Fix rays for node destruction not being cast in (+X, +Y, +Z) direction from explosion' (#50) from mcl_explosions into master
Reviewed-on: Mineclonia/Mineclonia#50 Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
commit
4c61fc80c6
|
@ -57,50 +57,48 @@ local function compute_sphere_rays(radius)
|
||||||
local rays = {}
|
local rays = {}
|
||||||
local sphere = {}
|
local sphere = {}
|
||||||
|
|
||||||
for i=1, 2 do
|
local function add_ray(pos)
|
||||||
|
sphere[minetest.hash_node_position(pos)] = pos
|
||||||
|
end
|
||||||
|
|
||||||
for y = -radius, radius do
|
for y = -radius, radius do
|
||||||
for z = -radius, radius do
|
for z = -radius, radius do
|
||||||
for x = -radius, 0, 1 do
|
for x = -radius, 0 do
|
||||||
local d = x * x + y * y + z * z
|
local d = x * x + y * y + z * z
|
||||||
if d <= radius * radius then
|
if d <= radius * radius then
|
||||||
local pos = { x = x, y = y, z = z }
|
add_ray(vector.new(x, y, z))
|
||||||
sphere[minetest.hash_node_position(pos)] = pos
|
add_ray(vector.new(-x, y, z))
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
for i=1,2 do
|
|
||||||
for x = -radius, radius do
|
for x = -radius, radius do
|
||||||
for z = -radius, radius do
|
for z = -radius, radius do
|
||||||
for y = -radius, 0, 1 do
|
for y = -radius, 0 do
|
||||||
local d = x * x + y * y + z * z
|
local d = x * x + y * y + z * z
|
||||||
if d <= radius * radius then
|
if d <= radius * radius then
|
||||||
local pos = { x = x, y = y, z = z }
|
add_ray(vector.new(x, y, z))
|
||||||
sphere[minetest.hash_node_position(pos)] = pos
|
add_ray(vector.new(x, -y, z))
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
for i=1,2 do
|
|
||||||
for x = -radius, radius do
|
for x = -radius, radius do
|
||||||
for y = -radius, radius do
|
for y = -radius, radius do
|
||||||
for z = -radius, 0, 1 do
|
for z = -radius, 0 do
|
||||||
local d = x * x + y * y + z * z
|
local d = x * x + y * y + z * z
|
||||||
if d <= radius * radius then
|
if d <= radius * radius then
|
||||||
local pos = { x = x, y = y, z = z }
|
add_ray(vector.new(x, y, z))
|
||||||
sphere[minetest.hash_node_position(pos)] = pos
|
add_ray(vector.new(x, y, -z))
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
for _, pos in pairs(sphere) do
|
for _, pos in pairs(sphere) do
|
||||||
rays[#rays + 1] = vector.normalize(pos)
|
rays[#rays + 1] = vector.normalize(pos)
|
||||||
|
|
Loading…
Reference in New Issue