make wisps rarely spawned by gas explosions

This commit is contained in:
FaceDeer 2019-08-03 19:38:50 -06:00
parent 27c1f5d295
commit badcc5e8e0
2 changed files with 8 additions and 3 deletions

View File

@ -152,6 +152,10 @@ if minetest.get_modpath("tnt") then
action = function(pos, node) action = function(pos, node)
if minetest.find_node_near(pos, 1, "air") then if minetest.find_node_near(pos, 1, "air") then
tnt.boom(pos, {radius=1, damage_radius=6}) tnt.boom(pos, {radius=1, damage_radius=6})
-- One in a hundred explosions will spawn a gas wisp
if math.random() < 0.01 then
minetest.set_node(pos, {name="mine_gas:gas_wisp"})
end
end end
end, end,
}) })

View File

@ -31,7 +31,7 @@ minetest.register_node("mine_gas:gas_wisp", {
inventory_image = "mine_gas_wisp_inventory.png", inventory_image = "mine_gas_wisp_inventory.png",
drop = {}, drop = {},
sunlight_propagates = true, sunlight_propagates = true,
--on_blast = function() end, -- unaffected by explosions on_blast = function() end, -- unaffected by explosions
}) })
minetest.register_abm({ minetest.register_abm({
@ -64,8 +64,9 @@ minetest.register_abm({
for y = -1, 1 do for y = -1, 1 do
for x = -1, 1 do for x = -1, 1 do
for z = -1, 1 do for z = -1, 1 do
if minetest.get_node({x=pos.x+x, y=pos.y+y, z=pos.z+z}).name == "mine_gas:gas" then local node_name = minetest.get_node({x=pos.x+x, y=pos.y+y, z=pos.z+z}).name
-- there's gas adjacent, don't extinguish if node_name == "mine_gas:gas" or minetest.get_item_group(node_name, "flammable") > 0 then
-- there's gas or a flammable adjacent, don't extinguish
return return
end end
end end