Adds configuration for duration and legacy mode

This commit is contained in:
AliasAlreadyTaken 2024-07-11 02:30:37 +02:00
parent a4b6044eab
commit 67d8cdc104
4 changed files with 30 additions and 9 deletions

View File

@ -28,9 +28,21 @@ yl_canned_food.debug = false
```
Set to true to enable debug mode
```
yl_canned_food.legacy = false
```
Set to true if you need drop-in replacement for canned_food. Set to false if you want uniform naming
```
yl_canned_food.duration = 600
```
Set this to a time in seconds. This time is necessary to go from the first to the second stage.
## Usage
This mod can be used in singleplayer and multiplayer. It comes with the cannod food items, but no crafting recipes. To get those, install the integration mod for your game. The minetest_game integration is here: TODO
This mod can be used in singleplayer and multiplayer. It comes with the canned food items, but no crafting recipes. To get those, install the integration mod for your game. The minetest_game integration is here: TODO
### Modmakers
@ -71,4 +83,5 @@ See [LICENSE.md](https://gitea.your-land.de/your-land/yl_canned_food/src/LICENSE
## Thank you
* Original canned_food author: https://github.com/h-v-smacker
* AspireMint
* AspireMint
* Styxcolor

View File

@ -4,3 +4,7 @@
yl_canned_food.settings = {}
yl_canned_food.settings.debug = minetest.settings:get_bool("yl_canned_food.debug",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

View File

@ -8,7 +8,7 @@ local stages = {}
table.insert(stages, {
stage_name = "canned_food:" .. itemstring[1],
next_stages = "canned_food:" .. itemstring[2],
duration = 600,
duration = tonumber(yl_canned_food.settings.duration) or 600,
tiles = {"yl_canned_food_" .. itemstring[1] .. ".png"},
description = itemdesc[1],
node_definition = yl_canned_food.get_node_definition(),
@ -27,11 +27,10 @@ local success, good, bad, total, reasons =
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))
end
assert(success)

View File

@ -5,7 +5,12 @@
# Optional, default is false
yl_canned_food.debug (Debug mode) bool false
# First line: Name the settings
# Second line: Say what it does, how to use it, what it changes
# Third line: Is it optional? What's the default value? Does it expect a certain set of values?
yl_canned_food.external_value (Description of the setting) string "default_value"
# 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
yl_canned_food.legacy (Enables legacy naming mode) bool false
# Duration
# Set this to a time in seconds. This time is necessary to go from the first to the second stage.
# Optional, default 600
yl_canned_food.duration (Duration) float 600 1