Add river water bucket

This commit is contained in:
Wuzzy 2017-11-30 14:46:58 +01:00
parent b4bb986d61
commit 438039f3fb
4 changed files with 53 additions and 12 deletions

View file

@ -148,6 +148,9 @@ local dispenserdef = {
elseif dropnode.name == "mcl_core:lava_source" or dropnode.name == "mcl_nether:nether_lava_source" then elseif dropnode.name == "mcl_core:lava_source" or dropnode.name == "mcl_nether:nether_lava_source" then
collect_liquid = true collect_liquid = true
bucket_id = "mcl_buckets:bucket_lava" 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 end
if collect_liquid then if collect_liquid then
minetest.set_node(droppos, {name="air"}) minetest.set_node(droppos, {name="air"})
@ -170,7 +173,7 @@ local dispenserdef = {
stack:take_item() stack:take_item()
inv:set_stack("main", stack_id, stack) inv:set_stack("main", stack_id, stack)
end 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 -- Place water/lava source
if dropnodedef.buildable_to then if dropnodedef.buildable_to then
local dim = mcl_worlds.pos_to_dimension(droppos) local dim = mcl_worlds.pos_to_dimension(droppos)
@ -180,6 +183,12 @@ local dispenserdef = {
else else
minetest.set_node(droppos, {name = "mcl_core:water_source"}) minetest.set_node(droppos, {name = "mcl_core:water_source"})
end 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 elseif iname == "mcl_buckets:bucket_lava" then
if dim == "nether" then if dim == "nether" then
minetest.set_node(droppos, {name = "mcl_nether:nether_lava_source"}) minetest.set_node(droppos, {name = "mcl_nether:nether_lava_source"})

View file

@ -1,3 +1,4 @@
mcl_worlds mcl_worlds
mcl_core? mcl_core?
mclx_core?
doc? doc?

View file

@ -7,6 +7,7 @@ minetest.register_alias("bucket:bucket_lava", "mcl_buckets:bucket_lava")
local mod_doc = minetest.get_modpath("doc") local mod_doc = minetest.get_modpath("doc")
local mod_mcl_core = minetest.get_modpath("mcl_core") local mod_mcl_core = minetest.get_modpath("mcl_core")
local mod_mclx_core = minetest.get_modpath("mclx_core")
if mod_mcl_core then if mod_mcl_core then
minetest.register_craft({ minetest.register_craft({
@ -227,6 +228,24 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
}) })
if mod_mcl_core then 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 -- Water bucket
mcl_buckets.register_liquid( mcl_buckets.register_liquid(
"mcl_core:water_source", "mcl_core:water_source",
@ -259,23 +278,35 @@ if mod_mcl_core then
end end
end end
) )
end
-- Lava bucket if mod_mclx_core then
-- River water bucket
mcl_buckets.register_liquid( 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) 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) local dim = mcl_worlds.pos_to_dimension(pos)
if dim == "nether" then if dim == "nether" then
return "mcl_nether:nether_lava_source" minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16})
else return false
return "mcl_core:lava_source" end
end 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B