GM4_Datapacks icon indicating copy to clipboard operation
GM4_Datapacks copied to clipboard

Environment Checks

Open Bloo-dev opened this issue 1 year ago • 3 comments

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_enabled echeck
  • [ ] Add world_generation_resources_present echeck
  • [x] ~~Add load_executed echeck~~ 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

Bloo-dev avatar Jan 28 '25 14:01 Bloo-dev

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 in environment_check/ (same level as function/) and move all those files over at build time (may cause issues when someone names a folder in function/ 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.

Bloo-dev avatar Feb 09 '25 15:02 Bloo-dev

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 calls await_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.mcfunction is called.
  • load.mcfunction: Prints out error messages depending on the result of the environment checks. Then does all the version compat checking. Runs init if nothing fails

Bloo-dev avatar Aug 19 '25 21:08 Bloo-dev

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

runcows avatar Aug 21 '25 09:08 runcows