1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Intersects_protection(): Move from Minetest Game to builtin (#6952)

A useful function that applies 'core.is_protected()' to a 3D lattice of
points evenly spaced throughout a defined volume, with a parameter for
the maximum spacing of points.
This commit is contained in:
Paramat 2018-01-23 18:04:58 +00:00 committed by Loïc Blot
parent 0425c6b8c8
commit 01bc817fe0
2 changed files with 75 additions and 1 deletions

View file

@ -3413,6 +3413,16 @@ These functions return the leftover itemstack.
* `minetest.record_protection_violation(pos, name)`
* This function calls functions registered with
`minetest.register_on_protection_violation`.
* `minetest.intersects_protection(minp, maxp, player_name, interval)
* Returns a boolean, returns true if the volume defined by `minp` and `maxp`
intersects a protected area not owned by `player_name`.
* Applies `is_protected()` to a 3D lattice of points in the defined volume.
The points are spaced evenly throughout the volume and have a spacing
similar to, but no larger than, `interval`.
* All corners and edges of the defined volume are checked.
* `interval` defaults to 4.
* `interval` should be carefully chosen and maximised to avoid an excessive
number of points being checked.
* `minetest.rotate_and_place(itemstack, placer, pointed_thing, infinitestacks, orient_flags)`
* Attempt to predict the desired orientation of the facedir-capable node
defined by `itemstack`, and place it accordingly (on-wall, on the floor, or