From 443fb284cb9a9df3983f7c9cdb0b230e7d4817ff Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Nov 2017 17:36:08 +0100 Subject: [PATCH] Add riverwaterlogged sponge, rename wet sponge --- mods/ITEMS/mcl_furnaces/init.lua | 9 ++- mods/ITEMS/mcl_sponges/init.lua | 56 +++++++++++++++--- .../mcl_sponges_sponge_wet_river_water.png | Bin 0 -> 177 bytes 3 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 mods/ITEMS/mcl_sponges/textures/mcl_sponges_sponge_wet_river_water.png diff --git a/mods/ITEMS/mcl_furnaces/init.lua b/mods/ITEMS/mcl_furnaces/init.lua index b6481e528..9c37d5fa5 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 841aae6a1..dd42b7bf7 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 0000000000000000000000000000000000000000..5d9475a5642b23a28d5e9c0be289372bd1ae692f GIT binary patch literal 177 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPHV5AX?bT{$Cva!*!8jB8JM`1Vze zt?iSR0HtC*T^vIy7+DVn&TLNLVc78HJwNdxd8WNdyUo>QzfPN0A6au!@wr6eTf@rkQ`V<` ZGlz$8tg!86uLN4e;OXk;vd$@?2>{|YL*W1b literal 0 HcmV?d00001