Environment Checks
This PR adresses #902.
Required environment checks are listed in a module's beet.yaml and are executed on /reload (during load). If a check fails, the module will not be installed and an error is printed in chat, similar to a missing dependency.
This PR is a draft on purpose. I am not that familiar with @SpecialBuilder32's versioning script, but wanted to get the ball rolling. Help is greatly appreciated.
Todo:
- [x] Wait on feedback from our versioning overlord
- [ ] Add
command_blocks_enabledecheck - [ ] Add
world_generation_resources_presentecheck - [x] ~~Add
load_executedecheck~~ too hard - [ ] Add minecraft version check via overlay setting a score
- [x] ~~Add warning that is printed when on a paper server, but does not disable modules~~~not needed
I have cleaned up the base python code to the point where I'm satisfied with functionality.
Here's what's left to do:
- [x] Decide: Should environment checks reside in
function/environment_check/during development, or should we place them inenvironment_check/(same level asfunction/) and move all those files over at build time (may cause issues when someone names a folder infunction/the same as the folder we move the checks to.... Hence I don't really see a point in doing this) - [ ] Write the remaining checks. We can always add more checks later, I'd rather have this merged with some checks and add more later then have it sit around forever.
After some more thinking we have come to the following solution, which splits load.mcfunction into 3 functions:
-
pre_load.mcfunction: Called by lantern load instead of load, starts environment checks (these may take longer than 1 tick). Then callsawait_environment_checks.mcfunction. -
await_environment_check_results.mcfunction: Checks for the results of the environment checks started by this module. Defers (self schedule 1t) further execution until all checks have returned a result. When this has happend,load.mcfunctionis called. -
load.mcfunction: Prints out error messages depending on the result of the environment checks. Then does all the version compat checking. Runsinitif nothing fails
I believe this method would also require environment check clearing to move from post-load (where it is currently). I'm not entirely sure where it would go, but that's not exactly a huge issue