Skip to content

Rework trees and aquatic life to remove ABMs and LBMs#10

Open
Montandalar wants to merge 11 commits intomasterfrom
lbm_abm_conversions
Open

Rework trees and aquatic life to remove ABMs and LBMs#10
Montandalar wants to merge 11 commits intomasterfrom
lbm_abm_conversions

Conversation

@Montandalar
Copy link
Member

Addresses #8.

This pull request removes all ABMs from the mod and introduces only three new LBMs. Two for the shipwreck loot, and one which is necessary to make sure aquatic plantlife starts growing in the world as it is generated.

First is the work on trees. They now grow at different rates according to the volume, and they can decay properly without checking a full cuboid - there is now "NULDA", the Non-Uniform Leaf Decay for Australia library.

Second is the work on aquatic plantlife - coral, tall kelp, short kelp, sponges. I took the opportunity to improve aquatic plantlife deaths by creating a dead version of all nodes rather than just destroying them. I also refactored the code to make it quite easy to add new species. This part of the work is what took so long, since I was working out how the templating of nodes would work. It's not perfect, but good enough I think.

The intent of this PR is also that it will work seamlessly with old worlds that were made before. That has not yet been tested but I have high hopes.

Also refer to the more detailed notes that have been added to the README and commit messages for more information.

Also fix leaf decay radii for Celery Top Pine and Australian Cherry.

The growth rate is scaled based on the number of trunks, leaves and
fruits on average for each of the tree's schematics. Leaves and fruit
weigh 1/3 the value of a trunk node; this is called the tree mass.
Tree-mass is then scaled nonlinearly to make smaller trees grow
relatively faster than larger trees; the function was made with the help
of GeoGebra.
Move all ABM and node definitions related to sea life into the nodes/
directory where they belong, instead of inside specific biomes being
duplicated.

Reduce the code size of all coral species and move them to nodetimers.
Kelp should also move to nodetimers soon.

Add the submarine and woodship spawners to the creative inventory,
change their descriptions and give them inventory icons. Move the
spawner code away from ABMs.
Coral can now bleach, will have a growth speed according to its light
level, does not appear below the top sand level (added topsoil nodes
which are copies of default sand(stone)); won't grow unless it has
2 nodes of water above it and it no longer heals entities.

Coral and shipwreck LBMs now always run on all loads. This seems
necessary to make them spawn in properly at worldgen time, though the
LBM does not always fire.
Also fix tab indentation in tall_kelp.lua
Also refactor the punch-to-see-timer code into a debug mode feature.
@Montandalar
Copy link
Member Author

This version of the mod is now live on the Aussieforks server as well. We may not need a map reset at all if testing goes well and this proves backwards-compatible!

@Montandalar Montandalar linked an issue Jan 11, 2023 that may be closed by this pull request
3 tasks
@Montandalar Montandalar added enhancement New feature or request performance A performance issue or suggestion to improve performance labels Jan 11, 2023
The aliases were accidentally removed, causing problems.
@Montandalar
Copy link
Member Author

Test results in Aussieforks are good. Existing areas transitioned well.

@Montandalar
Copy link
Member Author

Since making this PR I have heard about other projects moving from nodetimers to ABMs to improve performance. I'm also worried about the impact on load times. I will leave this here for now until/unless I can actually prove the benefits.

@Montandalar
Copy link
Member Author

Minor issue spotted: Dried variants of the giant kelp top and middle are both visible in the creative inventory (well, Unified Inventory). However, the craft guide does clearly show that the middles, when dug, will yield the tops, so it all stacks.

@Montandalar
Copy link
Member Author

Montandalar commented Aug 10, 2023

I found another issue with noairblocks today. I think they only exist in an artificially-planted environment, hence why I never saw them:

-- @@@ Josselin2
--  water.alpha = 0
    water.use_texture_alpha = "opaque"

..the australia:water nodes are opaque now. Previously alpha = 0 was a hack to make it disappear without changing the texture. Not really ideal. The better fix is:

    water.drawtype = "airlike"

but this is still quite ugly as you get the inside faces of the water nodes that border it still. Anyway since noairblocks were removed this is kind of trivia, but it may tip the balance of the scales if I decide upon keeping the new branch despite poorer performance (note: the performance has yet to be tested).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request performance A performance issue or suggestion to improve performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate ABMs to nodetimers and LBMs

2 participants