NSEntity: DropToFloor() should return a boolean akin to the original builtin.

This commit is contained in:
Marco Cawthorne 2023-04-22 01:05:56 -07:00
parent 3a755aaba7
commit c5626ce347
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
2 changed files with 8 additions and 7 deletions

View File

@ -296,8 +296,8 @@ public:
/* useful methods, (some) based on GMod's API */
/** Returns the unique entity id of the entity. */
nonvirtual float EntIndex(void);
/** When called, will drop the entity down onto the surface it's hovering over. */
nonvirtual void DropToFloor(void);
/** When called, will drop the entity down onto the surface it's hovering over. Will return `false` if the entity fell through the floor, or something else that's undesirable. */
nonvirtual bool DropToFloor(void);
/** Returns a normalized forward vector of the entity to more easily test which way it's facing. */
nonvirtual vector GetForward(void);
/** Returns a normalized right vector of the entity to more easily test what's right next to it. */

View File

@ -14,12 +14,13 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
static void droptofloorwrapper( entity foo ) {
static bool droptofloorwrapper( entity foo ) {
bool result;
entity old_self = self;
self = foo;
droptofloor();
result = droptofloor();
self = old_self;
return result;
}
void NSEntity::NSEntity( void ) {
@ -52,8 +53,8 @@ float NSEntity::EntIndex( void ) {
return ( num_for_edict( this ) );
}
void NSEntity::DropToFloor( void ) {
droptofloorwrapper( this );
bool NSEntity::DropToFloor( void ) {
return droptofloorwrapper( this );
}
vector NSEntity::GetForward( void ) {