Soften bucket dependencies

This commit is contained in:
Wuzzy 2017-07-26 19:00:04 +02:00
parent bf86ec6d43
commit 34b89b05bc
2 changed files with 37 additions and 30 deletions

View File

@ -1,2 +1,2 @@
mcl_core mcl_core?
doc doc?

View File

@ -7,6 +7,10 @@ minetest.register_alias("bucket", "bucket:bucket_empty")
minetest.register_alias("bucket_water", "bucket:bucket_water") minetest.register_alias("bucket_water", "bucket:bucket_water")
minetest.register_alias("bucket_lava", "bucket:bucket_lava") minetest.register_alias("bucket_lava", "bucket:bucket_lava")
local mod_doc = minetest.get_modpath("doc")
local mod_mcl_core = minetest.get_modpath("mcl_core")
if mod_mcl_core then
minetest.register_craft({ minetest.register_craft({
output = 'bucket:bucket_empty 1', output = 'bucket:bucket_empty 1',
recipe = { recipe = {
@ -14,6 +18,7 @@ minetest.register_craft({
{'', 'mcl_core:iron_ingot', ''}, {'', 'mcl_core:iron_ingot', ''},
} }
}) })
end
bucket = {} bucket = {}
bucket.liquids = {} bucket.liquids = {}
@ -110,7 +115,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
return itemstack return itemstack
end end
place_liquid(pointed_thing.under, node, source, flowing, fullness) place_liquid(pointed_thing.under, node, source, flowing, fullness)
if doc.entry_exists("nodes", source) then if mod_doc and doc.entry_exists("nodes", source) then
doc.mark_entry_as_revealed(user:get_player_name(), "nodes", source) doc.mark_entry_as_revealed(user:get_player_name(), "nodes", source)
end end
else else
@ -123,7 +128,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
return itemstack return itemstack
end end
place_liquid(pointed_thing.above, node, source, flowing, fullness) place_liquid(pointed_thing.above, node, source, flowing, fullness)
if doc.entry_exists("nodes", source) then if mod_doc and doc.entry_exists("nodes", source) then
doc.mark_entry_as_revealed(user:get_player_name(), "nodes", source) doc.mark_entry_as_revealed(user:get_player_name(), "nodes", source)
end end
else else
@ -194,7 +199,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
minetest.add_node(pointed_thing.under, {name="air"}) minetest.add_node(pointed_thing.under, {name="air"})
sound_take(nn, pointed_thing.under) sound_take(nn, pointed_thing.under)
if doc.entry_exists("nodes", nn) then if mod_doc and doc.entry_exists("nodes", nn) then
doc.mark_entry_as_revealed(user:get_player_name(), "nodes", nn) doc.mark_entry_as_revealed(user:get_player_name(), "nodes", nn)
end end
@ -228,6 +233,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
end, end,
}) })
if mod_mcl_ore then
bucket.register_liquid( bucket.register_liquid(
"mcl_core:water_source", "mcl_core:water_source",
"mcl_core:water_flowing", "mcl_core:water_flowing",
@ -247,6 +253,7 @@ bucket.register_liquid(
"A bucket can be used to collect and release liquids. This one is filled with hot lava, safely contained inside. Use with caution.", "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." "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
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",