diff --git a/mods/ITEMS/mcl_buckets/register.lua b/mods/ITEMS/mcl_buckets/register.lua index 4a64251166..b54d0d2bfa 100644 --- a/mods/ITEMS/mcl_buckets/register.lua +++ b/mods/ITEMS/mcl_buckets/register.lua @@ -1,7 +1,6 @@ local S = minetest.get_translator(minetest.get_current_modname()) local mod_mcl_core = minetest.get_modpath("mcl_core") local mod_mclx_core = minetest.get_modpath("mclx_core") -local mod_mobs_mc = minetest.get_modpath("mobs_mc") local has_awards = minetest.get_modpath("awards") local function sound_place(itemname, pos) @@ -121,36 +120,36 @@ minetest.register_craft({ }) -- Fish Buckets -if mod_mobs_mc then - fish_names = { - { techname = "cod", name = "Cod" }, - { techname = "salmon", name = "Salmon" }, - --{ techname = "pufferfish", name = "Pufferfish" } FIXME: Uncomment when pufferfish mobs are added. - { techname = "tropical_fish", name = "Tropical Fish" } - } - - for _, fish in pairs(fish_names) do - mcl_buckets.register_liquid({ - bucketname = "mcl_buckets:bucket_" .. fish.techname, - source_place = function(pos) - minetest.add_entity(pos, "mobs_mc:" .. fish.techname) - return "mcl_core:water_source" - end, - source_take = {"mobs_mc:" .. fish.techname}, - inventory_image = fish.techname .. "_bucket.png", - name = S("Bucket of @1", S(fish.name)), - longdesc = S("This bucket is filled with water and @1.", S(fish.name)), - usagehelp = S("Place it to empty the bucket and place a @1. Obtain by right clicking on a @2 fish with a bucket of water.", S(fish.name), S(fish.name)), - tt_help = S("Places a water source and a @1 fish.", S(fish.name)), - extra_check = function(pos, placer) - local nn = minetest.get_node(pos).name - local dim = mcl_worlds.pos_to_dimension(pos) - if dim == "nether" then - minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true) - return false, true - end - end, - }) - minetest.register_alias("mcl_fishing:bucket_" .. fish.techname, "mcl_buckets:bucket_" .. fish.techname) - end +fish_names = { + { techname = "cod", name = "Cod" }, + { techname = "salmon", name = "Salmon" }, + --{ techname = "pufferfish", name = "Pufferfish" } FIXME: Uncomment when pufferfish mobs are added. + { techname = "tropical_fish", name = "Tropical Fish" } +} + +for _, fish in pairs(fish_names) do + mcl_buckets.register_liquid({ + bucketname = "mcl_buckets:bucket_" .. fish.techname, + source_place = function(pos) + minetest.add_entity(pos, "mobs_mc:" .. fish.techname) + return "mcl_core:water_source" + end, + source_take = {"mobs_mc:" .. fish.techname}, + inventory_image = fish.techname .. "_bucket.png", + name = S("Bucket of @1", S(fish.name)), + longdesc = S("This bucket is filled with water and @1.", S(fish.name)), + usagehelp = S("Place it to empty the bucket and place a @1. Obtain by right clicking on a @2 fish with a bucket of water.", S(fish.name), S(fish.name)), + tt_help = S("Places a water source and a @1 fish.", S(fish.name)), + extra_check = function(pos, placer) + local dim = mcl_worlds.pos_to_dimension(pos) + if dim == "nether" then + minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true) + return false, true + else + return true, true + end + end, + }) + minetest.register_alias("mcl_fishing:bucket_" .. fish.techname, "mcl_buckets:bucket_" .. fish.techname) end +