Add core.compare_block_status function (#11247)

Makes it possible to check the status of the mapblock in a future-extensible way.
This commit is contained in:
SmallJoker
2021-05-30 20:24:12 +02:00
committed by GitHub
parent 89f3991351
commit c9144ae5e2
10 changed files with 89 additions and 4 deletions

View File

@@ -5863,6 +5863,19 @@ Misc.
* If `transient` is `false` or absent, frees a persistent forceload.
If `true`, frees a transient forceload.
* `minetest.compare_block_status(pos, condition)`
* Checks whether the mapblock at positition `pos` is in the wanted condition.
* `condition` may be one of the following values:
* `"unknown"`: not in memory
* `"emerging"`: in the queue for loading from disk or generating
* `"loaded"`: in memory but inactive (no ABMs are executed)
* `"active"`: in memory and active
* Other values are reserved for future functionality extensions
* Return value, the comparison status:
* `false`: Mapblock does not fulfil the wanted condition
* `true`: Mapblock meets the requirement
* `nil`: Unsupported `condition` value
* `minetest.request_insecure_environment()`: returns an environment containing
insecure functions if the calling mod has been listed as trusted in the
`secure.trusted_mods` setting or security is disabled, otherwise returns