renamed find_entity in engine to find_ent_by_class (find_ent_by_classname works too)

This commit is contained in:
Johnny Bergström 2004-03-09 08:32:50 +00:00
parent 0f4c470e67
commit d1379bb671
3 changed files with 7 additions and 6 deletions

View File

@ -1830,7 +1830,7 @@ static cell AMX_NATIVE_CALL create_entity(AMX *amx, cell *params) {
}
//ej ref'd by jghg
static cell AMX_NATIVE_CALL find_entity(AMX *amx, cell *params) /* 3 param */
static cell AMX_NATIVE_CALL find_ent_by_class(AMX *amx, cell *params) /* 3 param */
{
edict_t *pEnt = INDEXENT(params[1]);
@ -3160,7 +3160,8 @@ AMX_NATIVE_INFO Engine_Natives[] = {
{"create_entity", create_entity},
{"remove_entity", remove_entity},
{"find_entity", find_entity},
{"find_ent_by_class", find_ent_by_class},
{"find_ent_by_classname", find_ent_by_class}, // just in case anyone likes typing the whole thing
{"find_ent_by_owner", find_ent_by_owner},
{"find_ent_by_target", find_ent_by_target},
{"find_ent_by_tname", find_ent_by_tname},

View File

@ -93,7 +93,7 @@ native entity_set_byte(iIndex, iKey, iVal);
native create_entity(szClassname[]);
/* Finds an entity in the world, will return 0 if nothing is found */
native find_entity(iIndex, szClass[]);
native find_ent_by_class(iIndex, szClass[]);
native find_ent_by_owner(iIndex, szClass[], iOwner);
native find_ent_by_target(iIndex, szClass[]);
native find_ent_by_tname(iIndex, szClass[]);

View File

@ -61,13 +61,13 @@ stock get_entity_distance(ent1, ent2)
/* Get grenade thrown by this user */
stock get_grenade(id)
{
new iGrenade = find_entity(-1, "grenade")
new iGrenade = find_ent_by_class(-1, "grenade")
while(iGrenade > 0)
{
if(entity_get_edict(iGrenade, EV_ENT_owner) == id)
return iGrenade
iGrenade = find_entity(iGrenade, "grenade")
iGrenade = find_ent_by_class(iGrenade, "grenade")
}
return 0
@ -92,7 +92,7 @@ stock remove_entity_name(eName[])
while (iEntity > 0)
{
remove_entity(iEntity)
iEntity = find_entity(-1, eName)
iEntity = find_ent_by_class(-1, eName)
}
return 1