mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 18:41:09 +01:00
Explosions: Replace some API calls
This commit is contained in:
parent
58458b2bca
commit
9ee0ef5a8d
1 changed files with 3 additions and 5 deletions
|
@ -29,15 +29,13 @@ local node_blastres = {}
|
||||||
local node_on_blast = {}
|
local node_on_blast = {}
|
||||||
local node_walkable = {}
|
local node_walkable = {}
|
||||||
|
|
||||||
local AIR_CID = minetest.get_content_id('air')
|
|
||||||
|
|
||||||
-- The step length for the rays (Minecraft uses 0.3)
|
-- The step length for the rays (Minecraft uses 0.3)
|
||||||
local STEP_LENGTH = 0.3
|
local STEP_LENGTH = 0.3
|
||||||
|
|
||||||
-- How many rays to compute entity exposure to explosion
|
-- How many rays to compute entity exposure to explosion
|
||||||
local N_EXPOSURE_RAYS = 16
|
local N_EXPOSURE_RAYS = 16
|
||||||
|
|
||||||
minetest.after(0, function()
|
minetest.register_on_mods_loaded(function())
|
||||||
-- Store blast resistance values by content ids to improve performance.
|
-- Store blast resistance values by content ids to improve performance.
|
||||||
for name, def in pairs(minetest.registered_nodes) do
|
for name, def in pairs(minetest.registered_nodes) do
|
||||||
node_blastres[minetest.get_content_id(name)] = def._mcl_blast_resistance or 0
|
node_blastres[minetest.get_content_id(name)] = def._mcl_blast_resistance or 0
|
||||||
|
@ -245,7 +243,7 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
if cid ~= AIR_CID then
|
if cid ~= minetest.CONTENT_AIR then
|
||||||
destroy[hash] = idx
|
destroy[hash] = idx
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -368,7 +366,7 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if remove then
|
if remove then
|
||||||
data[idx] = AIR_CID
|
data[idx] = minetest.CONTENT_AIR
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue