mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 06:21:50 +00:00
add entities.raycast & update docs structure
This commit is contained in:
parent
23cfe4a4cf
commit
9cdf3e29cc
9 changed files with 389 additions and 348 deletions
26
doc/en/scripting/builtins/libentities.md
Normal file
26
doc/en/scripting/builtins/libentities.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Library *entities*
|
||||
|
||||
The library is designed to work with a registry of entities.
|
||||
|
||||
```lua
|
||||
-- Returns an entity by unique identifier
|
||||
-- The table returned is the same one available in the entity components.
|
||||
entities.get(uid: int) -> table
|
||||
|
||||
-- Creates the specified entity.
|
||||
-- args - table of component parameter tables (ARGS variable)
|
||||
-- args is optional
|
||||
entities.spawn(name: str, pos: vec3, [optional] args: table)
|
||||
|
||||
-- Checks the existence of an entity by a unique identifier.
|
||||
entities.exists(uid: int) -> bool
|
||||
```
|
||||
|
||||
```lua
|
||||
entities.raycast(start: vec3, dir: vec3, max_distance: number,
|
||||
ignore: int, [optional] destination: table) -> 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.
|
||||
|
||||
Accordingly, this will affect the presence of the *entity* and *block* fields.
|
||||
Loading…
Add table
Add a link
Reference in a new issue