static LUA_DECLARE( destroy ) { CClientEntity *entity = (CClientEntity*)lua_touserdata( L, lua_upvalueindex( 1 ) ); // Before we do anything, fire the on-destroy event // This is placed here as calling from destructor is invalid (due to C++ class integrity) entity->CallEvent( "onClientElementDestroy", L, 0 ); return 0; }
void CClientPickup::Callback_OnLeave ( CClientColShape& Shape, CClientEntity& Entity ) { if ( IS_PLAYER ( &Entity ) ) { bool bMatchingDimensions = (GetDimension () == Entity.GetDimension ()); // Matching dimensions? // Call the pickup leave event (source = the pickup that was left) CLuaArguments Arguments; Arguments.PushElement ( &Entity ); // The element that left the pickup Arguments.PushBoolean ( bMatchingDimensions ); CallEvent ( "onClientPickupLeave", Arguments, true); // Call the player pickup leave event (source = the player that left the pickup) CLuaArguments Arguments2; Arguments2.PushElement ( this ); // The pickup that was left (this) Arguments2.PushBoolean ( bMatchingDimensions ); Entity.CallEvent ( "onClientPlayerPickupLeave", Arguments2, true ); } }