From 878480d01076dc2ab4574fc983c1dcb5df1cfcb1 Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Sat, 2 Sep 2023 15:18:30 +0200 Subject: [PATCH 01/12] mcl_oxidation: typo in README. --- mods/CORE/mcl_oxidation/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/CORE/mcl_oxidation/README.md b/mods/CORE/mcl_oxidation/README.md index 3f3291b19..06ad09489 100644 --- a/mods/CORE/mcl_oxidation/README.md +++ b/mods/CORE/mcl_oxidation/README.md @@ -11,4 +11,4 @@ For example, Copper Blocks have the definition arguement of `_mcl_waxed_variant For waxed nodes, scraping is easy. Start by putting `waxed = 1` into the list of groups of the waxed node. Next put `_mcl_stripped_variant = item string of the unwaxed variant of the node` into the defintion table. -Wxaed Copper Blocks can be scrapped into normal Copper Blocks because of the definition `_mcl_stripped_variant = "mcl_copper:block"`. +Waxed Copper Blocks can be scrapped into normal Copper Blocks because of the definition `_mcl_stripped_variant = "mcl_copper:block"`. From eb658a49962a699ebd7dd10f9b34ede39bb88a66 Mon Sep 17 00:00:00 2001 From: Eliy21 Date: Mon, 11 Sep 2023 19:38:33 +0000 Subject: [PATCH 02/12] Update mods/PLAYER/mcl_spawn/init.lua Add if then condition for no bed/anchor respawn settings --- mods/PLAYER/mcl_spawn/init.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mods/PLAYER/mcl_spawn/init.lua b/mods/PLAYER/mcl_spawn/init.lua index eb0208dcb..89ededeed 100644 --- a/mods/PLAYER/mcl_spawn/init.lua +++ b/mods/PLAYER/mcl_spawn/init.lua @@ -76,6 +76,7 @@ local node_search_list = local success = storage:get_int("mcl_spawn_success")==1 local searched = (storage:get_int("mcl_spawn_searched")==1) or mg_name == "v6" or mg_name == "singlenode" or minetest.settings:get("static_spawnpoint") +local return_spawn = minetest.settings:get_bool("mcl_return_spawn", true) local wsp = minetest.string_to_pos(storage:get_string("mcl_spawn_world_spawn_point")) or {} -- world spawn position local check = storage:get_int("mcl_spawn_check") or 0 local cp = minetest.string_to_pos(storage:get_string("mcl_spawn_cp")) or {x=start_pos.x, y=start_pos.y, z=start_pos.z} @@ -498,7 +499,7 @@ function mcl_spawn.get_player_spawn_pos(player) if(string.match(checknode.name, "mcl_beds:respawn_anchor_charged_")) then local charge_level = tonumber(string.sub(checknode.name, -1)) - if not charge_level then + if not charge_level and return_spawn then minetest.log("warning","could not get level of players respawn anchor, sending him back to spawn!") player:get_meta():set_string("mcl_beds:spawn", "") minetest.chat_send_player(player:get_player_name(), S("Couldn't get level of your respawn anchor!")) @@ -510,10 +511,12 @@ function mcl_spawn.get_player_spawn_pos(player) minetest.set_node(checkpos, {name="mcl_beds:respawn_anchor"}) return checkpos, false end - else + elseif return_spawn then player:get_meta():set_string("mcl_beds:spawn", "") minetest.chat_send_player(player:get_player_name(), S("Your spawn bed was missing or blocked, and you had no charged respawn anchor!")) return mcl_spawn.get_world_spawn_pos(), false + else + return checkpos, false end end end From 2d9bffaa43fb2f805edf7039767a3156b9abdd4e Mon Sep 17 00:00:00 2001 From: Eliy21 Date: Mon, 11 Sep 2023 19:42:04 +0000 Subject: [PATCH 03/12] Update settingtypes.txt Add the no bed respawn in settings --- settingtypes.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/settingtypes.txt b/settingtypes.txt index c5d5d32c1..8123ca9d9 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -51,6 +51,9 @@ mcl_disabled_events (Disabled events) string # This setting is only read at startup. enable_bed_respawn (Respawn at bed) bool true +#If enabled, players respawn at world spawn if bed is destroyed or respawn anchor has no charge. +mcl_return_spawn (Return to spawn if no bed) bool true + # How many players have to sleep to skip the night, in percent. # Setting to 0 will mean 1 player is always enough to skip the night. Setting above 100 will prevent skipping the night. # 100 by default. From f57220f78496f65c58f0e3d2816417d3350cbe50 Mon Sep 17 00:00:00 2001 From: Michieal Date: Wed, 20 Sep 2023 05:57:49 +0000 Subject: [PATCH 04/12] Fix Server crash (Issue ##3939) Fixes the error of pointed_thing being nil (null) by first checking to see if it exists, and if not, exit the on_place call back. --- mods/ITEMS/mcl_bamboo/bamboo_base.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_base.lua b/mods/ITEMS/mcl_bamboo/bamboo_base.lua index 4ccb9bb1b..2cc8b23c8 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_base.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_base.lua @@ -86,7 +86,7 @@ local bamboo_def = { on_rotate = on_rotate, on_place = function(itemstack, placer, pointed_thing) - if pointed_thing.type ~= "node" then + if pointed_thing and pointed_thing.type ~= "node" then -- make sure that pointed_thing is not null and is pointing at a node. return itemstack end local node = minetest.get_node(pointed_thing.under) @@ -277,6 +277,10 @@ local bamboo_block_def = { _mcl_stripped_variant = "mcl_bamboo:bamboo_block_stripped", -- this allows us to use the built in Axe's strip block. on_place = function(itemstack, placer, pointed_thing) + if not pointed_thing then -- make sure that pointed_thing is not null + return itemstack + end + local pos = pointed_thing.under if mcl_bamboo.is_protected(pos, placer) then From b2ebcf5d4fbc10635cde690a6a82be0fe0d8c6b6 Mon Sep 17 00:00:00 2001 From: Michieal Date: Wed, 20 Sep 2023 06:07:13 +0000 Subject: [PATCH 05/12] Readme Change Putting my name back into the credits in the mod. --- mods/ITEMS/mcl_bamboo/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_bamboo/README.md b/mods/ITEMS/mcl_bamboo/README.md index b1f91e641..469914294 100644 --- a/mods/ITEMS/mcl_bamboo/README.md +++ b/mods/ITEMS/mcl_bamboo/README.md @@ -3,7 +3,7 @@ mcl_bamboo This mod adds working, familiar bamboo nodes to your Mineclone 2 world. -Code: MineClone2 dev team. Original (basic) bamboo code by: Small Joker. +Code: Michieal. Original (basic, used as inspiration) bamboo code by: Small Joker. Updates to the code: Mineclone Dev Team, Michieal. License for code: GPLv3. License for images / textures: CC-BY-SA except where noted. From 882c3ef33929d96ac9c5afcb5d84af58d572fc3a Mon Sep 17 00:00:00 2001 From: Blockhead Date: Mon, 25 Sep 2023 19:54:18 +1000 Subject: [PATCH 06/12] Point mcl_custom_skins link to a working URL --- mods/PLAYER/mcl_skins/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/PLAYER/mcl_skins/README.md b/mods/PLAYER/mcl_skins/README.md index 303dcf424..9b18ce4ca 100644 --- a/mods/PLAYER/mcl_skins/README.md +++ b/mods/PLAYER/mcl_skins/README.md @@ -3,7 +3,7 @@ This mod allows advanced skin customization. Use the /skin command to open the skin configuration screen. -To include custom skins in MineClone2, please download [mcl_custom_skins](https://git.minetest.land/mineclone2/mcl_custom_skins) +To include custom skins in MineClone2, please download [mcl_custom_skins](https://git.minetest.land/MrRar/mcl_custom_skins) ## License Code under MIT license From eafe6627d825a20b9f3e38602d45f2240cd3bb49 Mon Sep 17 00:00:00 2001 From: Michieal Date: Tue, 26 Sep 2023 18:35:12 +0000 Subject: [PATCH 07/12] Extra checks placed in. --- mods/ITEMS/mcl_bamboo/bamboo_base.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_base.lua b/mods/ITEMS/mcl_bamboo/bamboo_base.lua index 2cc8b23c8..1c7e99a61 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_base.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_base.lua @@ -86,7 +86,12 @@ local bamboo_def = { on_rotate = on_rotate, on_place = function(itemstack, placer, pointed_thing) - if pointed_thing and pointed_thing.type ~= "node" then -- make sure that pointed_thing is not null and is pointing at a node. + + if not pointed_thing then + return itemstack + end + + if pointed_thing.type ~= "node" then return itemstack end local node = minetest.get_node(pointed_thing.under) @@ -201,7 +206,7 @@ local bamboo_def = { local node_above_name = minetest.get_node(pointed_thing.above).name mcl_bamboo.mcl_log("\n\n\nnode_above name: " .. node_above_name) if node_above_name ~= "mcl_core:water_source" and node_above_name ~= "mcl_core:lava_source" - and node_above_name ~= "mcl_nether:nether_lava_source" then + and node_above_name ~= "mcl_nether:nether_lava_source" then local _, position = minetest.item_place(place_item, placer, pointed_thing, fdir) if position then if not minetest.is_creative_enabled(placer:get_player_name()) then @@ -276,8 +281,11 @@ local bamboo_block_def = { _mcl_hardness = 2, _mcl_stripped_variant = "mcl_bamboo:bamboo_block_stripped", -- this allows us to use the built in Axe's strip block. on_place = function(itemstack, placer, pointed_thing) + if not pointed_thing then + return itemstack + end - if not pointed_thing then -- make sure that pointed_thing is not null + if pointed_thing.type ~= "node" then -- make sure that pointed_thing is not null and is pointing at a node. return itemstack end From e9d994b74d43715b4bda8339714e70a09c85b6c2 Mon Sep 17 00:00:00 2001 From: Michieal Date: Tue, 26 Sep 2023 18:57:17 +0000 Subject: [PATCH 08/12] Fix Campifires API to not crash the server. Fixed the error in Campfires' On_RightClick() to not error out when called with a non-existent pointed_thing. --- mods/ITEMS/mcl_campfires/api.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mods/ITEMS/mcl_campfires/api.lua b/mods/ITEMS/mcl_campfires/api.lua index 212beefbe..cd23a964b 100644 --- a/mods/ITEMS/mcl_campfires/api.lua +++ b/mods/ITEMS/mcl_campfires/api.lua @@ -332,6 +332,9 @@ function mcl_campfires.register_campfire(name, def) elseif minetest.get_item_group(itemstack:get_name(), "campfire_cookable") ~= 0 then mcl_campfires.take_item(pos, node, player, itemstack) else + if not pointed_thing then + return itemstack + end minetest.item_place_node(itemstack, player, pointed_thing) end end, From e8c658658df675fcad71bc2f7231e910276bde96 Mon Sep 17 00:00:00 2001 From: Michieal Date: Tue, 26 Sep 2023 18:59:51 +0000 Subject: [PATCH 09/12] Update Credits. --- mods/ITEMS/mcl_campfires/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_campfires/README.md b/mods/ITEMS/mcl_campfires/README.md index 188134233..5390e982f 100644 --- a/mods/ITEMS/mcl_campfires/README.md +++ b/mods/ITEMS/mcl_campfires/README.md @@ -9,9 +9,10 @@ Authors: Gerold55 - Code Start + Models? PrairieWind - Improved and Cleaned Up Code, and added the soul campfire and crafting recipes. cora - Added burning damage. -DinoNuggies4665 - Cooking logic implemented -thunder1035 - Redesigned model and texture tweaks -AncientMariner - Changed smoke to particle spawner and tweaked particle configuration. +DinoNuggies4665 - Cooking logic implemented. +thunder1035 - Redesigned model and texture tweaks. +AncientMariner - Changed smoke to particle spawner and tweaked particle configuration. +Michieal - Fixed misc. errors. License of media ---------------- From 2bd6678b08355a0cd8dc36d1b94d2ae1efe0c254 Mon Sep 17 00:00:00 2001 From: Johannes Fritz Date: Thu, 28 Sep 2023 13:09:45 -0500 Subject: [PATCH 10/12] mcl_skins: link to official mcl_custom_skins --- mods/PLAYER/mcl_skins/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/PLAYER/mcl_skins/README.md b/mods/PLAYER/mcl_skins/README.md index 9b18ce4ca..4a5d150db 100644 --- a/mods/PLAYER/mcl_skins/README.md +++ b/mods/PLAYER/mcl_skins/README.md @@ -3,7 +3,7 @@ This mod allows advanced skin customization. Use the /skin command to open the skin configuration screen. -To include custom skins in MineClone2, please download [mcl_custom_skins](https://git.minetest.land/MrRar/mcl_custom_skins) +To include custom skins in MineClone2, please download the [mcl_custom_skins](https://codeberg.org/MineClone2/mcl_custom_skins) mod. ## License Code under MIT license From 6d3e55ce12391e3fc884444a5a097d96e02fb66f Mon Sep 17 00:00:00 2001 From: Nicu Date: Mon, 19 Jun 2023 03:03:11 +0000 Subject: [PATCH 11/12] Reduced the creeper explosion timer reset radius from 6 to 3 This gives the player just enough time to get out of the creeper's range, to reset their explosion timer and avoid unnecessary destruction. --- mods/ENTITIES/mobs_mc/creeper.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/creeper.lua b/mods/ENTITIES/mobs_mc/creeper.lua index 72661971e..a36550a93 100644 --- a/mods/ENTITIES/mobs_mc/creeper.lua +++ b/mods/ENTITIES/mobs_mc/creeper.lua @@ -50,7 +50,7 @@ mcl_mobs.register_mob("mobs_mc:creeper", { explosion_strength = 3, explosion_radius = 3.5, explosion_damage_radius = 3.5, - explosiontimer_reset_radius = 6, + explosiontimer_reset_radius = 3, reach = 3, explosion_timer = 1.5, allow_fuse_reset = true, @@ -172,7 +172,7 @@ mcl_mobs.register_mob("mobs_mc:creeper_charged", { explosion_strength = 6, explosion_radius = 8, explosion_damage_radius = 8, - explosiontimer_reset_radius = 6, + explosiontimer_reset_radius = 3, reach = 3, explosion_timer = 1.5, allow_fuse_reset = true, From a620d24ec848d6a7e20a43f462bcbf09ccca683c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9D=95=B5=F0=9D=96=94=F0=9D=96=8D=F0=9D=96=86?= =?UTF-8?q?=F0=9D=96=93=F0=9D=96=93=F0=9D=96=8A=F0=9D=96=98=20=F0=9D=95=B1?= =?UTF-8?q?=F0=9D=96=97=F0=9D=96=8E=F0=9D=96=99=F0=9D=96=9F?= Date: Fri, 29 Sep 2023 18:47:07 +0000 Subject: [PATCH 12/12] Fix a number of crashes involving unknown nodes, also fix fishbuckets on_place (#3914) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: #3913 #3915 ~~You can reproduce the crash by placing a fish bucket on top snow above an unknown node. I also noticed that the code always uses pointed_thing.above so I fixed that and also added a function to mcl_utils to figure out where a node should be placed (either above or below). Looks like the rest of the code could also use improvement but at least it does not crash now.~~ Cora fixed a bunch of related crashes in Mineclona so I am replacing my commit and cherry picking all her commits here. https://codeberg.org/mineclonia/mineclonia/pulls/549 Here is the list of fixes from that PR: - Crash when placing snow layer on unknown nodes - Crash when snow layers on unknown nodes are flooded - Crash when placing fishbucket on snow on top of unknown nodes - Crash when placing chorus flower and stem on unknown - Crash when placing mob spawners on unknown - The fishbucket on place to actually replace buildable_to Co-authored-by: cora Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3914 Reviewed-by: ancientmarinerdev Co-authored-by: 𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 Co-committed-by: 𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 --- mods/ITEMS/mcl_buckets/fishbuckets.lua | 23 ++++++++++++++++------- mods/ITEMS/mcl_core/functions.lua | 6 +++--- mods/ITEMS/mcl_core/nodes_base.lua | 2 +- mods/ITEMS/mcl_end/chorus_plant.lua | 6 ++++-- mods/ITEMS/mcl_mobspawners/init.lua | 3 ++- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/mods/ITEMS/mcl_buckets/fishbuckets.lua b/mods/ITEMS/mcl_buckets/fishbuckets.lua index 185f72486..bc93654da 100644 --- a/mods/ITEMS/mcl_buckets/fishbuckets.lua +++ b/mods/ITEMS/mcl_buckets/fishbuckets.lua @@ -18,13 +18,21 @@ local function on_place_fish(itemstack, placer, pointed_thing) return new_stack end - local pos = pointed_thing.above or pointed_thing.under - if not pos then return end - local n = minetest.get_node_or_nil(pos) - if n.name and minetest.registered_nodes[n.name].buildable_to or n.name == "mcl_portals:portal" then - local fish = itemstack:get_name():gsub(fishbucket_prefix,"") - if fish_names[fish] then - local o = minetest.add_entity(pos, "mobs_mc:" .. fish) + if pointed_thing.type ~= "node" then return end + + local pos = pointed_thing.above + local n = minetest.get_node(pointed_thing.above) + local def = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name] + + if ( def and def.buildable_to ) or n.name == "mcl_portals:portal" then + pos = pointed_thing.under + n = minetest.get_node(pointed_thing.under) + end + + local fish = itemstack:get_definition()._mcl_buckets_fish + if fish_names[fish] then + local o = minetest.add_entity(pos, "mobs_mc:" .. fish) + if o and o:get_pos() then local props = itemstack:get_meta():get_string("properties") if props ~= "" then o:set_properties(minetest.deserialize(props)) @@ -60,6 +68,7 @@ for techname, fishname in pairs(fish_names) do stack_max = 1, groups = {bucket = 1, fish_bucket = 1}, liquids_pointable = false, + _mcl_buckets_fish = techname, on_place = on_place_fish, on_secondary_use = on_place_fish, _on_dispense = function(stack, pos, droppos, dropnode, dropdir) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index b7623bf11..ad2346dd9 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -1581,7 +1581,7 @@ end -- MUST NOT be called if there is a snow cover node above pos. function mcl_core.clear_snow_dirt(pos, node) local def = minetest.registered_nodes[node.name] - if def._mcl_snowless then + if def and def._mcl_snowless then minetest.swap_node(pos, {name = def._mcl_snowless, param2=node.param2}) end end @@ -1602,7 +1602,7 @@ function mcl_core.on_snowable_construct(pos) -- Make snowed if needed if minetest.get_item_group(anode.name, "snow_cover") == 1 then local def = minetest.registered_nodes[node.name] - if def._mcl_snowed then + if def and def._mcl_snowed then minetest.swap_node(pos, {name = def._mcl_snowed, param2=node.param2}) end end @@ -1623,7 +1623,7 @@ function mcl_core.on_snow_construct(pos) local npos = {x=pos.x, y=pos.y-1, z=pos.z} local node = minetest.get_node(npos) local def = minetest.registered_nodes[node.name] - if def._mcl_snowed then + if def and def._mcl_snowed then minetest.swap_node(npos, {name = def._mcl_snowed, param2=node.param2}) end end diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index 79cd37d8e..01de997d5 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -1038,7 +1038,7 @@ for i=1,8 do -- Get position where snow would be placed local target - if minetest.registered_nodes[unode.name].buildable_to then + if def and def.buildable_to then target = under else target = above diff --git a/mods/ITEMS/mcl_end/chorus_plant.lua b/mods/ITEMS/mcl_end/chorus_plant.lua index 4dc54db18..7f2064a3e 100644 --- a/mods/ITEMS/mcl_end/chorus_plant.lua +++ b/mods/ITEMS/mcl_end/chorus_plant.lua @@ -155,7 +155,8 @@ minetest.register_node("mcl_end:chorus_flower", { 1) On top of end stone or chorus plant 2) On top of air and horizontally adjacent to exactly 1 chorus plant ]] local pos - if minetest.registered_nodes[node_under.name].buildable_to then + local def = minetest.registered_nodes[node_under.name] + if def and def.buildable_to then pos = pointed_thing.under else pos = pointed_thing.above @@ -283,7 +284,8 @@ minetest.register_node("mcl_end:chorus_plant", { condition is met: - placed on end stone or any chorus node ]] local pos_place, node_check - if minetest.registered_nodes[node_under.name].buildable_to then + local def = minetest.registered_nodes[node_under.name] + if def and def.buildable_to then pos_place = pointed_thing.under node_check = node_above else diff --git a/mods/ITEMS/mcl_mobspawners/init.lua b/mods/ITEMS/mcl_mobspawners/init.lua index c5c2212b6..290980e78 100644 --- a/mods/ITEMS/mcl_mobspawners/init.lua +++ b/mods/ITEMS/mcl_mobspawners/init.lua @@ -301,7 +301,8 @@ minetest.register_node("mcl_mobspawners:spawner", { local new_itemstack, success = minetest.item_place(itemstack, placer, pointed_thing) if success then local placepos - if minetest.registered_nodes[node_under.name].buildable_to then + local def = minetest.registered_nodes[node_under.name] + if def and def.buildable_to then placepos = pointed_thing.under else placepos = pointed_thing.above