forked from MineClone5/MineClone5
Make water/lava interactions much more MC-like
This commit is contained in:
parent
e017229c73
commit
0fe26b785e
|
@ -1,36 +1,41 @@
|
||||||
--
|
--
|
||||||
-- Lavacooling
|
-- Lava vs water interactions
|
||||||
--
|
--
|
||||||
|
|
||||||
mcl_core.cool_lava_source = function(pos)
|
|
||||||
minetest.set_node(pos, {name="mcl_core:obsidian"})
|
|
||||||
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", {pos = pos, gain = 0.25, max_hear_distance = 16})
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Flowing lava cooling",
|
label = "Lava cooling",
|
||||||
nodenames = {"mcl_core:lava_flowing"},
|
nodenames = {"group:lava"},
|
||||||
neighbors = {"group:water"},
|
neighbors = {"group:water"},
|
||||||
interval = 1,
|
interval = 1,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
mcl_core.cool_lava_flowing(pos, node, active_object_count, active_object_count_wider)
|
local water = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+1, z=pos.z+1}, "group:water")
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
local lavatype = minetest.registered_nodes[node.name].liquidtype
|
||||||
label = "Lava source cooling",
|
|
||||||
nodenames = {"mcl_core:lava_source"},
|
for w=1, #water do
|
||||||
neighbors = {"group:water"},
|
local waternode = minetest.get_node(water[w])
|
||||||
interval = 1,
|
local watertype = minetest.registered_nodes[waternode.name].liquidtype
|
||||||
chance = 1,
|
-- Lava on top of water: Water turns into stone
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
if water[w].y < pos.y and water[w].x == pos.x and water[w].z == pos.z then
|
||||||
mcl_core.cool_lava_source(pos, node, active_object_count, active_object_count_wider)
|
minetest.set_node(water[w], {name="mcl_core:stone"})
|
||||||
|
minetest.sound_play("fire_extinguish_flame", {pos = water[w], gain = 0.25, max_hear_distance = 16})
|
||||||
|
-- Flowing lava vs water on same level: Lava turns into cobblestone
|
||||||
|
elseif lavatype == "flowing" and water[w].y == pos.y and (water[w].x == pos.x or water[w].z == pos.z) then
|
||||||
|
minetest.set_node(pos, {name="mcl_core:cobble"})
|
||||||
|
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16})
|
||||||
|
-- Still lava vs flowing water above or horizontally neighbored: Lava turns into obsidian
|
||||||
|
elseif lavatype == "source" and
|
||||||
|
((water[w].y > pos.y and water[w].x == pos.x and water[w].z == pos.z) or
|
||||||
|
(water[w].y == pos.y and (water[w].x == pos.x or water[w].z == pos.z))) then
|
||||||
|
minetest.set_node(pos, {name="mcl_core:obsidian"})
|
||||||
|
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16})
|
||||||
|
-- Flowing water above flowing lava: Lava turns into cobblestone
|
||||||
|
elseif watertype == "flowing" and lavatype == "flowing" and water[w].y > pos.y and water[w].x == pos.x and water[w].z == pos.z then
|
||||||
|
minetest.set_node(pos, {name="mcl_core:cobble"})
|
||||||
|
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16})
|
||||||
|
end
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue