mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add "include_non_selectable" parameter to blocks raycast
This commit is contained in:
parent
ce769143f8
commit
8f1739c85b
10 changed files with 57 additions and 23 deletions
|
|
@ -136,7 +136,9 @@ Set specified bits.
|
|||
## Raycast
|
||||
|
||||
```lua
|
||||
block.raycast(start: vec3, dir: vec3, max_distance: number, [optional] dest: table, [optional] filter: table) -> {
|
||||
block.raycast(start: vec3, dir: vec3, max_distance: number, [optional] dest: table,
|
||||
[optional] filter: table, [optional] include_non_selectable = false
|
||||
) -> {
|
||||
block: int, -- block id
|
||||
endpoint: vec3, -- point of the ray hit point
|
||||
iendpoint: vec3, -- position of the block hit by the ray
|
||||
|
|
@ -150,6 +152,9 @@ Casts a ray from the start point in the direction of *dir*. Max_distance specifi
|
|||
Argument `filter` can be used to tell ray what blocks can be skipped(passed through) during ray-casting.
|
||||
To use filter `dest` argument must be filled with some value(can be nil), it's done for backwards compatability
|
||||
|
||||
The `include_non_selectable` argument determines whether blocks that cannot be selected by the cursor will be included.
|
||||
Example - `base:water`
|
||||
|
||||
The function returns a table with the results or nil if the ray does not hit any block.
|
||||
|
||||
The result will use the destination table instead of creating a new one if the optional argument specified.
|
||||
|
|
|
|||
|
|
@ -63,8 +63,9 @@ entities.get_all_in_radius(center: vec3, radius: number) -> array<int>
|
|||
```
|
||||
|
||||
```lua
|
||||
entities.raycast(start: vec3, dir: vec3, max_distance: number,
|
||||
ignore: int, [optional] destination: table, [optional] filter: table) -> table or nil
|
||||
entities.raycast(start: vec3, dir: vec3, max_distance: number, ignore: int, [optional] destination: table,
|
||||
[optional] filter: table, [optional] include_non_selectable = false
|
||||
) -> table or nil
|
||||
```
|
||||
|
||||
The function is an extended version of [block.raycast](libblock.md#raycast). Returns a table with the results if the ray touches a block or entity.
|
||||
|
|
|
|||
|
|
@ -92,7 +92,9 @@ block.material(blockid: int) -> string
|
|||
## Raycast
|
||||
|
||||
```lua
|
||||
block.raycast(start: vec3, dir: vec3, max_distance: number, [опционально] dest: table, [опционально] filter: table) -> {
|
||||
block.raycast(start: vec3, dir: vec3, max_distance: number, [опционально] dest: table,
|
||||
[опционально] filter: table, [опционально] include_non_selectable = false
|
||||
) -> {
|
||||
block: int, -- id блока
|
||||
endpoint: vec3, -- точка касания луча
|
||||
iendpoint: vec3, -- позиция блока, которого касается луч
|
||||
|
|
@ -106,6 +108,9 @@ block.raycast(start: vec3, dir: vec3, max_distance: number, [опциональ
|
|||
Аргумент `filter` позволяет указать какие блоки являются "прозрачными" для луча, прим.: {"base:glass","base:water"}.
|
||||
Для использования агрумент `dest` нужно чем-то заполнить(можно nil), это сделано для обратной совместимости
|
||||
|
||||
Аргумент `include_non_selectable` определяет, будут ли учтены блоки, которые нельзя выбрать курсором.
|
||||
Пример - `base:water`
|
||||
|
||||
Функция возвращает таблицу с результатами или nil, если луч не касается блока.
|
||||
|
||||
Для результата будет использоваться целевая (dest) таблица вместо создания новой, если указан опциональный аргумент.
|
||||
|
|
|
|||
|
|
@ -62,8 +62,9 @@ entities.get_all_in_radius(center: vec3, radius: number) -> table<int>
|
|||
```
|
||||
|
||||
```lua
|
||||
entities.raycast(start: vec3, dir: vec3, max_distance: number,
|
||||
ignore: int, [optional] destination: table, [optional] filter: table) -> table или nil
|
||||
entities.raycast(start: vec3, dir: vec3, max_distance: number, ignore: int, [optional] destination: table,
|
||||
[optional] filter: table, [optional] include_non_selectable = false
|
||||
) -> table или nil
|
||||
```
|
||||
|
||||
Функция является расширенным вариантом [block.raycast](libblock.md#raycast). Возвращает таблицу с результатами если луч касается блока, либо сущности.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue