Skip to content

Add core.get_mapgen_chunksize() - #16289

Merged
sfan5 merged 2 commits into
luanti-org:masterfrom
sfan5:chonkyv0
Jun 29, 2025
Merged

Add core.get_mapgen_chunksize()#16289
sfan5 merged 2 commits into
luanti-org:masterfrom
sfan5:chonkyv0

Conversation

@sfan5

@sfan5 sfan5 commented Jun 27, 2025

Copy link
Copy Markdown
Member

Mods often manually parse the chunksize setting. If we want to ever change how this works (soon 😉) breakage will instantly occur.
With this API function it's both easier and future-compatible for mods.

To do

This PR is Ready for Review.

How to test

//lua =core.get_mapgen_chunksize()

@sfan5 sfan5 added @ Script API Feature ✨ PRs that add or enhance a feature labels Jun 27, 2025
@SmallJoker

Copy link
Copy Markdown
Member

If we want to ever change how this works (soon 😉)

What exactly could such use-cases be? As of how it's currently implemented and documented, it would still be a constant value.

@sfan5

sfan5 commented Jun 27, 2025

Copy link
Copy Markdown
Member Author

It's not about being a constant, it's about parsing chunksize by hand.
I have wip commits that change the chunksize to be a vector (so you can have different XYZ sizes).

@lhofhansl

lhofhansl commented Jun 27, 2025

Copy link
Copy Markdown
Contributor

Looks good. Why would we ever have a chunksize that is not uniform in all dimensions?

@sfan5

sfan5 commented Jun 28, 2025

Copy link
Copy Markdown
Member Author

You can see some relevant discussion starting here: https://irc.luanti.org/luanti/2025-06-27#i_6268727
tl;dr to better accommodate custom Lua mapgens

Note that even ignoring this I think it's good practice to expose stuff that exists in engine anyway via getters instead of having mods parse mapgen settings by hand. Consider also any fallbacks, limits or other stuff the engine might apply.

Comment thread doc/lua_api.md
@sfan5
sfan5 merged commit fd0ca20 into luanti-org:master Jun 29, 2025
@sfan5
sfan5 deleted the chonkyv0 branch June 29, 2025 15:19
DragonWrangler1 pushed a commit to DragonWrangler1/minetest that referenced this pull request Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants