generated from your-land/yl_template
Adds freeze mode and fixes logging
This commit is contained in:
parent
64c5ef73c0
commit
3d6d4923e6
@ -1,12 +1,13 @@
|
|||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
||||||
Copyright (c) 2024 Developername, Styxcolor
|
Copyright (c) 2024 AliasAlreadyTaken, Styxcolor
|
||||||
|
|
||||||
Code:
|
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:
|
Media:
|
||||||
|
|
||||||
* screenshot.png [CC0](https://gitea.your-land.de/your-land/yl_canned_food/src/LICENSE-CC0) Styxcolor
|
* screenshot.png [CC0](https://gitea.your-land.de/your-land/yl_canned_food/src/LICENSE-CC0) Styxcolor
|
||||||
|
*
|
@ -28,6 +28,11 @@ yl_canned_food.debug = false
|
|||||||
```
|
```
|
||||||
Set to true to enable debug mode
|
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
|
yl_canned_food.legacy = false
|
||||||
```
|
```
|
||||||
|
@ -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.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.legacy = minetest.settings:get_bool("yl_canned_food.legacy",false)
|
||||||
|
|
||||||
yl_canned_food.settings.duration = minetest.settings:get("yl_canned_food.duration") or 600
|
yl_canned_food.settings.duration = minetest.settings:get("yl_canned_food.duration") or 600
|
||||||
|
21
internal.lua
21
internal.lua
@ -1,15 +1,15 @@
|
|||||||
-- log
|
-- log
|
||||||
--
|
--
|
||||||
local function log(text)
|
local function log(text)
|
||||||
local logmessage = yl_api_nodestages.t("log_prefix",
|
local logmessage = yl_canned_food.t("log_prefix",
|
||||||
yl_api_nodestages.modname, text)
|
yl_canned_food.modname, text)
|
||||||
if (yl_api_nodestages.settings.debug == true) then
|
if (yl_canned_food.settings.debug == true) then
|
||||||
minetest.log("action", logmessage)
|
minetest.log("action", logmessage)
|
||||||
end
|
end
|
||||||
return logmessage
|
return logmessage
|
||||||
end
|
end
|
||||||
|
|
||||||
function yl_api_nodestages.log(text) return log(text) end
|
function yl_canned_food.log(text) return log(text) end
|
||||||
|
|
||||||
-- get_node_definition
|
-- get_node_definition
|
||||||
--
|
--
|
||||||
@ -37,6 +37,7 @@ end
|
|||||||
function yl_canned_food.get_node_definition() return get_node_definition() end
|
function yl_canned_food.get_node_definition() return get_node_definition() end
|
||||||
|
|
||||||
local function can_set(pos)
|
local function can_set(pos)
|
||||||
|
if (yl_canned_food.settings.freeze == true) then return false end
|
||||||
local light = minetest.get_node_light(pos)
|
local light = minetest.get_node_light(pos)
|
||||||
if (light and light > 5) then return false end
|
if (light and light > 5) then return false end
|
||||||
return true
|
return true
|
||||||
@ -73,12 +74,12 @@ local function register_food(itemstring, itemdesc, origin)
|
|||||||
yl_api_nodestages.register_stages(stages)
|
yl_api_nodestages.register_stages(stages)
|
||||||
|
|
||||||
if (success == false) then
|
if (success == false) then
|
||||||
yl_api_nodestages.log("action", "item = " .. dump(itemstring[1]))
|
yl_canned_food.log("action", "item = " .. dump(itemstring[1]))
|
||||||
yl_api_nodestages.log("action", "success = " .. dump(success))
|
yl_canned_food.log("action", "success = " .. dump(success))
|
||||||
yl_api_nodestages.log("action", "good = " .. dump(good))
|
yl_canned_food.log("action", "good = " .. dump(good))
|
||||||
yl_api_nodestages.log("action", "bad = " .. dump(bad))
|
yl_canned_food.log("action", "bad = " .. dump(bad))
|
||||||
yl_api_nodestages.log("action", "total = " .. dump(total))
|
yl_canned_food.log("action", "total = " .. dump(total))
|
||||||
yl_api_nodestages.log("action", "reasons = " .. dump(reasons))
|
yl_canned_food.log("action", "reasons = " .. dump(reasons))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -5,6 +5,11 @@
|
|||||||
# Optional, default is false
|
# Optional, default is false
|
||||||
yl_canned_food.debug (Debug mode) bool 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
|
# Enables legacy naming mode
|
||||||
# Set to true if you need drop-in replacement for canned_food. Set to false if you want uniform naming
|
# Set to true if you need drop-in replacement for canned_food. Set to false if you want uniform naming
|
||||||
# Optional, default false
|
# Optional, default false
|
||||||
|
Loading…
Reference in New Issue
Block a user