diff --git a/mods/ITEMS/mcl_furnaces/init.lua b/mods/ITEMS/mcl_furnaces/init.lua index b6481e528a..9c37d5fa5b 100644 --- a/mods/ITEMS/mcl_furnaces/init.lua +++ b/mods/ITEMS/mcl_furnaces/init.lua @@ -193,10 +193,13 @@ local function furnace_node_timer(pos, elapsed) inv:add_item("dst", cooked.item) inv:set_stack("src", 1, aftercooked.items[1]) - -- Unique recipe: Put water into empty bucket after cooking wet sponge successfully - if srclist[1]:get_name() == "mcl_sponges:sponge_wet" then - if inv:get_stack("fuel", 1):get_name() == "mcl_buckets:bucket_empty" then + -- Unique recipe: Pour water into empty bucket after cooking wet sponge successfully + if inv:get_stack("fuel", 1):get_name() == "mcl_buckets:bucket_empty" then + if srclist[1]:get_name() == "mcl_sponges:sponge_wet" then inv:set_stack("fuel", 1, "mcl_buckets:bucket_water") + -- Also for river water + elseif srclist[1]:get_name() == "mcl_sponges:sponge_wet_river_water" then + inv:set_stack("fuel", 1, "mcl_buckets:bucket_river_water") end end diff --git a/mods/ITEMS/mcl_sponges/init.lua b/mods/ITEMS/mcl_sponges/init.lua index 841aae6a11..dd42b7bf7b 100644 --- a/mods/ITEMS/mcl_sponges/init.lua +++ b/mods/ITEMS/mcl_sponges/init.lua @@ -1,5 +1,9 @@ local absorb = function(pos) local change = false + -- Count number of absorbed river water vs other nodes + -- to determine the wet sponge type. + local river_water = 0 + local non_river_water = 0 local p, n for i=-3,3 do for j=-3,3 do @@ -9,11 +13,24 @@ local absorb = function(pos) if minetest.get_item_group(n.name, "water") ~= 0 then minetest.add_node(p, {name="air"}) change = true + if n.name == "mclx_core:river_water_source" or n.name == "mclx_core:river_water_flowing" then + river_water = river_water + 1 + else + non_river_water = non_river_water + 1 + end end end end end - return change + -- The dominant water type wins. In case of a tie, normal water wins. + -- This slight bias is intentional. + local sponge_type + if river_water > non_river_water then + sponge_type = "mcl_sponges:sponge_wet_river_water" + else + sponge_type = "mcl_sponges:sponge_wet" + end + return change, sponge_type end minetest.register_node("mcl_sponges:sponge", { @@ -59,8 +76,9 @@ minetest.register_node("mcl_sponges:sponge", { if on_water then -- Absorb water -- FIXME: pos is not always the right placement position because of pointed_thing - if absorb(pos) then - minetest.item_place_node(ItemStack("mcl_sponges:sponge_wet"), placer, pointed_thing) + local absorbed, wet_sponge = absorb(pos) + if absorbed then + minetest.item_place_node(ItemStack(wet_sponge), placer, pointed_thing) if not minetest.settings:get_bool("creative_mode") then itemstack:take_item() end @@ -74,8 +92,8 @@ minetest.register_node("mcl_sponges:sponge", { }) minetest.register_node("mcl_sponges:sponge_wet", { - description = "Wet Sponge", - _doc_items_longdesc = "Wet sponges can be dried in the furnace to turn it into (dry) sponge. When there's an empty bucket in the fuel slot of a furnace, water will pour into the bucket.", + description = "Waterlogged Sponge", + _doc_items_longdesc = "A waterlogged sponge can be dried in the furnace to turn it into (dry) sponge. When there's an empty bucket in the fuel slot of a furnace, the water will pour into the bucket.", drawtype = "normal", is_ground_content = false, tiles = {"mcl_sponges_sponge_wet.png"}, @@ -90,6 +108,29 @@ minetest.register_node("mcl_sponges:sponge_wet", { _mcl_hardness = 0.6, }) +minetest.register_node("mcl_sponges:sponge_wet_river_water", { + description = "Riverwaterlogged Sponge", + _doc_items_longdesc = "A sponge full of river water. It can be dried in the furnace to turn it into (dry) sponge. When there's an empty bucket in the fuel slot of the furnace, the river water will pour into the bucket.", + drawtype = "normal", + is_ground_content = false, + tiles = {"mcl_sponges_sponge_wet_river_water.png"}, + walkable = true, + pointable = true, + diggable = true, + buildable_to = false, + stack_max = 64, + sounds = mcl_sounds.node_sound_dirt_defaults(), + groups = {handy=1, building_block=1}, + _mcl_blast_resistance = 3, + _mcl_hardness = 0.6, +}) + +minetest.register_craft({ + type = "cooking", + output = "mcl_sponges:sponge", + recipe = "mcl_sponges:sponge_wet_river_water", + cooktime = 10, +}) minetest.register_craft({ type = "cooking", output = "mcl_sponges:sponge", @@ -104,8 +145,9 @@ minetest.register_abm({ interval = 1, chance = 1, action = function(pos) - if absorb(pos) then - minetest.add_node(pos, {name = "mcl_sponges:sponge_wet"}) + local absorbed, wet_sponge = absorb(pos) + if absorbed then + minetest.add_node(pos, {name = wet_sponge}) end end, }) diff --git a/mods/ITEMS/mcl_sponges/textures/mcl_sponges_sponge_wet_river_water.png b/mods/ITEMS/mcl_sponges/textures/mcl_sponges_sponge_wet_river_water.png new file mode 100644 index 0000000000..5d9475a564 Binary files /dev/null and b/mods/ITEMS/mcl_sponges/textures/mcl_sponges_sponge_wet_river_water.png differ