From de43421ba772f59dd17614ad522f4d866729ca04 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Tue, 24 Jan 2017 15:11:29 -0700 Subject: [PATCH] add a "spring" node for creative mode that's more generic (and less vigorous) than the damp clay --- description.txt | 2 +- init.lua | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/description.txt b/description.txt index a0b908a..ad85675 100644 --- a/description.txt +++ b/description.txt @@ -1,4 +1,4 @@ -Flowing dynamic liquids and ocean-maintenance springs. v0.3 +Flowing dynamic liquids and ocean-maintenance springs. v0.4 Github: https://github.com/FaceDeer/dynamic_liquid/ Forum: https://forum.minetest.net/viewtopic.php?t=16485 diff --git a/init.lua b/init.lua index 703bbaf..0d3a0a4 100644 --- a/init.lua +++ b/init.lua @@ -120,6 +120,9 @@ end -- spring clay to turn into unknown nodes. local clay_def = duplicate_def("default:clay") clay_def.description = "Damp Clay" +if not springs then + clay_def.groups.not_in_creative_inventory = 1 -- take it out of creative inventory though +end minetest.register_node("dynamic_liquid:clay", clay_def) if springs then @@ -165,4 +168,33 @@ if springs then end end }) + + -- This is a creative-mode only node that produces a modest amount of water continuously no matter where it is. + -- Allow this one to turn into "unknown node" when this feature is disabled, since players had to explicitly place it. + minetest.register_node("dynamic_liquid:spring", { + description = "Spring", + drops = "default:gravel", + tiles = {"default_cobble.png^[combine:16x80:0,-48=crack_anylength.png", + "default_cobble.png","default_cobble.png","default_cobble.png","default_cobble.png","default_cobble.png", + }, + is_ground_content = false, + groups = {cracky = 3, stone = 2}, + sounds = default.node_sound_gravel_defaults(), + }) + + minetest.register_abm({ + nodenames = {"dynamic_liquid:spring"}, + neighbors = {"air", "default:water_flowing"}, + interval = 1, + chance = 1, + catch_up = false, + action = function(pos,node) + pos.y = pos.y + 1 + check_node = get_node(pos) + check_node_name = check_node.name + if check_node_name == "air" or check_node_name == "default:water_flowing" then + set_node(pos, {name="default:water_source"}) + end + end + }) end \ No newline at end of file