-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Leafdecay: Node timer based implementation, API
This implements a node-timer based leafdecay mechanism, and exposes an API to use it in mods. The API is documented in game_api.txt. `default.register_leafdecay(leafdecaydef)` `leafdecaydef` is a table, with following members: { trunks = { "default:tree"}, -- nodes considered trunks leaves = { "default:leaves", "default:apple"}, -- nodes considered leaves radius = 3, -- activates leafdecay this far from the trunk } The algorithm will drop `leaves` items in the area if no `trunks` are found in the `trunk_radius` sized area around the position of the leaf. If a node listed in `leaves` has a group `leafdecay_drop > 0`, then the item is dropped, otherwise the item is removed but not dropped. The algorithm also implements a value `default.leafdecay_speed` (default 15) which can be modified to increase or decrease of the leaf decay. The algorithm will vary the actual speed a bit to introduce randomness. Leaf decay is randomized by 0.1 seconds to reduce the chance that decay happens many times on the same second interval. This requires nodetimer_interval to be set to values lower than 1.0 to have an effect. The leaves will decay between 2 and 10 seconds after digging the trunk, and happen at non-integer second intervals. -- The API was added by sofar.
- Loading branch information
Showing
3 changed files
with
132 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters