Destroy some nodes by flowing lava
This commit is contained in:
parent
7140bf71d8
commit
c49e8dfba0
19 changed files with 89 additions and 48 deletions
|
@ -4,12 +4,12 @@
|
|||
|
||||
mcl_core.cool_lava_source = function(pos)
|
||||
minetest.set_node(pos, {name="mcl_core:obsidian"})
|
||||
minetest.sound_play("fire_extinguish_flame", {gain = 0.25, max_hear_distance = 16})
|
||||
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16})
|
||||
end
|
||||
|
||||
mcl_core.cool_lava_flowing = function(pos)
|
||||
minetest.set_node(pos, {name="mcl_core:stone"})
|
||||
minetest.sound_play("fire_extinguish_flame", {gain = 0.25, max_hear_distance = 16})
|
||||
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16})
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
|
@ -132,6 +132,45 @@ minetest.register_abm({
|
|||
end,
|
||||
})
|
||||
|
||||
-- Destroy some nodes next to and below lava (excluding diagonals)
|
||||
-- TODO: This is just an approximation! Attached nodes should be removed if lava wants to flow INTO that space.
|
||||
minetest.register_abm({
|
||||
label = "Destroy destroy_by_lava_flow nodes next to lava",
|
||||
nodenames = {"group:destroy_by_lava_flow"},
|
||||
neighbors = {"group:lava"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local check_destroy = function(pos, xp, yp, zp)
|
||||
local p = {x=pos.x+xp, y=pos.y+yp, z=pos.z+zp}
|
||||
local n = minetest.get_node(p)
|
||||
local d = minetest.registered_nodes[n.name]
|
||||
if (d.groups.lava) then
|
||||
minetest.remove_node(pos)
|
||||
minetest.sound_play("builtin_item_lava", {pos = pos, gain = 0.25, max_hear_distance = 16})
|
||||
core.check_for_falling(pos)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
local dug = false
|
||||
for xp=-1,1 do
|
||||
if check_destroy(pos, xp, 0, 0) then dug = true; break end
|
||||
end
|
||||
if not dug then
|
||||
for zp=-1,1 do
|
||||
if check_destroy(pos, 0, 0, zp) then dug = true; break end
|
||||
end
|
||||
if not dug then
|
||||
for yp=0,1 do
|
||||
if check_destroy(pos, 0, yp, 0) then break end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Cactus growth",
|
||||
nodenames = {"mcl_core:cactus"},
|
||||
|
|
|
@ -706,7 +706,7 @@ minetest.register_node("mcl_core:sapling", {
|
|||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
stack_max = 64,
|
||||
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,deco_block=1},
|
||||
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
@ -792,7 +792,7 @@ minetest.register_node("mcl_core:darksapling", {
|
|||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
stack_max = 64,
|
||||
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,deco_block=1},
|
||||
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
@ -936,7 +936,7 @@ minetest.register_node("mcl_core:junglesapling", {
|
|||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
stack_max = 64,
|
||||
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,deco_block=1},
|
||||
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
@ -1022,7 +1022,7 @@ minetest.register_node("mcl_core:acaciasapling", {
|
|||
node_placement_prediction = "",
|
||||
on_place = mcl_util.on_place_non_mycelium_plant,
|
||||
stack_max = 64,
|
||||
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,deco_block=1},
|
||||
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
_mcl_blast_resistance = 0,
|
||||
_mcl_hardness = 0,
|
||||
|
@ -1101,7 +1101,7 @@ minetest.register_node("mcl_core:sprucesapling", {
|
|||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
stack_max = 64,
|
||||
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,deco_block=1},
|
||||
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
@ -1181,7 +1181,7 @@ minetest.register_node("mcl_core:birchsapling", {
|
|||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
stack_max = 64,
|
||||
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,deco_block=1},
|
||||
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
@ -1461,7 +1461,7 @@ minetest.register_node("mcl_core:vine", {
|
|||
type = "wallmounted",
|
||||
},
|
||||
stack_max = 64,
|
||||
groups = {handy=1,axey=1,shearsy=1,swordy=1, flammable=2,deco_block=1,dig_by_piston=1},
|
||||
groups = {handy=1,axey=1,shearsy=1,swordy=1, flammable=2,deco_block=1,destroy_by_lava_flow=1,dig_by_piston=1},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
drop = "",
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, user)
|
||||
|
@ -1808,7 +1808,7 @@ minetest.register_node("mcl_core:deadbush", {
|
|||
walkable = false,
|
||||
stack_max = 64,
|
||||
buildable_to = true,
|
||||
groups = {dig_immediate=3, flammable=3,attached_node=1,plant=1,non_mycelium_plant=1,dig_by_water=1,deco_block=1},
|
||||
groups = {dig_immediate=3, flammable=3,attached_node=1,plant=1,non_mycelium_plant=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
|
@ -2023,7 +2023,7 @@ minetest.register_node("mcl_core:cobweb", {
|
|||
liquid_renewable = false,
|
||||
liquid_range = 0,
|
||||
walkable = false,
|
||||
groups = {swordy_cobweb=1,shearsy=1, deco_block=1, dig_by_piston=1},
|
||||
groups = {swordy_cobweb=1,shearsy=1, deco_block=1, dig_by_piston=1, destroy_by_lava_flow=1,},
|
||||
drop = "mcl_mobitems:string",
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
_mcl_blast_resistance = 20,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue