refactored scan to also take pos arguments.

This commit is contained in:
gnembon committed 2020-04-16 22:33:53 -03:00
1 parent 17b15b4893
commit 56749f731a
5 files changed
+70 -33

No files matched your search

+8 -4
View File
@@ -2,11 +2,15 @@
These functions help scan larger areas of blocks without using generic loop functions, like nested `loop`.
### `scan(cx, cy, cz, dx, dy, dz, px?, py?, pz?, expr)`
### `scan(cx, cy, cz, dx, dy, dz, px?, py?, pz?, expr)`, `scan(center, range, lower_range?, expr)`
Evaluates expression over area of blocks defined by its center (`cx, cy, cz`), expanded in all directions
by `dx, dy, dz` blocks, or optionally in negative with `d` coords, and `p` coords in positive values. `expr`
receives `_x, _y, _z` as coords of current analyzed block and `_`, which represents the block itself.
Evaluates expression over area of blocks defined by its center `center = (cx, cy, cz)`, expanded in all directions
by `range = (dx, dy, dz)` blocks, or optionally in negative with `range` coords, and `upper_range` coords in
positive values.
`center` can be defined either as a three coordinates, list of three coords, or block value.
`range` and `lower_range` can have the same representations, just if its a block, it computes the distance to the center
as range instead of taking the values as is.
`expr` receives `_x, _y, _z` as coords of current analyzed block and `_`, which represents the block itself.
Returns number of successful evaluations of `expr` (with `true` boolean result) unless called in void context,
which would cause the expression not be evaluated for their boolean value.