var Clay = Clay || {};
// GameMaker related data is stored here... (a lot of callback stuff)
Clay['gamemaker'] = Clay['gamemaker'] || {};

/**
 * 
 * ACHIEVEMENT FUNCTIONS
 *  
 */

/**
 * Awards a Clay.io Achievement
 * @param {String} achievementID 
 */
Clay['gamemaker']['achievementAwarded'] = {};
function clay_achievement_award( achievementID )
{
	var achievement = new Clay['Achievement']( { id: achievementID } );
	achievement['award']( function( response ) {
		Clay['gamemaker']['achievementAwarded'][ achievementID ] = response;
	} );
}

function clay_achievement_awarded_success( achievementID )
{	
	return clay_check_ready( Clay['gamemaker']['achievementAwarded'][ achievementID ], ( Clay['gamemaker']['achievementAwarded'][ achievementID ] && Clay['gamemaker']['achievementAwarded'][ achievementID ]['success'] ) );	
}
function clay_achievement_awarded_fail( achievementID )
{
	return clay_check_ready( Clay['gamemaker']['achievementAwarded'][ achievementID ], ( Clay['gamemaker']['achievementAwarded'][ achievementID ] && ! Clay['gamemaker']['achievementAwarded'][ achievementID ]['success'] ) );	
}