From 0d68282b81ace03ce5b6302f7ed30aa35c25c2b3 Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 17 Feb 2022 13:25:11 +0100 Subject: [PATCH 01/12] Fix composter item image * Less is more (thanks AFCMS) --- mods/ITEMS/mcl_composters/init.lua | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index d77fd4e31..1fec4cf4a 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -223,7 +223,6 @@ local function composter_get_nodeboxes(level) } end -local composter_wieldimg = minetest.inventorycube("mcl_composter_top.png", "mcl_composter_side.png", "mcl_composter_side.png") -- -- Register empty composter -- This is the base model that is craftable and can be placed in an inventory @@ -233,10 +232,6 @@ minetest.register_node("mcl_composters:composter", { _tt_help = S("Converts organic items into bonemeal"), _doc_items_longdesc = composter_longdesc, _doc_items_usagehelp = composter_usagehelp, - -- FIXME: mcl_composter_side.png is fugly. maybe somehow use minetest.inventorycube(img1, img2, img3) - -- eeeww, that is also ugly and weird - inventory_image = composter_wieldimg, - --inventory_image = "mcl_composter_side.png", paramtype = "light", drawtype = "nodebox", node_box = composter_get_nodeboxes(0), From 1e72c1243bb8f9ce139d559bd484e120e43e09f0 Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 17 Feb 2022 13:46:21 +0100 Subject: [PATCH 02/12] Update documentation. * Make a mention of the one second delay before composter readies. --- mods/ITEMS/mcl_composters/init.lua | 5 +++-- mods/ITEMS/mcl_composters/locale/template.txt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index 1fec4cf4a..0bb0dc969 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -18,8 +18,9 @@ local composter_usagehelp = S( "Every time an item is put in the composter, there is a chance that the " .. "composter adds another layer of compost. Some items have a bigger chance " .. "of adding an extra layer than other items. After filling up with 7 layers " .. - "of compost, the composter is full and bone meal can be retrieved from it. " .. - "Taking out the bone meal empties the composter." + "of compost, the composter is full. After a delay of approximately one " .. + "second the composter becomes ready and bone meal can be retrieved from it. " .. + "Right-clicking the composter takes out the bone meal empties the composter." ) minetest.register_craft({ diff --git a/mods/ITEMS/mcl_composters/locale/template.txt b/mods/ITEMS/mcl_composters/locale/template.txt index b882113c4..c5f9bb858 100644 --- a/mods/ITEMS/mcl_composters/locale/template.txt +++ b/mods/ITEMS/mcl_composters/locale/template.txt @@ -1,7 +1,7 @@ # textdomain: mcl_composters Composter= Composters can convert various organic items into bonemeal.= -Use organic items on the composter to fill it with layers of compost. Every time an item is put in the composter, there is a chance that the composter adds another layer of compost. Some items have a bigger chance of adding an extra layer than other items. After filling up with 7 layers of compost, the composter is full and bone meal can be retrieved from it. Taking out the bone meal empties the composter.= +Use organic items on the composter to fill it with layers of compost. Every time an item is put in the composter, there is a chance that the composter adds another layer of compost. Some items have a bigger chance of adding an extra layer than other items. After filling up with 7 layers of compost, the composter is full. After a delay of approximately one second the composter becomes ready and bone meal can be retrieved from it. Right-clicking the composter takes out the bone meal empties the composter."= filled= ready for harvest= Converts organic items into bonemeal= From 72aba1d8bb44e849c8384199027c4e397a85fcdb Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 17 Feb 2022 13:54:08 +0100 Subject: [PATCH 03/12] Typo fix. * it's a spruceSapling (thanks NO11) --- mods/ITEMS/mcl_composters/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index 0bb0dc969..819869876 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -125,7 +125,7 @@ local compostability = { ["mcl_core:birchsapling"] = 30, ["mcl_core:darksapling"] = 30, ["mcl_core:junglesapling"] = 30, - ["mcl_core:spruceapling"] = 30, + ["mcl_core:sprucesapling"] = 30, ["mcl_ocean:seagrass"] = 30, -- missing: small dripleaf ["mcl_sweet_berry:sweet_berry"] = 30, From 9ef9530c044bbc747a361ea8895eb1af04e97db5 Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 17 Feb 2022 14:03:25 +0100 Subject: [PATCH 04/12] Update mod deps * Add dependency on mcl_dye for bone meal particle spawner. --- mods/ITEMS/mcl_composters/mod.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_composters/mod.conf b/mods/ITEMS/mcl_composters/mod.conf index 6ae5ff3e6..845a0d325 100644 --- a/mods/ITEMS/mcl_composters/mod.conf +++ b/mods/ITEMS/mcl_composters/mod.conf @@ -1,5 +1,5 @@ name = mcl_composters author = kabou description = composters -depends = mcl_core, mcl_sounds +depends = mcl_core, mcl_sounds, mcl_dye optional_depends = doc From 4cb3c6d51b91b8f33bd86775834647e0f2fb6116 Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 17 Feb 2022 14:24:55 +0100 Subject: [PATCH 05/12] Add player object check. * Handle the case where a mob somehow "clicks" on a composter and we get an invalid player object passed. --- mods/ITEMS/mcl_composters/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index 819869876..e36d66641 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -139,7 +139,7 @@ local function composter_add_item(pos, node, player, itemstack, pointed_thing) -- handle filling the composter when rightclicked -- as an on_rightclick handles, it returns an itemstack -- - if not player or player:get_player_control().sneak then + if not player or (player:get_player_control() and player:get_player_control().sneak) then return itemstack end if not itemstack and itemstack:is_empty() then From 77b020e1ecae1b678ef43353fcea5a3c7f0ccaf1 Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 17 Feb 2022 14:37:51 +0100 Subject: [PATCH 06/12] Add missing melon block. * Add melon block to the compostabiles list. --- mods/ITEMS/mcl_composters/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index e36d66641..1accfe493 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -70,7 +70,7 @@ local compostability = { ["mcl_flowers:rose_bush"] = 65, ["mcl_flowers:sunflower"] = 65, ["mcl_flowers:waterlily"] = 65, - -- missing: melon block? + ["mcl_farming:melon"] = 65, -- missing: moss block? -- mushroom aliases below? ["mcl_farming:mushroom_brown"] = 65, From b138357b118b739567e34e5202d9da4ee7deb164 Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 17 Feb 2022 15:39:10 +0100 Subject: [PATCH 07/12] Update mod description and fix comment. * Make mod description more descriptive. * Minor comment tweak. --- mods/ITEMS/mcl_composters/init.lua | 2 +- mods/ITEMS/mcl_composters/mod.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index 1accfe493..7d2a05823 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -136,7 +136,7 @@ local compostability = { local function composter_add_item(pos, node, player, itemstack, pointed_thing) -- - -- handle filling the composter when rightclicked + -- handles filling the composter when rightclicked -- as an on_rightclick handles, it returns an itemstack -- if not player or (player:get_player_control() and player:get_player_control().sneak) then diff --git a/mods/ITEMS/mcl_composters/mod.conf b/mods/ITEMS/mcl_composters/mod.conf index 845a0d325..86d729887 100644 --- a/mods/ITEMS/mcl_composters/mod.conf +++ b/mods/ITEMS/mcl_composters/mod.conf @@ -1,5 +1,5 @@ name = mcl_composters author = kabou -description = composters +description = Composters can convert various organic items into bonemeal. depends = mcl_core, mcl_sounds, mcl_dye optional_depends = doc From 3494fa80b51aa1dd493169fd70251043d33c13f9 Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 17 Feb 2022 21:42:33 +0100 Subject: [PATCH 08/12] Comment fixes. * Improve comments, some typo fixes. --- mods/ITEMS/mcl_composters/init.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index 7d2a05823..8a900a155 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -136,8 +136,9 @@ local compostability = { local function composter_add_item(pos, node, player, itemstack, pointed_thing) -- - -- handles filling the composter when rightclicked - -- as an on_rightclick handles, it returns an itemstack + -- handler for filling the composter when rightclicked + -- + -- as an on_rightclick handler, it returns an itemstack -- if not player or (player:get_player_control() and player:get_player_control().sneak) then return itemstack @@ -181,8 +182,9 @@ end local function composter_ready(pos) -- -- update the composter block to ready for harvesting - -- this function is a callback on_timer. + -- this function is a node callback on_timer. -- the timer is set in function 'composter_fill' when composter level is 7 + -- -- returns false in order to cancel further activity of the timer -- minetest.swap_node(pos, {name = "mcl_composters:composter_ready"}) @@ -193,14 +195,14 @@ end local function composter_harvest(pos, node, player, itemstack, pointed_thing) -- - -- handle harvesting bone meal from a ready composter when rightclicked + -- handler for harvesting bone meal from a ready composter when rightclicked -- if not player or player:get_player_control().sneak then return end - -- reset composter to empty + -- reset ready type composter to empty type minetest.swap_node(pos, {name="mcl_composters:composter"}) - -- spawn bone meal item (wtf dye?! is this how the make white cocoa) + -- spawn bone meal item (wtf dye?! is this how they make white cocoa) minetest.add_item(pos, "mcl_dye:white") -- TODO play some sounds @@ -208,7 +210,7 @@ end local function composter_get_nodeboxes(level) -- - -- Convenience function because the composter nodeboxes are very similar + -- Convenience function to construct the nodeboxes for varying levels of compost -- local top_y_tbl = {[0]=-7, -5, -3, -1, 1, 3, 5, 7} local top_y = top_y_tbl[level] / 16 @@ -225,7 +227,7 @@ local function composter_get_nodeboxes(level) end -- --- Register empty composter +-- Register empty composter node -- This is the base model that is craftable and can be placed in an inventory -- minetest.register_node("mcl_composters:composter", { From f6ec8e94d25869bf491edfbd11625c7e3ddd786a Mon Sep 17 00:00:00 2001 From: kabou Date: Thu, 17 Feb 2022 21:53:08 +0100 Subject: [PATCH 09/12] Add help alias * Add help alias for the ready type composter --- mods/ITEMS/mcl_composters/init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index 8a900a155..2c95bc71e 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -335,3 +335,9 @@ minetest.register_node("mcl_composters:composter_ready", { _compost_level = 7, on_rightclick = composter_harvest }) + +-- Add entry aliases for the Help +if minetest.get_modpath("doc") then + doc.add_entry_alias("nodes", "mcl_composters:composter", + "nodes", "mcl_composters:composter_ready" ) +end From b8af8cacd58003d43c58f40f3aad6f522e4062d4 Mon Sep 17 00:00:00 2001 From: kabou Date: Fri, 18 Feb 2022 16:54:07 +0100 Subject: [PATCH 10/12] Add player object check. * Add one more check if player object is an actual player. --- mods/ITEMS/mcl_composters/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index 2c95bc71e..5684c2c2b 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -197,7 +197,7 @@ local function composter_harvest(pos, node, player, itemstack, pointed_thing) -- -- handler for harvesting bone meal from a ready composter when rightclicked -- - if not player or player:get_player_control().sneak then + if not player or (player:get_player_control() and player:get_player_control().sneak) then return end -- reset ready type composter to empty type From 4e5cc0cb2bfae202de82eea87b6b7846d48727f8 Mon Sep 17 00:00:00 2001 From: kabou Date: Sat, 19 Feb 2022 14:55:25 +0100 Subject: [PATCH 11/12] Change custom node attribute name. * Rename _compost_level to _mcl_compost_level --- mods/ITEMS/mcl_composters/init.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index 5684c2c2b..abcc7fcb4 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -157,7 +157,7 @@ local function composter_add_item(pos, node, player, itemstack, pointed_thing) if chance >= rand then -- get current compost level local node_defs = minetest.registered_nodes[node.name] - local level = node_defs["_compost_level"] + local level = node_defs["_mcl_compost_level"] -- spawn green particles above new layer mcl_dye.add_bone_meal_particle(vector.add(pos, {x=0, y=level/8, z=0})) -- TODO: play some sounds @@ -253,7 +253,7 @@ minetest.register_node("mcl_composters:composter", { sounds = mcl_sounds.node_sound_wood_defaults(), _mcl_hardness = 2, _mcl_blast_resistance = 2, - _compost_level = 0, + _mcl_compost_level = 0, on_rightclick = composter_add_item }) @@ -287,7 +287,7 @@ local function register_filled_composter(level) drop = "mcl_composters:composter", _mcl_hardness = 2, _mcl_blast_resistance = 2, - _compost_level = level, + _mcl_compost_level = level, on_rightclick = composter_add_item, on_timer = composter_ready }) @@ -332,7 +332,7 @@ minetest.register_node("mcl_composters:composter_ready", { drop = "mcl_composters:composter", _mcl_hardness = 2, _mcl_blast_resistance = 2, - _compost_level = 7, + _mcl_compost_level = 7, on_rightclick = composter_harvest }) From 0e48a297879b896cab8a0386eea91d9fcc0d0110 Mon Sep 17 00:00:00 2001 From: kabou Date: Sat, 19 Feb 2022 16:57:22 +0100 Subject: [PATCH 12/12] Optimize texture files. * Texture files were optimized with 'optipng -o7 -zm9 -strip all' . --- .../textures/mcl_composter_bottom.png | Bin 395 -> 213 bytes .../textures/mcl_composter_compost.png | Bin 409 -> 184 bytes .../textures/mcl_composter_ready.png | Bin 582 -> 276 bytes .../textures/mcl_composter_side.png | Bin 267 -> 209 bytes .../textures/mcl_composter_top.png | Bin 397 -> 223 bytes 5 files changed, 0 insertions(+), 0 deletions(-) diff --git a/mods/ITEMS/mcl_composters/textures/mcl_composter_bottom.png b/mods/ITEMS/mcl_composters/textures/mcl_composter_bottom.png index dc075789938b54b1f26881e9a101b71a6abc7fb0..cfed3a8a5c7fa7818d1cc06f534cc087fa8e1b91 100644 GIT binary patch delta 197 zcmV;$06PDR1JwbL7=Hu<0002(-QrRJ0016POjJc)OF?E(MQ>C_cv?t>V@!@|O_O-B**I>Qi|zG#c7HspE!L~$fM3{!0RS}L z9VAZ00YC#l^V5T?tu$mT-P=mXv#m4~FO09TdwGNZe8=_8eLNdqGg{XHZ~Q;di%W;zz(8vsx=NP@{JNH#BL(Nsl~ zTsNR`M|1X}k9F0kWFPvtZ(WE+Dz@h8a;$_^{!^vWfa`{{L{vE;kS5A%xo(hj)CK8q zuA20vb>Vau=mjg&xa@ai7vv?Yox`LHsbnh2nJ8n$dbJ$nu*jiF2Pv1MWwIPy{xNqa aRUZJLbDRHfYw#QZ0000ZKiFTVC>hD59(`=?h`_AByB^-Fpb_p&Ly+bm=levX0RfIP1W*Gk>p S<)uIi7(8A5T-G@yGywqImpVBB delta 395 zcmV;60d)Sj0ht4k7=H)`0000V^Z#K0000JJOGiWi{{a60|De66lK=n!32;bRa{vGf z6951U69E94oEQKA00(qQO+^Re2Ll5s7^(dUmH+?&CP_p=R5;7Eld*2YAQVN936>>b zi3g@k9n!Dp(EtB~4w*7Bq#XZht;L-+5&TUR?6wdj_z* zz{nlW&kTOT=zEFP4JS92ZL=aMmxt+E_o_=A_br2;IJptqi){ki3qllxI5YT!(Yf%T zI?f?tv_y4@5CxFd4MG$Qegb$dR{30Y`BJIbn!y8J!pI#)!Z}0$+$CYO#P-jR$>mf- z6j`<6G`Vs*0} zq+(-{qPkQY*Eu3@!>iN5xV)Y z2FHK1JP9=+V$Yt?hh}oe|&Z0(`z8Q`RVm7(Qm4S zKoc2Dg8YIR9G=}s19D0{T^vIsBzq5b3LY}35nwr(EV*7_(}4&6Pv&csO75^;Hz7tK zV2MXjr26ix?MgFCeb&|Wt@AjeKJRr=Ub*Wc-MqtccU=yxtvM#msl<7>T&%<6#Oi}@ zHB^P(?LV4!w=Z1fd#<=yzn{w8Suv|MH72o$umr_?V6O~g>2!LLa~|jb22WQ%mvv4F FO#p~BZcqRK delta 568 zcmV-80>}N70>%W88Gi-<001BJ|6u?C00v@9M??Vs0RI60puMM)00009a7bBm000XU z000XU0RWnu7ytkO2XskIMF-;t0|O})*GzRQ0005gNklJI4qyuNS+%hZ%- zrg>g(pj^plKF8gg57?zLC|h)QpxobbxE;M@8qD%b8)Ix@M{ zfn{n6Ln9n7PN4NqPEMW0v5f>$o;gpSBN^P2qgtzP1$Y~phfiOkwdQg4HOiIrTNwaa zL6~f*S~07qJfxHgA$ZYf;@Ad32;Yt9&q-?>TPElIf7LInO{sr4dCb}X0000S|zoLLZ^xL2VX)Z9k85Es{jiC002ovPDHLk FV1lhoJwE^d delta 209 zcmcb}*v&LSg;8;$s#5)e=8X89`d9`A2F4_BcNc~ZR#^`qhqJ&VvY3H^TNs2H8D`Cq z01C2~c>21sKW1lU=Hry?n9T?jD)4l14B@!$dnQoukb#KH#iNYP%qDvRSe_hp+|DKu zC!4~~-q|Fyy=DKs_r~ITw_g0U{qclj3(q&qO!vO|p!MAn*T;27-xM{!+O)dufX1Ds z7FA>IY^&K5#5mvQPC9-+B5B_B$(`YMm#Q~upIoaj+duUsd%TmXtkBcOZ9vNzJYD@< J);T3K0RVz4P6Yq} diff --git a/mods/ITEMS/mcl_composters/textures/mcl_composter_top.png b/mods/ITEMS/mcl_composters/textures/mcl_composter_top.png index 6fb9df7ee2f70e60bf6362ba509a8d3fd78342a3..fc6e202d3c90f2e7405c671392145fced2a74a3f 100644 GIT binary patch delta 207 zcmeBWzRx&8qMn7Bfq~)e-A6${N-n@B#5K;_F)hF~Kg6vf%A+;er!UiYW>L`O%9I7o z8EgCV8n0UK1FB>%3GxdD(jX9;@+tyIWqP_ehH%KT9(3eoaujg67=QN8ax=#RUJlHC z1&snNXQ#Go*vqDI?{e^F)7cZ1+2iLopZ`7Sy2snN72+;SkDV@)Jm|ktX5#shuYHCh zCd)LVbe2rwu#HWN7h7q;U~Bc}VM;-&wVc70T*uA-pLyysTsT+o5M;ZjtDnm{r-UW| D29!>d delta 382 zcmV-^0fGMC0gVHY7=H)`0000V^Z#K0000JJOGiWi{{a60|De66lK=n!32;bRa{vGf z6951U69E94oEQKA00(qQO+^Re2Ll5a6_$x^RsaA28c9S!R5;6pQ_D`nFc6%zT#JNS zT=>ZTM}MSW!WoGh7eIgnh+Ys1LLs<$Na0Y%Y#g`D#rAr=Gk>1d%4WS9@e99n0D$_d zgT|pa09XL1zXx#jrG<{Adtcgk_N9g4g=;I>KEF!)@g^6Scfzx4D|xtok*n)Racw2H zH&5c)O8Cx9q!t!U=m7xlpL4kcbNtfn3;6QyAyGJ)6gpYhNWwP&U}%sAlT)zRX|af= z8k!Wk5p~#`vv=!<$VMf*eu(=f^wCJe)|{VBm5}8>RVEFDZai9uDrW_>iJC3f4Hlhr zK|7pd)4nvJKima+L1r44{f_Q}z9ic*%({?DrjneAIwqU-YShD`hbA4QT#nVrdUW~6 c+?`ha1IdG&3+6y&UH||907*qoM6N<$f@RgH82|tP