This commit is contained in:
Hamlet 2020-07-02 20:39:10 +02:00
parent aaf4f2d284
commit 289db0b5f0
No known key found for this signature in database
GPG Key ID: 30C286622B0B63F9
4 changed files with 57 additions and 41 deletions

View File

@ -2,12 +2,17 @@
![Soft Leaves' screenshot](screenshot.png)
**_Allows to walk through and to climb on leaves._**
**Version:** 0.2.0
**Version:** 0.2.1
**Source code's license:** [EUPL v1.2][1] or later.
**Dependencies:** default (found in [Minetest Game][2])
**API for third party mods:**
See ![api.txt](api.txt)
### Installation
Unzip the archive, rename the folder to soft_leaves and place it in

View File

@ -1,5 +1,5 @@
If you are a developer or just a modder you can use this function:
If you are a developer or just a modder you can use this procedure:
soft_leaves.overrider(nodestring)

View File

@ -10,10 +10,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
- No further features planned.
## [0.2.1] - 2020-07-02
### Changed
- Code improvements.
## [0.2.0] - 2019-10-30
### Added
- Global function which allows other mods to register their nodes (see api.txt).
- Global procedure that allows other mods to register their nodes (see api.txt).
### Changed

View File

@ -1,6 +1,6 @@
--[[
Soft leaves - Allows to walk through and to climb on leaves.
Copyright © 2018, 2019 Hamlet <hamlatmesehub@riseup.net> and contributors.
Copyright © 2018, 2020 Hamlet and contributors.
Licensed under the EUPL, Version 1.2 or as soon they will be
approved by the European Commission subsequent versions of the
@ -30,46 +30,54 @@ soft_leaves = {}
--
-- Leaves' table
-- Procedures
--
local leaf_nodes = {
"default:acacia_bush_leaves",
"default:acacia_leaves",
"default:aspen_leaves",
"default:blueberry_bush_leaves",
"default:blueberry_bush_leaves_with_berries",
"default:bush_leaves",
"default:jungleleaves",
"default:leaves",
"default:pine_bush_needles",
"default:pine_needles"
}
-- Local procedure for the default Minetest Game's nodes
local pr_Overrider = function()
-- Constant
local t_LEAF_NODES = {
'default:acacia_bush_leaves',
'default:acacia_leaves',
'default:aspen_leaves',
'default:blueberry_bush_leaves',
'default:blueberry_bush_leaves_with_berries',
'default:bush_leaves',
'default:jungleleaves',
'default:leaves',
'default:pine_bush_needles',
'default:pine_needles'
}
--
-- Nodes' overrider
--
for i_element = 1, 10 do
minetest.override_item(t_LEAF_NODES[i_element], {
climbable = true,
walkable = false
})
end
for element = 1, 10 do
minetest.override_item(leaf_nodes[element], {
climbable = true,
walkable = false
})
end
--
-- Flush the leaves' table for memory saving
--
-- Minetest logger
local pr_LogMessage = function()
leaf_nodes = nil
-- Constant
local s_LOG_LEVEL = minetest.settings:get('debug_log_level')
-- Body
if (s_LOG_LEVEL == nil)
or (s_LOG_LEVEL == 'action')
or (s_LOG_LEVEL == 'info')
or (s_LOG_LEVEL == 'verbose')
then
minetest.log('action', '[Mod] Soft Leaves [v0.2.1] loaded.')
end
end
--
-- Global function to allow third party mods to support soft leaves.
--
-- Global procedure to allow third party mods to support soft leaves.
soft_leaves.overrider = function(nodestring)
minetest.override_item(nodestring, {
climbable = true,
@ -79,13 +87,8 @@ end
--
-- Minetest engine debug logging
-- Main body
--
if (minetest.settings:get("debug_log_level") == nil)
or (minetest.settings:get("debug_log_level") == "action")
or (minetest.settings:get("debug_log_level") == "info")
or (minetest.settings:get("debug_log_level") == "verbose")
then
minetest.log("action", "[Mod] Soft Leaves [v0.2.0] loaded.")
end
pr_Overrider()
pr_LogMessage()