NSEntity: add method IsFacing() which should make some common sneakish tasks easier.
This commit is contained in:
parent
fae4bc09e5
commit
655b5fa33e
2 changed files with 10 additions and 0 deletions
|
@ -351,6 +351,9 @@ public:
|
|||
of any entity class that you want to support think functions in.
|
||||
This saves you the effort of writing your own routines and methods. */
|
||||
nonvirtual void HandleThink(void);
|
||||
|
||||
/** Returns either true or false depending on if this entity is facing the entity in question. */
|
||||
nonvirtual bool IsFacing(entity);
|
||||
};
|
||||
|
||||
#ifdef CLIENT
|
||||
|
|
|
@ -892,6 +892,13 @@ void NSEntity::HandleThink( void ) {
|
|||
}
|
||||
}
|
||||
|
||||
bool NSEntity::IsFacing(entity target)
|
||||
{
|
||||
vector vecDiff = normalize(target.origin - origin);
|
||||
makevectors(angles);
|
||||
return ((vecDiff * v_forward) > 0 ) ? true : false;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
NSEntity_ReadEntity(bool new)
|
||||
|
|
Loading…
Reference in a new issue