mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
Engine: Add entity_intersects native.
This commit is contained in:
parent
7d69a78d06
commit
dbe95c849b
@ -1540,11 +1540,35 @@ static cell AMX_NATIVE_CALL set_ent_rendering(AMX *amx, cell *params) // set_use
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL entity_intersects(AMX *amx, cell *params) // bool:entity_intersects(entity, other); = 2 arguments
|
||||
{
|
||||
// params[1] = entity
|
||||
// params[2] = other
|
||||
|
||||
CHECK_ENTITY_SIMPLE(params[1]);
|
||||
CHECK_ENTITY_SIMPLE(params[2]);
|
||||
|
||||
entvars_s *pevEntity = VARS(INDEXENT2(params[1]));
|
||||
entvars_s *pevOther = VARS(INDEXENT2(params[2]));
|
||||
|
||||
if (pevOther->absmin.x > pevEntity->absmax.x ||
|
||||
pevOther->absmin.y > pevEntity->absmax.y ||
|
||||
pevOther->absmin.z > pevEntity->absmax.z ||
|
||||
pevOther->absmax.x < pevEntity->absmin.x ||
|
||||
pevOther->absmax.y < pevEntity->absmin.y ||
|
||||
pevOther->absmax.z < pevEntity->absmin.z)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO ent_NewNatives[] =
|
||||
{
|
||||
{"DispatchKeyValue", DispatchKeyValue},
|
||||
{"set_ent_rendering", set_ent_rendering},
|
||||
{"entity_intersects", entity_intersects},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -250,4 +250,15 @@ native trace_forward(const Float:start[3], const Float:angle[3], Float:give, ign
|
||||
*/
|
||||
native set_ent_rendering(index, fx = kRenderFxNone, r = 0, g = 0, b = 0, render = kRenderNormal, amount = 0);
|
||||
|
||||
/**
|
||||
* Checks whether two entities intersect by comparing
|
||||
* their absolute minimum and maximum coordinates.
|
||||
*
|
||||
* @param entity The first entity index to check.
|
||||
* @param other The second entity index to check.
|
||||
*
|
||||
* @return true on success, false otherwise.
|
||||
*/
|
||||
native bool:entity_intersects(entity, other);
|
||||
|
||||
#include <engine_stocks>
|
||||
|
Loading…
Reference in New Issue
Block a user