From b4bb986d61258954668e3243068b8e9219b5c395 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Nov 2017 14:16:04 +0100 Subject: [PATCH 01/14] Add river water --- mods/ITEMS/mclx_core/depends.txt | 2 + mods/ITEMS/mclx_core/description.txt | 1 + mods/ITEMS/mclx_core/init.lua | 50 ++++++++++++++++++ mods/ITEMS/mclx_core/mod.conf | 1 + .../default_river_water_flowing_animated.png | Bin 0 -> 601 bytes .../default_river_water_source_animated.png | Bin 0 -> 423 bytes mods/MAPGEN/mcl_mapgen_core/depends.txt | 1 + mods/MAPGEN/mcl_mapgen_core/init.lua | 6 ++- 8 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 mods/ITEMS/mclx_core/depends.txt create mode 100644 mods/ITEMS/mclx_core/description.txt create mode 100644 mods/ITEMS/mclx_core/init.lua create mode 100644 mods/ITEMS/mclx_core/mod.conf create mode 100644 mods/ITEMS/mclx_core/textures/default_river_water_flowing_animated.png create mode 100644 mods/ITEMS/mclx_core/textures/default_river_water_source_animated.png diff --git a/mods/ITEMS/mclx_core/depends.txt b/mods/ITEMS/mclx_core/depends.txt new file mode 100644 index 000000000..870d9cb09 --- /dev/null +++ b/mods/ITEMS/mclx_core/depends.txt @@ -0,0 +1,2 @@ +mcl_core +doc? diff --git a/mods/ITEMS/mclx_core/description.txt b/mods/ITEMS/mclx_core/description.txt new file mode 100644 index 000000000..422e6da57 --- /dev/null +++ b/mods/ITEMS/mclx_core/description.txt @@ -0,0 +1 @@ +Core items not found in Minecraft diff --git a/mods/ITEMS/mclx_core/init.lua b/mods/ITEMS/mclx_core/init.lua new file mode 100644 index 000000000..f16d57ba0 --- /dev/null +++ b/mods/ITEMS/mclx_core/init.lua @@ -0,0 +1,50 @@ +-- Liquids: River Water + +local source = table.copy(minetest.registered_nodes["mcl_core:water_source"]) +source.description = "Still River Water" +source.liquid_range = 2 +source.liquid_alternative_flowing = "mclx_core:river_water_flowing" +source.liquid_alternative_source = "mclx_core:river_water_source" +source._doc_items_longdesc = "River water has the same properties as water, but has a reduced flowing distance and is not renewable." +source._doc_items_entry_name = "River Water" +-- Auto-expose entry only in valleys mapgen +source._doc_items_hidden = minetest.get_mapgen_setting("mg_name") ~= "valleys" +source.post_effect_color = {a=204, r=0x2c, g=0x88, b=0x8c} +source.tiles = { + {name="default_river_water_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=5.0}} +} +source.special_tiles = { + -- New-style water source material (mostly unused) + { + name="default_river_water_source_animated.png", + animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=5.0}, + backface_culling = false, + } +} + +local flowing = table.copy(minetest.registered_nodes["mcl_core:water_flowing"]) +flowing.description = "Flowing River Water" +flowing.liquid_range = 2 +flowing.liquid_alternative_flowing = "mclx_core:river_water_flowing" +flowing.liquid_alternative_source = "mclx_core:river_water_source" +flowing.tiles = {"default_river_water_flowing_animated.png^[verticalframe:64:0"} +flowing.post_effect_color = {a=204, r=0x2c, g=0x88, b=0x8c} +flowing.special_tiles = { + { + image="default_river_water_flowing_animated.png", + backface_culling=false, + animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=4.0} + }, + { + image="default_river_water_flowing_animated.png", + backface_culling=true, + animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=4.0} + }, +} + +minetest.register_node("mclx_core:river_water_source", source) +minetest.register_node("mclx_core:river_water_flowing", flowing) + +if minetest.get_modpath("doc") then + doc.add_entry_alias("nodes", "mclx_core:river_water_source", "nodes", "mclx_core:river_water_flowing") +end diff --git a/mods/ITEMS/mclx_core/mod.conf b/mods/ITEMS/mclx_core/mod.conf new file mode 100644 index 000000000..235cf6d3f --- /dev/null +++ b/mods/ITEMS/mclx_core/mod.conf @@ -0,0 +1 @@ +name = mclx_core diff --git a/mods/ITEMS/mclx_core/textures/default_river_water_flowing_animated.png b/mods/ITEMS/mclx_core/textures/default_river_water_flowing_animated.png new file mode 100644 index 0000000000000000000000000000000000000000..9e126d3c1f488b6c1347b3ef51971c644959b6c0 GIT binary patch literal 601 zcmeAS@N?(olHy`uVBq!ia0vp^0t^f+3@pq*mXynpTR=)Wz$e62wYFKguvVwKL8qff zx31Z!yGOsNRja(tu%k0S^-U531LIFm7srqa#xvIqv)&kpv_33e+!?=G`OuDevN1d6 zt>nGwpdkI>jl#Wy%{hN86An3kXz?no|GCv(=W;|w!Q!V$2Oe24^{FzwG-VR6=+a~? z_M7)EZ^q1xR-HFbT=h7RY290}eg2IH4{sRTJq$iF>k_+xs>=~Ju@>vR6ROM)1j8pS z;eBrTm~;0fkJd_c9{$!?EeRI3##-})!xd5+)c>?jTWRpV<)Le$H!F9eV?w>`<4TXl zwZ1pl>K|~lE)+htXv5N`od?)H&tYr~OsE$A#<*X8!xDqCLlGj|G;&nV=f`MCuufy$ zW}Z0zK*@mxK#2<1p67uQaiV7723$JaZ&q{OKJc26yLBV4^r_2jM`IK7MbEILG5yXu zG%w*~gEkMB^l{~fa}DY>-mGn!c_1d?z3&a)KaP^eKhG&-mNN-TyvKQX$p(8-9wu&( zn;%#FDq$HkfJG_!KDo;i1h}S?-*52_iGNbMg6Vz2Txw zZiEllY;6hFXG|ca0gW>cw0-)MeVi`^81oElKcnwI*6#V!|No=?zx2QM|BnCvA^-nz cJwyP?VXB;`=cFaBc?G1y)78&qol`;+0Bu(RzW@LL literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mclx_core/textures/default_river_water_source_animated.png b/mods/ITEMS/mclx_core/textures/default_river_water_source_animated.png new file mode 100644 index 0000000000000000000000000000000000000000..fb8ae17bd7cd73950b6765bb68e602a345e6bc61 GIT binary patch literal 423 zcmV;Y0a*TtP)doS96hXX@d9>qopnXp$d62wg1!D2mb21$@m_6e^jh(rD!9z6#ru#SDITfk#p9rVT}(Zv)Hk7$SF1-`bn-MB5}mvt-ZhBV zms4rYye5wFXh*T$U{l+e>O%4!=JF`ci#KK7SV&EtP<`*?DED?0r{1U@i#IPZ_0y(C zkJUqA6pa>-l6P>$RH4L!dfh*xP<9%3l}#P|j@Ra+cr%JQwNffi>Us4-b}5Im9mVm^ zsXg1&TXw`h>F74ENuwN>!l~KR@<+jrVo&XBj;Zg3RHDoq%_!m(PR*o>_Xncb=V9~a RN$3Co002ovPDHLkV1j`V#V7y( literal 0 HcmV?d00001 diff --git a/mods/MAPGEN/mcl_mapgen_core/depends.txt b/mods/MAPGEN/mcl_mapgen_core/depends.txt index 56161d59b..9dc58fe69 100644 --- a/mods/MAPGEN/mcl_mapgen_core/depends.txt +++ b/mods/MAPGEN/mcl_mapgen_core/depends.txt @@ -1,5 +1,6 @@ mcl_init mcl_core +mclx_core? mcl_worlds mcl_cocoas mcl_stairs diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index d88e91d3b..c76cfc6c8 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -28,7 +28,11 @@ minetest.register_alias("mapgen_stone_with_iron", "mcl_core:stone_with_iron") minetest.register_alias("mapgen_desert_sand", "mcl_core:sand") minetest.register_alias("mapgen_desert_stone", "mcl_core:sandstone") minetest.register_alias("mapgen_sandstone", "mcl_core:sandstone") -minetest.register_alias("mapgen_river_water_source", "mcl_core:water_source") +if minetest.get_modpath("mclx_core") then + minetest.register_alias("mapgen_river_water_source", "mclx_core:river_water_source") +else + minetest.register_alias("mapgen_river_water_source", "mcl_core:water_source") +end minetest.register_alias("mapgen_snow", "mcl_core:snow") minetest.register_alias("mapgen_snowblock", "mcl_core:snowblock") minetest.register_alias("mapgen_ice", "mcl_core:ice") From 438039f3fb35f726c327fcedb57756392bd120a1 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Nov 2017 14:46:58 +0100 Subject: [PATCH 02/14] Add river water bucket --- mods/ITEMS/REDSTONE/mcl_dispensers/init.lua | 11 +++- mods/ITEMS/mcl_buckets/depends.txt | 1 + mods/ITEMS/mcl_buckets/init.lua | 53 ++++++++++++++---- .../textures/bucket_river_water.png | Bin 0 -> 212 bytes 4 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 mods/ITEMS/mcl_buckets/textures/bucket_river_water.png diff --git a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua index 725e549c8..685897e00 100644 --- a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua @@ -148,6 +148,9 @@ local dispenserdef = { elseif dropnode.name == "mcl_core:lava_source" or dropnode.name == "mcl_nether:nether_lava_source" then collect_liquid = true 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 if collect_liquid then minetest.set_node(droppos, {name="air"}) @@ -170,7 +173,7 @@ local dispenserdef = { stack:take_item() inv:set_stack("main", stack_id, stack) 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 if dropnodedef.buildable_to then local dim = mcl_worlds.pos_to_dimension(droppos) @@ -180,6 +183,12 @@ local dispenserdef = { else minetest.set_node(droppos, {name = "mcl_core:water_source"}) 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 if dim == "nether" then minetest.set_node(droppos, {name = "mcl_nether:nether_lava_source"}) diff --git a/mods/ITEMS/mcl_buckets/depends.txt b/mods/ITEMS/mcl_buckets/depends.txt index ad54e2405..eb9bca8d8 100644 --- a/mods/ITEMS/mcl_buckets/depends.txt +++ b/mods/ITEMS/mcl_buckets/depends.txt @@ -1,3 +1,4 @@ mcl_worlds mcl_core? +mclx_core? doc? diff --git a/mods/ITEMS/mcl_buckets/init.lua b/mods/ITEMS/mcl_buckets/init.lua index 48788db0a..c8a144540 100644 --- a/mods/ITEMS/mcl_buckets/init.lua +++ b/mods/ITEMS/mcl_buckets/init.lua @@ -7,6 +7,7 @@ minetest.register_alias("bucket:bucket_lava", "mcl_buckets:bucket_lava") local mod_doc = minetest.get_modpath("doc") local mod_mcl_core = minetest.get_modpath("mcl_core") +local mod_mclx_core = minetest.get_modpath("mclx_core") if mod_mcl_core then minetest.register_craft({ @@ -227,6 +228,24 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", { }) 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 mcl_buckets.register_liquid( "mcl_core:water_source", @@ -259,23 +278,35 @@ if mod_mcl_core then end end ) +end - -- Lava bucket +if mod_mclx_core then + -- River water bucket 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) + 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) if dim == "nether" then - return "mcl_nether:nether_lava_source" - else - return "mcl_core:lava_source" + minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}) + return false 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 diff --git a/mods/ITEMS/mcl_buckets/textures/bucket_river_water.png b/mods/ITEMS/mcl_buckets/textures/bucket_river_water.png new file mode 100644 index 0000000000000000000000000000000000000000..5e58c92f48730dac82c5df8fa658332a721187cd GIT binary patch literal 212 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFv3GfMV1=1&vA6&m?sg_rsPGXH- zW|KwJ6z3UBpFVjoxvwKTIj*Iy{QRe@>OggjB|(0{3=Yq3qyaf`o-U3d6^zLT*jQMn zia44q-sqXJfnkDTPFP%65@XViWy{+u7$m#Y7Al^b Date: Thu, 30 Nov 2017 14:57:40 +0100 Subject: [PATCH 03/14] Add water_bucket group --- GROUPS.md | 1 + mods/ITEMS/mcl_buckets/init.lua | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/GROUPS.md b/GROUPS.md index 94ef54b39..0b73a870d 100644 --- a/GROUPS.md +++ b/GROUPS.md @@ -73,6 +73,7 @@ Please read to learn how digging times * `wool=1`: Wool (only full blocks) * `carpet=1:` (Wool) carpet * `stick=1`: Stick +* `water_bucket=1`: Bucket containing a liquid of group “water” ### Material groups diff --git a/mods/ITEMS/mcl_buckets/init.lua b/mods/ITEMS/mcl_buckets/init.lua index c8a144540..d67cf07ba 100644 --- a/mods/ITEMS/mcl_buckets/init.lua +++ b/mods/ITEMS/mcl_buckets/init.lua @@ -48,9 +48,10 @@ end -- longdesc = long explanatory description (for help) -- usagehelp = short usage explanation (for help) -- extra_check = optional function(pos) which can returns false to avoid placing the liquid +-- groups = optional list of item groups -- -- This function can be called from any mod (which depends on this one) -function mcl_buckets.register_liquid(source_place, source_take, itemname, inventory_image, name, longdesc, usagehelp, extra_check) +function mcl_buckets.register_liquid(source_place, source_take, itemname, inventory_image, name, longdesc, usagehelp, extra_check, groups) for i=1, #source_take do mcl_buckets.liquids[source_take[i]] = { source_place = source_place, @@ -70,6 +71,7 @@ function mcl_buckets.register_liquid(source_place, source_take, itemname, invent inventory_image = inventory_image, stack_max = 16, liquids_pointable = true, + groups = groups, on_place = function(itemstack, user, pointed_thing) -- Must be pointing to node if pointed_thing.type ~= "node" then @@ -276,7 +278,8 @@ if mod_mcl_core then return false end end - end + end, + { water_bucket = 1 } ) end @@ -306,7 +309,8 @@ if mod_mclx_core then minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}) return false end - end + end, + { water_bucket = 1 } ) end From c47a762766950af2c1694f62616129d22504b38c Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Nov 2017 14:59:13 +0100 Subject: [PATCH 04/14] Fix river water bucket wieldview transform --- mods/ITEMS/minetest-3d_armor/wieldview/transform.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ITEMS/minetest-3d_armor/wieldview/transform.lua b/mods/ITEMS/minetest-3d_armor/wieldview/transform.lua index 26cfd6281..c1715b2c4 100644 --- a/mods/ITEMS/minetest-3d_armor/wieldview/transform.lua +++ b/mods/ITEMS/minetest-3d_armor/wieldview/transform.lua @@ -24,6 +24,7 @@ wieldview.transform = { ["mcl_flowers:tallgrass"]="R270", ["mcl_buckets:bucket_empty"]="R270", ["mcl_buckets:bucket_water"]="R270", + ["mcl_buckets:bucket_river_water"]="R270", ["mcl_buckets:bucket_lava"]="R270", ["mcl_mobitems:milk_bucket"]="R270", ["mcl_potions:glass_bottle"]="R270", From 135a214213c252839c7320fe404c6ec01663306b Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Nov 2017 15:01:33 +0100 Subject: [PATCH 05/14] Make river water non-renewable --- mods/ITEMS/mclx_core/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mods/ITEMS/mclx_core/init.lua b/mods/ITEMS/mclx_core/init.lua index f16d57ba0..929ec2137 100644 --- a/mods/ITEMS/mclx_core/init.lua +++ b/mods/ITEMS/mclx_core/init.lua @@ -5,6 +5,7 @@ source.description = "Still River Water" source.liquid_range = 2 source.liquid_alternative_flowing = "mclx_core:river_water_flowing" source.liquid_alternative_source = "mclx_core:river_water_source" +source.liquid_renewable = false source._doc_items_longdesc = "River water has the same properties as water, but has a reduced flowing distance and is not renewable." source._doc_items_entry_name = "River Water" -- Auto-expose entry only in valleys mapgen @@ -27,6 +28,7 @@ flowing.description = "Flowing River Water" flowing.liquid_range = 2 flowing.liquid_alternative_flowing = "mclx_core:river_water_flowing" flowing.liquid_alternative_source = "mclx_core:river_water_source" +flowing.liquid_renewable = false flowing.tiles = {"default_river_water_flowing_animated.png^[verticalframe:64:0"} flowing.post_effect_color = {a=204, r=0x2c, g=0x88, b=0x8c} flowing.special_tiles = { From 2093a6b5c27754e989b4a72c3012abf8372ade9d Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Nov 2017 15:36:17 +0100 Subject: [PATCH 06/14] Water mobs now swim in river water --- mods/ENTITIES/mobs_mc/0_gameconfig.lua | 1 + mods/ENTITIES/mobs_mc/guardian.lua | 2 +- mods/ENTITIES/mobs_mc/guardian_elder.lua | 2 +- mods/ENTITIES/mobs_mc/squid.lua | 3 +-- mods/ENTITIES/mobs_mc_gameconfig/init.lua | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/0_gameconfig.lua b/mods/ENTITIES/mobs_mc/0_gameconfig.lua index f9624abc5..8d43c54aa 100644 --- a/mods/ENTITIES/mobs_mc/0_gameconfig.lua +++ b/mods/ENTITIES/mobs_mc/0_gameconfig.lua @@ -81,6 +81,7 @@ mobs_mc.items = { gunpowder = "tnt:gunpowder", flint_and_steel = "fire:flint_and_steel", water_source = "default:water_source", + river_water_source = "default:river_water_source", black_dye = "dye:black", poppy = "flowers:rose", dandelion = "flowers:dandelion_yellow", diff --git a/mods/ENTITIES/mobs_mc/guardian.lua b/mods/ENTITIES/mobs_mc/guardian.lua index de9cac1dd..81f6f1791 100644 --- a/mods/ENTITIES/mobs_mc/guardian.lua +++ b/mods/ENTITIES/mobs_mc/guardian.lua @@ -73,7 +73,7 @@ mobs:register_mob("mobs_mc:guardian", { max = 1,}, }, fly = true, - fly_in = mobs_mc.items.water_source, + fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source }, view_range = 16, water_damage = 0, lava_damage = 4, diff --git a/mods/ENTITIES/mobs_mc/guardian_elder.lua b/mods/ENTITIES/mobs_mc/guardian_elder.lua index 27e21c450..45850d4bd 100644 --- a/mods/ENTITIES/mobs_mc/guardian_elder.lua +++ b/mods/ENTITIES/mobs_mc/guardian_elder.lua @@ -78,7 +78,7 @@ mobs:register_mob("mobs_mc:guardian_elder", { max = 1,}, }, fly = true, - fly_in = mobs_mc.items.water_source, + fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source }, water_damage = 0, lava_damage = 4, light_damage = 0, diff --git a/mods/ENTITIES/mobs_mc/squid.lua b/mods/ENTITIES/mobs_mc/squid.lua index 2ab401d1b..79e123e93 100644 --- a/mods/ENTITIES/mobs_mc/squid.lua +++ b/mods/ENTITIES/mobs_mc/squid.lua @@ -43,8 +43,7 @@ mobs:register_mob("mobs_mc:squid", { makes_footstep_sound = false, stepheight = 1.1, fly = true, - -- fly_in = mobs_mc.items.water_source, fuck this - fly_in = {"mcl_core:water_source", "default:water_source"}, + fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source }, jump = true, jump_height = 1.25, jump_chance = 98, diff --git a/mods/ENTITIES/mobs_mc_gameconfig/init.lua b/mods/ENTITIES/mobs_mc_gameconfig/init.lua index edd026215..ec50b12f9 100644 --- a/mods/ENTITIES/mobs_mc_gameconfig/init.lua +++ b/mods/ENTITIES/mobs_mc_gameconfig/init.lua @@ -55,6 +55,7 @@ mobs_mc.override.items = { gunpowder = "mcl_mobitems:gunpowder", flint_and_steel = "mcl_fire:flint_and_steel", water_source = "mcl_core:water_source", + river_water_source = "mclx_core:river_water_source", black_dye = "mcl_dye:black", poppy = "mcl_flowers:poppy", dandelion = "mcl_flowers:dandelion", From 443fb284cb9a9df3983f7c9cdb0b230e7d4817ff Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Nov 2017 17:36:08 +0100 Subject: [PATCH 07/14] 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 From 99af7618eebe9123c2131b5cc76321f033be8370 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Nov 2017 17:46:47 +0100 Subject: [PATCH 08/14] Fix mcl_sponges dependencies --- mods/ITEMS/mcl_sponges/depends.txt | 2 ++ mods/ITEMS/mcl_sponges/init.lua | 47 ++++++++++++++++-------------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/mods/ITEMS/mcl_sponges/depends.txt b/mods/ITEMS/mcl_sponges/depends.txt index 3d96266de..10e9d2909 100644 --- a/mods/ITEMS/mcl_sponges/depends.txt +++ b/mods/ITEMS/mcl_sponges/depends.txt @@ -1 +1,3 @@ mcl_sounds +mcl_core? +mclx_core? diff --git a/mods/ITEMS/mcl_sponges/init.lua b/mods/ITEMS/mcl_sponges/init.lua index dd42b7bf7..14e00726e 100644 --- a/mods/ITEMS/mcl_sponges/init.lua +++ b/mods/ITEMS/mcl_sponges/init.lua @@ -108,29 +108,32 @@ 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, -}) +if minetest.get_modpath("mclx_core") then + 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, + }) +end -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", From 142317c65a9480ad3f90ba392a1e69fc91f1c6ee Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Nov 2017 19:27:57 +0100 Subject: [PATCH 09/14] Add river water support for bottles and cauldrons --- GROUPS.md | 1 + mods/ITEMS/mcl_buckets/init.lua | 44 +++++++------ mods/ITEMS/mcl_cauldrons/depends.txt | 1 + mods/ITEMS/mcl_cauldrons/init.lua | 34 +++++++--- mods/ITEMS/mcl_potions/init.lua | 94 ++++++++++++++++++++++++---- 5 files changed, 133 insertions(+), 41 deletions(-) diff --git a/GROUPS.md b/GROUPS.md index 0b73a870d..d5a0b0632 100644 --- a/GROUPS.md +++ b/GROUPS.md @@ -50,6 +50,7 @@ Please read to learn how digging times * `destroys_items=1`: If an item happens to be *inside* this node, the item will be destroyed * `no_eat_delay=1`: Only for foodstuffs. When eating this, all eating delays are ignored. * `can_eat_when_full=1`: Only for foodstuffs. This item can be eaten when the user has a full hunger bar +* `cauldron`: Cauldron. 1: Empty. 2-4: Water height #### Footnotes diff --git a/mods/ITEMS/mcl_buckets/init.lua b/mods/ITEMS/mcl_buckets/init.lua index d67cf07ba..2a8142fce 100644 --- a/mods/ITEMS/mcl_buckets/init.lua +++ b/mods/ITEMS/mcl_buckets/init.lua @@ -206,6 +206,13 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", { new_bucket = ItemStack("mcl_buckets:bucket_water") end sound_take("mcl_core:water_source", pointed_thing.under) + elseif nn == "mcl_cauldrons:cauldron_3r" then + -- Take river water out of full cauldron + minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"}) + if not minetest.settings:get_bool("creative_mode") then + new_bucket = ItemStack("mcl_buckets:bucket_river_water") + end + sound_take("mclx_core:river_water_source", pointed_thing.under) end -- Add liquid bucket and put it into inventory, if possible. @@ -260,14 +267,11 @@ if mod_mcl_core then function(pos) local nn = minetest.get_node(pos).name -- Pour water into cauldron - if (nn == "mcl_cauldrons:cauldron" or - nn == "mcl_cauldrons:cauldron_1" or - nn == "mcl_cauldrons:cauldron_2") then + if minetest.get_item_group(nn, "cauldron") ~= 0 then -- Put water into cauldron - minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3"}) - sound_place("mcl_core:water_source", pos) - return false - elseif nn == "mcl_cauldrons:cauldron_3" then + if nn ~= "mcl_cauldrons:cauldron_3" then + minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3"}) + end sound_place("mcl_core:water_source", pos) return false -- Evaporate water if used in Nether (except on cauldron) @@ -295,19 +299,21 @@ if mod_mclx_core then "Right-click on any block to empty the bucket and put a river water source on this spot.", 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) - if dim == "nether" then - minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}) + -- Pour into cauldron + if minetest.get_item_group(nn, "cauldron") ~= 0 then + -- Put water into cauldron + if nn ~= "mcl_cauldrons:cauldron_3r" then + minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3r"}) + end + sound_place("mcl_core:water_source", pos) return false + else + -- Evaporate water if used in Nether (except on cauldron) + 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}) + return false + end end end, { water_bucket = 1 } diff --git a/mods/ITEMS/mcl_cauldrons/depends.txt b/mods/ITEMS/mcl_cauldrons/depends.txt index cbc0405cc..2c344c60c 100644 --- a/mods/ITEMS/mcl_cauldrons/depends.txt +++ b/mods/ITEMS/mcl_cauldrons/depends.txt @@ -1,3 +1,4 @@ mcl_core +mclx_core? mcl_sounds doc? diff --git a/mods/ITEMS/mcl_cauldrons/init.lua b/mods/ITEMS/mcl_cauldrons/init.lua index e2fa6852b..54363e2d4 100644 --- a/mods/ITEMS/mcl_cauldrons/init.lua +++ b/mods/ITEMS/mcl_cauldrons/init.lua @@ -51,7 +51,7 @@ minetest.register_node("mcl_cauldrons:cauldron", { paramtype = "light", is_ground_content = false, sunlight_propagates = true, - groups = {pickaxey=1, deco_block=1}, + groups = {pickaxey=1, deco_block=1, cauldron=1}, node_box = cauldron_nodeboxes[0], selection_box = { type = "regular" }, tiles = { @@ -65,20 +65,28 @@ minetest.register_node("mcl_cauldrons:cauldron", { }) -- Template function for cauldrons with water -local register_filled_cauldron = function(water_level, description) - minetest.register_node("mcl_cauldrons:cauldron_"..water_level, { +local register_filled_cauldron = function(water_level, description, river_water) + local id = "mcl_cauldrons:cauldron_"..water_level + local water_tex + if river_water then + id = id .. "r" + water_tex = "default_river_water_source_animated.png^[verticalframe:16:0" + else + water_tex = "default_water_source_animated.png^[verticalframe:16:0" + end + minetest.register_node(id, { description = description, _doc_items_create_entry = false, drawtype = "nodebox", paramtype = "light", is_ground_content = false, sunlight_propagates = true, - groups = {pickaxey=1, not_in_creative_inventory=1}, + groups = {pickaxey=1, not_in_creative_inventory=1, cauldron=(1+water_level)}, node_box = cauldron_nodeboxes[water_level], collision_box = cauldron_nodeboxes[0], selection_box = { type = "regular" }, tiles = { - "(default_water_source_animated.png^[verticalframe:16:0)^mcl_cauldrons_cauldron_top.png", + "("..water_tex..")^mcl_cauldrons_cauldron_top.png", "mcl_cauldrons_cauldron_inner.png^mcl_cauldrons_cauldron_bottom.png", "mcl_cauldrons_cauldron_side.png" }, @@ -90,14 +98,20 @@ local register_filled_cauldron = function(water_level, description) -- Add entry aliases for the Help if minetest.get_modpath("doc") then - doc.add_entry_alias("nodes", "mcl_cauldrons:cauldron", "nodes", "mcl_cauldrons:cauldron_"..water_level) + doc.add_entry_alias("nodes", "mcl_cauldrons:cauldron", "nodes", id) end end --- Filled crauldrons (3 levels) -register_filled_cauldron(1, "Cauldron (One Third Full)") -register_filled_cauldron(2, "Cauldron (Two Thirds Full)") -register_filled_cauldron(3, "Cauldron (Full)") +-- Filled cauldrons (3 levels) +register_filled_cauldron(1, "Cauldron (1/3 Water)") +register_filled_cauldron(2, "Cauldron (2/3 Water)") +register_filled_cauldron(3, "Cauldron (3/3 Water)") + +if minetest.get_modpath("mclx_core") then + register_filled_cauldron(1, "Cauldron (1/3 River Water)", true) + register_filled_cauldron(2, "Cauldron (2/3 River Water)", true) + register_filled_cauldron(3, "Cauldron (3/3 River Water)", true) +end minetest.register_craft({ output = "mcl_cauldrons:cauldron", diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index f6a796f84..791df6207 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -37,11 +37,13 @@ minetest.register_craftitem("mcl_potions:glass_bottle", { -- Try to fill glass bottle with water local get_water = false + local river_water = false if not def then -- Unknown node: no-op elseif def.groups and def.groups.water and def.liquidtype == "source" then -- Water source get_water = true + river_water = node.name == "mclx_core:river_water_source" -- Or reduce water level of cauldron by 1 elseif node.name == "mcl_cauldrons:cauldron_3" then get_water = true @@ -52,11 +54,28 @@ minetest.register_craftitem("mcl_potions:glass_bottle", { elseif node.name == "mcl_cauldrons:cauldron_1" then get_water = true minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"}) + elseif node.name == "mcl_cauldrons:cauldron_3r" then + get_water = true + river_water = true + minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2r"}) + elseif node.name == "mcl_cauldrons:cauldron_2r" then + get_water = true + river_water = true + minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_1r"}) + elseif node.name == "mcl_cauldrons:cauldron_1r" then + get_water = true + river_water = true + minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"}) end if get_water then -- Replace with water bottle, if possible, otherwise -- place the water potion at a place where's space - local water_bottle = ItemStack("mcl_potions:potion_water") + local water_bottle + if river_water then + water_bottle = ItemStack("mcl_potions:potion_river_water") + else + water_bottle = ItemStack("mcl_potions:potion_water") + end minetest.sound_play("mcl_potions_bottle_fill", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}) if itemstack:get_count() == 1 then return water_bottle @@ -93,6 +112,27 @@ local potion_image = function(colorstring, opacity) return "mcl_potions_potion_bottle_drinkable.png^(mcl_potions_potion_overlay.png^[colorize:"..colorstring..":"..tostring(opacity)..")" end +local cauldron_levels = { + -- start = { add water, add river water, take } + { "", "_1", "_1r", nil }, + { "_1", "_2", "_2", "" }, + { "_2", "_3", "_3", "_1" }, + { "_1r", "_2", "_2r", "" }, + { "_2r", "_3r", "_3r", "_1r" }, +} +local fill_cauldron = function(cauldron, water_type) + local base = "mcl_cauldrons:cauldron" + for i=1, #cauldron_levels do + if cauldron == base .. cauldron_levels[i][1] then + if water_type == "mclx_core:river_water_source" then + return base .. cauldron_levels[i][3] + else + return base .. cauldron_levels[i][2] + end + end + end +end + -- Itemstring of potions is “mcl_potions:potion_” minetest.register_craftitem("mcl_potions:potion_water", { @@ -102,7 +142,7 @@ minetest.register_craftitem("mcl_potions:potion_water", { stack_max = 1, inventory_image = potion_image("#0000FF"), wield_image = potion_image("#0000FF"), - groups = {brewitem=1, food=3, can_eat_when_full=1}, + groups = {brewitem=1, food=3, can_eat_when_full=1, water_bottle=1}, on_place = function(itemstack, placer, pointed_thing) if pointed_thing.type == "node" then local node = minetest.get_node(pointed_thing.under) @@ -115,17 +155,10 @@ minetest.register_craftitem("mcl_potions:potion_water", { end end + local cauldron = fill_cauldron(node.name, "mcl_core:water_source") + if cauldron then -- Increase water level of cauldron by 1 - if node.name == "mcl_cauldrons:cauldron" then - minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_1"}) - minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}) - return "mcl_potions:glass_bottle" - elseif node.name == "mcl_cauldrons:cauldron_1" then - minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2"}) - minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}) - return "mcl_potions:glass_bottle" - elseif node.name == "mcl_cauldrons:cauldron_2" then - minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_3"}) + minetest.set_node(pointed_thing.under, {name=cauldron}) minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}) return "mcl_potions:glass_bottle" end @@ -137,6 +170,43 @@ minetest.register_craftitem("mcl_potions:potion_water", { on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"), }) +minetest.register_craftitem("mcl_potions:potion_river_water", { + description = "River Water Bottle", + _doc_items_longdesc = "River water bottles can be used to brew potions and to fill cauldrons. Drinking it has no effect.", + _doc_items_usagehelp = "Wield it and rightclick to drink it. Rightclick a cauldron to put the river water into the cauldron.", + stack_max = 1, + inventory_image = potion_image("#0044FF"), + wield_image = potion_image("#0044FF"), + groups = {brewitem=1, food=3, can_eat_when_full=1, water_bottle=1}, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" then + local node = minetest.get_node(pointed_thing.under) + local def = minetest.registered_nodes[node.name] + + -- Call on_rightclick if the pointed node defines it + if placer and not placer:get_player_control().sneak then + if def and def.on_rightclick then + return def.on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack + end + end + + local cauldron = fill_cauldron(node.name, "mclx_core:river_water_source") + if cauldron then + -- Increase water level of cauldron by 1 + minetest.set_node(pointed_thing.under, {name=cauldron}) + minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}) + return "mcl_potions:glass_bottle" + end + end + + -- Drink the water by default + return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing) + end, + on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"), +}) + + + local how_to_drink = "To drink it, wield it, then rightclick." minetest.register_craftitem("mcl_potions:potion_awkward", { From c12e07d8c734a4aa26729645efb7899f4797a375 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Nov 2017 19:41:30 +0100 Subject: [PATCH 10/14] Remove brewing references from help --- mods/ITEMS/mcl_mobitems/init.lua | 8 ++++---- mods/ITEMS/mcl_nether/init.lua | 2 +- mods/ITEMS/mcl_potions/init.lua | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mods/ITEMS/mcl_mobitems/init.lua b/mods/ITEMS/mcl_mobitems/init.lua index 332520e36..574a6638a 100644 --- a/mods/ITEMS/mcl_mobitems/init.lua +++ b/mods/ITEMS/mcl_mobitems/init.lua @@ -157,7 +157,7 @@ minetest.register_craftitem("mcl_mobitems:milk_bucket", { minetest.register_craftitem("mcl_mobitems:spider_eye", { description = "Spider Eye", - _doc_items_longdesc = "Spider eyes are used mainly in crafting and brewing. If you're really desperate, you can eat a spider eye, but it will poison you briefly.", + _doc_items_longdesc = "Spider eyes are used mainly in crafting. If you're really desperate, you can eat a spider eye, but it will poison you briefly.", inventory_image = "mcl_mobitems_spider_eye.png", wield_image = "mcl_mobitems_spider_eye.png", on_place = minetest.item_eat(2), @@ -195,7 +195,7 @@ minetest.register_craftitem("mcl_mobitems:blaze_rod", { minetest.register_craftitem("mcl_mobitems:blaze_powder", { description = "Blaze Powder", - _doc_items_longdesc = "This item is mainly used for brewing potions and crafting.", + _doc_items_longdesc = "This item is mainly used for crafting.", wield_image = "mcl_mobitems_blaze_powder.png", inventory_image = "mcl_mobitems_blaze_powder.png", groups = { brewitem = 1 }, @@ -213,7 +213,7 @@ minetest.register_craftitem("mcl_mobitems:magma_cream", { minetest.register_craftitem("mcl_mobitems:ghast_tear", { description = "Ghast Tear", - _doc_items_longdesc = "A ghast tear is an item used in potion brewing. It is dropped from dead ghasts.", + _doc_items_longdesc = "A ghast tear is dropped from dead ghasts. It has no purpose yet.", wield_image = "mcl_mobitems_ghast_tear.png", inventory_image = "mcl_mobitems_ghast_tear.png", groups = { brewitem = 1 }, @@ -258,7 +258,7 @@ minetest.register_craftitem("mcl_mobitems:rabbit_hide", { minetest.register_craftitem("mcl_mobitems:rabbit_foot", { description = "Rabbit's Foot", - _doc_items_longdesc = "This item is used in brewing.", + _doc_items_longdesc = "This item currently has no purpose.", wield_image = "mcl_mobitems_rabbit_foot.png", inventory_image = "mcl_mobitems_rabbit_foot.png", groups = { brewitem = 1 }, diff --git a/mods/ITEMS/mcl_nether/init.lua b/mods/ITEMS/mcl_nether/init.lua index 0fe599a68..337b53a43 100644 --- a/mods/ITEMS/mcl_nether/init.lua +++ b/mods/ITEMS/mcl_nether/init.lua @@ -209,7 +209,7 @@ minetest.register_node("mcl_nether:quartz_smooth", { minetest.register_craftitem("mcl_nether:glowstone_dust", { description = "Glowstone Dust", - _doc_items_longdesc = "Glowstone dust is the dust which comes out of broken glowstones. It is mainly used in crafting and brewing.", + _doc_items_longdesc = "Glowstone dust is the dust which comes out of broken glowstones. It is mainly used in crafting.", inventory_image = "mcl_nether_glowstone_dust.png", stack_max = 64, groups = { craftitem=1 }, diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 791df6207..28f824e9c 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -1,4 +1,4 @@ -local brewhelp = "This item is used in potion brewing." +local brewhelp = "This item currently has no purpose." minetest.register_craftitem("mcl_potions:fermented_spider_eye", { description = "Fermented Spider Eye", @@ -18,7 +18,7 @@ minetest.register_craft({ minetest.register_craftitem("mcl_potions:glass_bottle", { description = "Glass Bottle", _doc_items_longdesc = "A glass bottle is used as a container for potions and can be used to collect water directly.", - _doc_items_usagehelp = "To collect water, it on a cauldron with water (which removes a level of water) or a water source (which removes no water).", + _doc_items_usagehelp = "To collect water, it on a cauldron with water (which removes a level of water) or any water source (which removes no water).", inventory_image = "mcl_potions_potion_bottle_empty.png", wield_image = "mcl_potions_potion_bottle_empty.png", groups = {brewitem=1}, @@ -137,7 +137,7 @@ end minetest.register_craftitem("mcl_potions:potion_water", { description = "Water Bottle", - _doc_items_longdesc = "Water bottles can be used to brew potions and to fill cauldrons. Drinking water has no effect.", + _doc_items_longdesc = "Water bottles can be used to fill cauldrons. Drinking water has no effect.", _doc_items_usagehelp = "Wield it and rightclick to drink it. Rightclick a cauldron to put the water into the cauldron.", stack_max = 1, inventory_image = potion_image("#0000FF"), @@ -172,7 +172,7 @@ minetest.register_craftitem("mcl_potions:potion_water", { minetest.register_craftitem("mcl_potions:potion_river_water", { description = "River Water Bottle", - _doc_items_longdesc = "River water bottles can be used to brew potions and to fill cauldrons. Drinking it has no effect.", + _doc_items_longdesc = "River water bottles can be used to fill cauldrons. Drinking it has no effect.", _doc_items_usagehelp = "Wield it and rightclick to drink it. Rightclick a cauldron to put the river water into the cauldron.", stack_max = 1, inventory_image = potion_image("#0044FF"), From 2a78471ef1817ed5488bb66ec0052236c75287b5 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Nov 2017 19:57:06 +0100 Subject: [PATCH 11/14] Fix cauldrons and rain --- mods/ENVIRONMENT/mcl_weather/rain.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/ENVIRONMENT/mcl_weather/rain.lua b/mods/ENVIRONMENT/mcl_weather/rain.lua index dde2af67a..ac046238a 100644 --- a/mods/ENVIRONMENT/mcl_weather/rain.lua +++ b/mods/ENVIRONMENT/mcl_weather/rain.lua @@ -221,6 +221,7 @@ if mcl_weather.allow_abm then interval = 56.0, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) + -- Rain is equivalent to a water bottle if mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) then if node.name == "mcl_cauldrons:cauldron" then minetest.set_node(pos, {name="mcl_cauldrons:cauldron_1"}) @@ -228,6 +229,11 @@ if mcl_weather.allow_abm then minetest.set_node(pos, {name="mcl_cauldrons:cauldron_2"}) elseif node.name == "mcl_cauldrons:cauldron_2" then minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3"}) + elseif node.name == "mcl_cauldrons:cauldron_1r" then + -- Intentional + minetest.set_node(pos, {name="mcl_cauldrons:cauldron_2"}) + elseif node.name == "mcl_cauldrons:cauldron_2r" then + minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3r"}) end end end From e2a441fed10b341a9a6d2ae6e350157a6afb8555 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Nov 2017 19:59:50 +0100 Subject: [PATCH 12/14] Fix banner washing off on river water cauldron --- mods/ITEMS/mcl_banners/init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/ITEMS/mcl_banners/init.lua b/mods/ITEMS/mcl_banners/init.lua index 91535064a..ca4d0f87a 100644 --- a/mods/ITEMS/mcl_banners/init.lua +++ b/mods/ITEMS/mcl_banners/init.lua @@ -197,6 +197,12 @@ for colorid, colortab in pairs(mcl_banners.colors) do new_node = "mcl_cauldrons:cauldron_1" elseif node_under.name == "mcl_cauldrons:cauldron_1" then new_node = "mcl_cauldrons:cauldron" + elseif node_under.name == "mcl_cauldrons:cauldron_3r" then + new_node = "mcl_cauldrons:cauldron_2r" + elseif node_under.name == "mcl_cauldrons:cauldron_2r" then + new_node = "mcl_cauldrons:cauldron_1r" + elseif node_under.name == "mcl_cauldrons:cauldron_1r" then + new_node = "mcl_cauldrons:cauldron" end if new_node then local imeta = itemstack:get_meta() From 74d5da78a174361d77a006436c206dea9d5b6d58 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Nov 2017 20:35:21 +0100 Subject: [PATCH 13/14] Simplify water mixing rules in cauldron --- mods/ENVIRONMENT/mcl_weather/rain.lua | 3 +-- mods/ITEMS/mcl_cauldrons/init.lua | 2 +- mods/ITEMS/mcl_potions/init.lua | 22 ++++++++++++---------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/rain.lua b/mods/ENVIRONMENT/mcl_weather/rain.lua index ac046238a..9b41b7b67 100644 --- a/mods/ENVIRONMENT/mcl_weather/rain.lua +++ b/mods/ENVIRONMENT/mcl_weather/rain.lua @@ -230,8 +230,7 @@ if mcl_weather.allow_abm then elseif node.name == "mcl_cauldrons:cauldron_2" then minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3"}) elseif node.name == "mcl_cauldrons:cauldron_1r" then - -- Intentional - minetest.set_node(pos, {name="mcl_cauldrons:cauldron_2"}) + minetest.set_node(pos, {name="mcl_cauldrons:cauldron_2r"}) elseif node.name == "mcl_cauldrons:cauldron_2r" then minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3r"}) end diff --git a/mods/ITEMS/mcl_cauldrons/init.lua b/mods/ITEMS/mcl_cauldrons/init.lua index 54363e2d4..440ac0317 100644 --- a/mods/ITEMS/mcl_cauldrons/init.lua +++ b/mods/ITEMS/mcl_cauldrons/init.lua @@ -43,7 +43,7 @@ end -- Empty cauldron minetest.register_node("mcl_cauldrons:cauldron", { description = "Cauldron", - _doc_items_longdesc = "Cauldrons are used to store water and slowly fill up under rain.", + _doc_items_longdesc = "Cauldrons are used to store water and slowly fill up under rain. They can also be used to wash off banners.", _doc_items_usagehelp = "Place a water pucket into the cauldron to fill it with water. Place an empty bucket on a full cauldron to retrieve the water. Place a water bottle into the cauldron to fill the cauldron to one third with water. Place a glass bottle in a cauldron with water to retrieve one third of the water. Use an emblazoned banner on a cauldron with water to wash off its top layer.", wield_image = "mcl_cauldrons_cauldron.png", inventory_image = "mcl_cauldrons_cauldron.png", diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 28f824e9c..c8b1f73c5 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -17,7 +17,7 @@ minetest.register_craft({ minetest.register_craftitem("mcl_potions:glass_bottle", { description = "Glass Bottle", - _doc_items_longdesc = "A glass bottle is used as a container for potions and can be used to collect water directly.", + _doc_items_longdesc = "A glass bottle is used as a container for liquids and can be used to collect water directly.", _doc_items_usagehelp = "To collect water, it on a cauldron with water (which removes a level of water) or any water source (which removes no water).", inventory_image = "mcl_potions_potion_bottle_empty.png", wield_image = "mcl_potions_potion_bottle_empty.png", @@ -102,7 +102,7 @@ minetest.register_craft( { } }) --- Tempalte function for creating images of filled potions +-- Template function for creating images of filled potions -- - colorstring must be a ColorString of form “#RRGGBB”, e.g. “#0000FF” for blue. -- - opacity is optional opacity from 0-255 (default: 127) local potion_image = function(colorstring, opacity) @@ -112,13 +112,15 @@ local potion_image = function(colorstring, opacity) return "mcl_potions_potion_bottle_drinkable.png^(mcl_potions_potion_overlay.png^[colorize:"..colorstring..":"..tostring(opacity)..")" end +-- Cauldron fill up rules: +-- Adding any water increases the water level by 1, preserving the current water type local cauldron_levels = { - -- start = { add water, add river water, take } - { "", "_1", "_1r", nil }, - { "_1", "_2", "_2", "" }, - { "_2", "_3", "_3", "_1" }, - { "_1r", "_2", "_2r", "" }, - { "_2r", "_3r", "_3r", "_1r" }, + -- start = { add water, add river water } + { "", "_1", "_1r" }, + { "_1", "_2", "_2" }, + { "_2", "_3", "_3" }, + { "_1r", "_2r", "_2r" }, + { "_2r", "_3r", "_3r" }, } local fill_cauldron = function(cauldron, water_type) local base = "mcl_cauldrons:cauldron" @@ -138,7 +140,7 @@ end minetest.register_craftitem("mcl_potions:potion_water", { description = "Water Bottle", _doc_items_longdesc = "Water bottles can be used to fill cauldrons. Drinking water has no effect.", - _doc_items_usagehelp = "Wield it and rightclick to drink it. Rightclick a cauldron to put the water into the cauldron.", + _doc_items_usagehelp = "Rightclick to drink. Rightclick a cauldron to pour the water into the cauldron.", stack_max = 1, inventory_image = potion_image("#0000FF"), wield_image = potion_image("#0000FF"), @@ -173,7 +175,7 @@ minetest.register_craftitem("mcl_potions:potion_water", { minetest.register_craftitem("mcl_potions:potion_river_water", { description = "River Water Bottle", _doc_items_longdesc = "River water bottles can be used to fill cauldrons. Drinking it has no effect.", - _doc_items_usagehelp = "Wield it and rightclick to drink it. Rightclick a cauldron to put the river water into the cauldron.", + _doc_items_usagehelp = "Rightclick to drink. Rightclick a cauldron to pour the river water into the cauldron.", stack_max = 1, inventory_image = potion_image("#0044FF"), wield_image = potion_image("#0044FF"), From 785b4a2ef7aafb9ba5f28b3717d8fa760e844418 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Nov 2017 21:08:28 +0100 Subject: [PATCH 14/14] Dispensers dispense water buckets into cauldrons --- mods/ITEMS/REDSTONE/mcl_dispensers/init.lua | 26 ++++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua index 685897e00..c279c1a09 100644 --- a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua @@ -63,11 +63,7 @@ local dispenserdef = { droppos = {x=pos.x, y=pos.y-1, z=pos.z} end local dropnode = minetest.get_node(droppos) - -- Do not dispense into solid nodes local dropnodedef = minetest.registered_nodes[dropnode.name] - if dropnodedef.walkable then - return - end local stacks = {} for i=1,inv:get_size("main") do local stack = inv:get_stack("main", i) @@ -83,8 +79,12 @@ local dispenserdef = { local iname = stack:get_name() local igroups = minetest.registered_items[iname].groups + -- Do not dispense into solid nodes. Exception: Water bucket into cauldron + if dropnodedef.walkable and not (minetest.get_item_group(dropnode.name, "cauldron") ~= 0 and (iname == "mcl_buckets:bucket_water" or iname == "mcl_buckets:bucket_river_water")) then + -- no-op + --[===[ Dispense item ]===] - if iname == "mcl_throwing:arrow" then + elseif iname == "mcl_throwing:arrow" then -- Shoot arrow local shootpos = vector.add(pos, vector.multiply(dropdir, 0.51)) local yaw = math.atan2(dropdir.z, dropdir.x) - math.pi/2 @@ -174,8 +174,17 @@ local dispenserdef = { inv:set_stack("main", stack_id, stack) end elseif iname == "mcl_buckets:bucket_water" or iname == "mcl_buckets:bucket_river_water" or iname == "mcl_buckets:bucket_lava" then + local do_empty = false -- Place water/lava source - if dropnodedef.buildable_to then + if minetest.get_item_group(dropnode.name, "cauldron") ~= 0 then + if iname == "mcl_buckets:bucket_water" then + minetest.set_node(droppos, {name = "mcl_cauldrons:cauldron_3"}) + do_empty = true + elseif iname == "mcl_buckets:bucket_river_water" then + minetest.set_node(droppos, {name = "mcl_cauldrons:cauldron_3r"}) + do_empty = true + end + elseif dropnodedef.buildable_to then local dim = mcl_worlds.pos_to_dimension(droppos) if iname == "mcl_buckets:bucket_water" then if dim == "nether" then @@ -183,20 +192,25 @@ local dispenserdef = { else minetest.set_node(droppos, {name = "mcl_core:water_source"}) end + do_empty = true 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 + do_empty = true elseif iname == "mcl_buckets:bucket_lava" then if dim == "nether" then minetest.set_node(droppos, {name = "mcl_nether:nether_lava_source"}) else minetest.set_node(droppos, {name = "mcl_core:lava_source"}) end + do_empty = true end + end + if do_empty then stack:take_item() inv:set_stack("main", stack_id, stack)