From 21bdcc360bf98cb144f7b54a81c1034313f04874 Mon Sep 17 00:00:00 2001 From: Awkanimus <119243140+Awkanimus@users.noreply.github.com> Date: Mon, 12 Dec 2022 00:26:49 -0500 Subject: [PATCH] Ensure ethereal is a compatible version if loaded (#21) - Check that ethereal version is more than 20220424 so that it doesn't unload parts of this mod - Remove optional dependency breaking the multi-mod dependency cycle ethereal --> bakedclay --> flowerpot --> moretrees --> ethereal. --- .luacheckrc | 1 + init.lua | 14 ++++++++++++++ mod.conf | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.luacheckrc b/.luacheckrc index b888a19..0e916a2 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -14,6 +14,7 @@ globals = { "default", "dump", "moretrees", + "ethereal", } read_globals = { diff --git a/init.lua b/init.lua index 33e02d7..1cf1663 100644 --- a/init.lua +++ b/init.lua @@ -62,6 +62,20 @@ if io.open(worldpath.."/moretrees_settings.txt","r") then dofile(worldpath.."/moretrees_settings.txt") end +-- Validate that if ethereal exists, that it's version is greater than 20220424. +-- Lower versions of ethereal clear registered biomes and decorations during +-- initialization which results in lost content from this mod (and others) +-- depending on where they are in the mod load order. +minetest.register_on_mods_loaded(function() + if minetest.global_exists("ethereal") then + local ethereal_ver = tonumber(ethereal.version) + if (ethereal_ver and ethereal_ver < 20220424) then + error("[moretrees] The version of ethereal detected can result " .. + "in parts of this mod and others disappearing due to mod " .. + "load order. Please update ethereal."); + end + end +end) -- infinite stacks checking diff --git a/mod.conf b/mod.conf index c35b2e0..a8bfea1 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = moretrees depends = default, vessels -optional_depends = doors, stairs, moreblocks, farming, ethereal +optional_depends = doors, stairs, moreblocks, farming min_minetest_version = 5.2.0