From 3d6d4923e6dae5f1b4b6d3fbf462cc1e328cac4a Mon Sep 17 00:00:00 2001 From: AliasAlreadyTaken Date: Sat, 13 Jul 2024 21:03:34 +0200 Subject: [PATCH] Adds freeze mode and fixes logging --- LICENSE.md | 5 +++-- README.md | 5 +++++ config.lua | 2 ++ internal.lua | 21 +++++++++++---------- settingtypes.txt | 5 +++++ 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index d02abba..af7535e 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,12 +1,13 @@ # License -Copyright (c) 2024 Developername, Styxcolor +Copyright (c) 2024 AliasAlreadyTaken, Styxcolor Code: -* [MIT](https://gitea.your-land.de/your-land/yl_canned_food/src/LICENSE-MIT) Developername +* [MIT](https://gitea.your-land.de/your-land/yl_canned_food/src/LICENSE-MIT) AliasAlreadyTaken Media: * screenshot.png [CC0](https://gitea.your-land.de/your-land/yl_canned_food/src/LICENSE-CC0) Styxcolor +* \ No newline at end of file diff --git a/README.md b/README.md index bfef569..00b1526 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,11 @@ yl_canned_food.debug = false ``` Set to true to enable debug mode +``` +yl_canned_food.freeze = false +``` +Set to true to prevent the nodes from changing into the next stage + ``` yl_canned_food.legacy = false ``` diff --git a/config.lua b/config.lua index 373321f..3c92e67 100644 --- a/config.lua +++ b/config.lua @@ -5,6 +5,8 @@ yl_canned_food.settings = {} yl_canned_food.settings.debug = minetest.settings:get_bool("yl_canned_food.debug",false) +yl_canned_food.settings.freeze = minetest.settings:get_bool("yl_canned_food.freeze",false) + yl_canned_food.settings.legacy = minetest.settings:get_bool("yl_canned_food.legacy",false) yl_canned_food.settings.duration = minetest.settings:get("yl_canned_food.duration") or 600 diff --git a/internal.lua b/internal.lua index 8c390ed..f8982a5 100644 --- a/internal.lua +++ b/internal.lua @@ -1,15 +1,15 @@ -- log -- local function log(text) - local logmessage = yl_api_nodestages.t("log_prefix", - yl_api_nodestages.modname, text) - if (yl_api_nodestages.settings.debug == true) then + local logmessage = yl_canned_food.t("log_prefix", + yl_canned_food.modname, text) + if (yl_canned_food.settings.debug == true) then minetest.log("action", logmessage) end return logmessage end -function yl_api_nodestages.log(text) return log(text) end +function yl_canned_food.log(text) return log(text) end -- get_node_definition -- @@ -37,6 +37,7 @@ end function yl_canned_food.get_node_definition() return get_node_definition() end local function can_set(pos) + if (yl_canned_food.settings.freeze == true) then return false end local light = minetest.get_node_light(pos) if (light and light > 5) then return false end return true @@ -73,12 +74,12 @@ local function register_food(itemstring, itemdesc, origin) yl_api_nodestages.register_stages(stages) if (success == false) then - yl_api_nodestages.log("action", "item = " .. dump(itemstring[1])) - yl_api_nodestages.log("action", "success = " .. dump(success)) - yl_api_nodestages.log("action", "good = " .. dump(good)) - yl_api_nodestages.log("action", "bad = " .. dump(bad)) - yl_api_nodestages.log("action", "total = " .. dump(total)) - yl_api_nodestages.log("action", "reasons = " .. dump(reasons)) + yl_canned_food.log("action", "item = " .. dump(itemstring[1])) + yl_canned_food.log("action", "success = " .. dump(success)) + yl_canned_food.log("action", "good = " .. dump(good)) + yl_canned_food.log("action", "bad = " .. dump(bad)) + yl_canned_food.log("action", "total = " .. dump(total)) + yl_canned_food.log("action", "reasons = " .. dump(reasons)) return false end diff --git a/settingtypes.txt b/settingtypes.txt index e10674d..bf2381b 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -5,6 +5,11 @@ # Optional, default is false yl_canned_food.debug (Debug mode) bool false +# Freeze mode +# Set this to true to enable freeze mode, which will prevent the nodes from changing into their next_stages +# Optional, default is false +yl_canned_food.freeze (Freeze mode) bool false + # Enables legacy naming mode # Set to true if you need drop-in replacement for canned_food. Set to false if you want uniform naming # Optional, default false