Make mob explosions more random instead of square

master
TenPlus1 2016-01-29 21:26:05 +00:00
parent 577f6f7b39
commit 060a8278dc
1 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,4 @@
-- Mobs Api (27th January 2016)
-- Mobs Api (29th January 2016)
mobs = {}
mobs.mod = "redo"
@ -1961,6 +1961,7 @@ function mobs:explosion(pos, radius, fire, smoke, sound)
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
local data = vm:get_data()
local p = {}
local pr = PseudoRandom(os.time())
for z = -radius, radius do
for y = -radius, radius do
@ -1971,7 +1972,8 @@ function mobs:explosion(pos, radius, fire, smoke, sound)
p.y = pos.y + y
p.z = pos.z + z
if data[vi] ~= c_air
if (x * x) + (y * y) + (z * z) <= (radius * radius) + pr:next(-radius, radius)
and data[vi] ~= c_air
and data[vi] ~= c_ignore
and data[vi] ~= c_obsidian
and data[vi] ~= c_brick