From 438039f3fb35f726c327fcedb57756392bd120a1 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Nov 2017 14:46:58 +0100 Subject: [PATCH] Add river water bucket --- mods/ITEMS/REDSTONE/mcl_dispensers/init.lua | 11 +++- mods/ITEMS/mcl_buckets/depends.txt | 1 + mods/ITEMS/mcl_buckets/init.lua | 53 ++++++++++++++---- .../textures/bucket_river_water.png | Bin 0 -> 212 bytes 4 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 mods/ITEMS/mcl_buckets/textures/bucket_river_water.png diff --git a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua index 725e549c8..685897e00 100644 --- a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua @@ -148,6 +148,9 @@ local dispenserdef = { elseif dropnode.name == "mcl_core:lava_source" or dropnode.name == "mcl_nether:nether_lava_source" then collect_liquid = true bucket_id = "mcl_buckets:bucket_lava" + elseif dropnode.name == "mclx_core:river_water_source" then + collect_liquid = true + bucket_id = "mcl_buckets:bucket_river_water" end if collect_liquid then minetest.set_node(droppos, {name="air"}) @@ -170,7 +173,7 @@ local dispenserdef = { stack:take_item() inv:set_stack("main", stack_id, stack) end - elseif iname == "mcl_buckets:bucket_water" or iname == "mcl_buckets:bucket_lava" then + elseif iname == "mcl_buckets:bucket_water" or iname == "mcl_buckets:bucket_river_water" or iname == "mcl_buckets:bucket_lava" then -- Place water/lava source if dropnodedef.buildable_to then local dim = mcl_worlds.pos_to_dimension(droppos) @@ -180,6 +183,12 @@ local dispenserdef = { else minetest.set_node(droppos, {name = "mcl_core:water_source"}) end + elseif iname == "mcl_buckets:bucket_river_water" then + if dim == "nether" then + minetest.sound_play("fire_extinguish_flame", {pos = droppos, gain = 0.25, max_hear_distance = 16}) + else + minetest.set_node(droppos, {name = "mclx_core:river_water_source"}) + end elseif iname == "mcl_buckets:bucket_lava" then if dim == "nether" then minetest.set_node(droppos, {name = "mcl_nether:nether_lava_source"}) diff --git a/mods/ITEMS/mcl_buckets/depends.txt b/mods/ITEMS/mcl_buckets/depends.txt index ad54e2405..eb9bca8d8 100644 --- a/mods/ITEMS/mcl_buckets/depends.txt +++ b/mods/ITEMS/mcl_buckets/depends.txt @@ -1,3 +1,4 @@ mcl_worlds mcl_core? +mclx_core? doc? diff --git a/mods/ITEMS/mcl_buckets/init.lua b/mods/ITEMS/mcl_buckets/init.lua index 48788db0a..c8a144540 100644 --- a/mods/ITEMS/mcl_buckets/init.lua +++ b/mods/ITEMS/mcl_buckets/init.lua @@ -7,6 +7,7 @@ minetest.register_alias("bucket:bucket_lava", "mcl_buckets:bucket_lava") local mod_doc = minetest.get_modpath("doc") local mod_mcl_core = minetest.get_modpath("mcl_core") +local mod_mclx_core = minetest.get_modpath("mclx_core") if mod_mcl_core then minetest.register_craft({ @@ -227,6 +228,24 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", { }) if mod_mcl_core then + -- Lava bucket + mcl_buckets.register_liquid( + function(pos) + local dim = mcl_worlds.pos_to_dimension(pos) + if dim == "nether" then + return "mcl_nether:nether_lava_source" + else + return "mcl_core:lava_source" + end + end, + {"mcl_core:lava_source", "mcl_nether:nether_lava_source"}, + "mcl_buckets:bucket_lava", + "bucket_lava.png", + "Lava Bucket", + "A bucket can be used to collect and release liquids. This one is filled with hot lava, safely contained inside. Use with caution.", + "Choose a place where you want to empty the bucket, then get in a safe spot somewhere above it. Be prepared to run away when something goes wrong as the lava will soon start to flow after placing. To empty the bucket (which places a lava source), right-click on your chosen place." + ) + -- Water bucket mcl_buckets.register_liquid( "mcl_core:water_source", @@ -259,23 +278,35 @@ if mod_mcl_core then end end ) +end - -- Lava bucket +if mod_mclx_core then + -- River water bucket mcl_buckets.register_liquid( + "mclx_core:river_water_source", + {"mclx_core:river_water_source"}, + "mcl_buckets:bucket_river_water", + "bucket_river_water.png", + "River Water Bucket", + "A bucket can be used to collect and release liquids. This one is filled with river water.", + "Right-click on any block to empty the bucket and put a river water source on this spot.", function(pos) + local nn = minetest.get_node(pos).name + -- TODO: Implement cauldron support. + -- Ignore cauldron + if (nn == "mcl_cauldrons:cauldron" or + nn == "mcl_cauldrons:cauldron_1" or + nn == "mcl_cauldrons:cauldron_2" or + nn == "mcl_cauldrons:cauldron_3") then + return false + end + -- Evaporate water if used in Nether (except on cauldron) local dim = mcl_worlds.pos_to_dimension(pos) if dim == "nether" then - return "mcl_nether:nether_lava_source" - else - return "mcl_core:lava_source" + minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}) + return false end - end, - {"mcl_core:lava_source", "mcl_nether:nether_lava_source"}, - "mcl_buckets:bucket_lava", - "bucket_lava.png", - "Lava Bucket", - "A bucket can be used to collect and release liquids. This one is filled with hot lava, safely contained inside. Use with caution.", - "Choose a place where you want to empty the bucket, then get in a safe spot somewhere above it. Be prepared to run away when something goes wrong as the lava will soon start to flow after placing. To empty the bucket (which places a lava source), right-click on your chosen place." + end ) end diff --git a/mods/ITEMS/mcl_buckets/textures/bucket_river_water.png b/mods/ITEMS/mcl_buckets/textures/bucket_river_water.png new file mode 100644 index 0000000000000000000000000000000000000000..5e58c92f48730dac82c5df8fa658332a721187cd GIT binary patch literal 212 zcmV;_04x8AP)cU#j)-exUW9&k&+^qL00001bW%=J06^y0W&i*H zUP(kjRCobnzy<^bl@viVqp?Y7umF%DY*t=YVgX{frl*H^02zuVp&`zaK*l7Ajt;?D zK*mnR4k685KnAB`qmcFjAcGsunA9jV8^mDPB&Y;b0#*%TfaQQP2mk<7jTP#A>m!-~ O0000