mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Expose getPointedThing to Lua
This commit introduces Raycast, a Lua user object, which can be used to perform a raycast on the map. The ray is continuable, so one can also get hidden nodes (for example to see trough glass).
This commit is contained in:
parent
a80ecbee1e
commit
3caad3f3c9
25 changed files with 671 additions and 313 deletions
|
@ -42,6 +42,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
|
||||
class IGameDef;
|
||||
class Map;
|
||||
struct PointedThing;
|
||||
class RaycastState;
|
||||
|
||||
class Environment
|
||||
{
|
||||
|
@ -76,6 +78,26 @@ public:
|
|||
|
||||
u32 getDayCount();
|
||||
|
||||
/*!
|
||||
* Gets the objects pointed by the shootline as
|
||||
* pointed things.
|
||||
* If this is a client environment, the local player
|
||||
* won't be returned.
|
||||
* @param[in] shootline_on_map the shootline for
|
||||
* the test in world coordinates
|
||||
*
|
||||
* @param[out] objects found objects
|
||||
*/
|
||||
virtual void getSelectedActiveObjects(const core::line3d<f32> &shootline_on_map,
|
||||
std::vector<PointedThing> &objects) = 0;
|
||||
|
||||
/*!
|
||||
* Returns the next node or object the shootline meets.
|
||||
* @param state current state of the raycast
|
||||
* @result output, will contain the next pointed thing
|
||||
*/
|
||||
void continueRaycast(RaycastState *state, PointedThing *result);
|
||||
|
||||
// counter used internally when triggering ABMs
|
||||
u32 m_added_objects;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue