From 8edf220213fc5f7f5d13bd40b2212f4604be7ced Mon Sep 17 00:00:00 2001 From: "Github is a non-free platform owned by Microsoft. Reasonable alternatives exist, such as Gitea, Sourcehut. We need a federated, mastodon-like forge based on ForgeFed. See: https://forgefed.org" Date: Sun, 3 Dec 2023 08:33:53 +0100 Subject: [PATCH 1/2] fix crash when fake player dig slade (#46) When a fake player, for example a node, dig slade, it return player ~= nil but it is not a current player, the server_diggable_only function tries to check the privs of the node, then this crashes Here we use the built-in check player:is_player() so the node privs are not checked This crash occurred in the technic mod when the corium eats the slade --- df_underworld_items/slade.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/df_underworld_items/slade.lua b/df_underworld_items/slade.lua index 87adb7c..ae3d4ba 100644 --- a/df_underworld_items/slade.lua +++ b/df_underworld_items/slade.lua @@ -3,7 +3,7 @@ local S = minetest.get_translator(minetest.get_current_modname()) local invulnerable = df_underworld_items.config.invulnerable_slade and not minetest.settings:get_bool("creative_mode") local server_diggable_only = function(pos, player) - if player then + if player and player:is_player() then return minetest.check_player_privs(player, "server") end return false @@ -181,4 +181,4 @@ end if minetest.get_modpath("mesecons_mvps") and df_underworld_items.config.invulnerable_slade then mesecon.register_mvps_stopper("df_underworld_items:slade") -end \ No newline at end of file +end From de08a9d481167c0520eae05dc172f12a8c6d40fe Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Sat, 2 Dec 2023 23:36:34 -0800 Subject: [PATCH 2/2] Fix bedrock in mineclone2 (#49) * adjust more mcl_vars variables that were recently added to MineClone2 * try to detect mcl_vars values that should have been changed --- df_dependencies/mapgen.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/df_dependencies/mapgen.lua b/df_dependencies/mapgen.lua index f6f2d1a..131bc67 100644 --- a/df_dependencies/mapgen.lua +++ b/df_dependencies/mapgen.lua @@ -215,8 +215,33 @@ if minetest.get_modpath("mcl_init") then -- Mineclone 2 mcl_vars.mg_overworld_min = lowest_elevation mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min + mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_overworld_min + 4 mcl_vars.mg_lava_overworld_max = mcl_vars.mg_overworld_min + 10 mcl_vars.mg_end_max = mcl_vars.mg_overworld_min - 2000 + mcl_vars.mg_realm_barrier_overworld_end_max = mcl_vars.mg_end_max + mcl_vars.mg_realm_barrier_overworld_end_min = mcl_vars.mg_end_max - 11 + + -- try to detect any variables that should have been modified but weren't + local bad_entries = {} + for k, v in pairs(mcl_vars) do + -- if a value is in this range, it's probably a new value added by MineClone2 that we should be adjusting, add it to the table + if type(v) == "number" and v <= old_overworld_min + 10 and v >= mcl_vars.mg_overworld_min + 100 then + bad_entries[k] = v + end + end + + -- mark variables as ignored that we intentionally don't change, like so: + -- bad_entries.mg_value_that_shouldnt_be_adjusted = nil + + for k, v in pairs(bad_entries) do + local new_value = v + mcl_vars.mg_overworld_min - old_overworld_min + minetest.log("error", "dfcaverns: variable wasn't modified or marked as ignored! guessing new value:") + minetest.log("error", "mcl_var." .. tostring(k) .. " = " .. tostring(new_value) .. " -- was " .. tostring(v)) + minetest.log("error", "if it shouldn't be changed, mark it as ignored in df_dependencies/mapgen.lua like so:") + minetest.log("error", "bad_entries." .. tostring(k) .. " = nil") + minetest.log("error", "This is a bug, please report it to https://github.com/FaceDeer/dfcaverns/issues/new") + mcl_vars[k] = new_value + end -- shouldn't need to worry about the setting, extend_ores checks if the ores -- have already been registered.