Merge pull request 'mcl_explosions fixes' (#2830) from mcl-explosions-fixes into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2830
Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
cora 2022-10-23 16:37:01 +00:00
commit bbe4224b79

View File

@ -130,10 +130,10 @@ local function add_particles(pos, radius)
time = 0.125,
minpos = pos,
maxpos = pos,
minvel = {x = -radius, y = -radius, z = -radius},
maxvel = {x = radius, y = radius, z = radius},
minacc = vector.new(),
maxacc = vector.new(),
minvel = vector.new(-radius, -radius, -radius),
maxvel = vector.new(radius, radius, radius),
minacc = vector.zero(),
maxacc = vector.zero(),
minexptime = 0.5,
maxexptime = 1.0,
minsize = radius * 0.5,
@ -333,7 +333,8 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc
end
if sleep_formspec_doesnt_close_mt53 then
minetest.after(0.3, function() -- 0.2 is minimum delay for closing old formspec and open died formspec -- TODO: REMOVE THIS IN THE FUTURE
minetest.after(0.3,
function() -- 0.2 is minimum delay for closing old formspec and open died formspec -- TODO: REMOVE THIS IN THE FUTURE
if not obj:is_player() then
return
end
@ -396,15 +397,16 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc
-- Update falling nodes
for a = 1, #airs do
local p = airs[a]
check_for_falling({x=p.x, y=p.y+1, z=p.z})
check_for_falling(vector.offset(p, 0, 1, 0))
end
for f = 1, #fires do
local p = fires[f]
check_for_falling({x=p.x, y=p.y+1, z=p.z})
check_for_falling(vector.offset(p, 0, 1, 0))
end
-- Log explosion
minetest.log("action", "Explosion at "..pos_to_string(pos).." with strength "..strength.." and radius "..radius)
minetest.log("action", "Explosion at " .. pos_to_string(pos) .. " with strength " .. strength .. " and radius " ..
radius)
end
-- Create an explosion with strength at pos.
@ -428,6 +430,11 @@ end
-- griefing - If true, the explosion will destroy nodes (default: true)
-- grief_protected - If true, the explosion will also destroy nodes which have
-- been protected (default: false)
---@param pos Vector
---@param strength number
---@param info {drop_chance: number, max_blast_resistance: number, sound: boolean, particles: boolean, fire: boolean, griefing: boolean, grief_protected: boolean}
---@param direct? ObjectRef
---@param source? ObjectRef
function mcl_explosions.explode(pos, strength, info, direct, source)
if info == nil then
info = {}