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)
if minetest.find_node_near(pos, 1, "air") then
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,
})

View File

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