Inserting something like this (after you traced to the ground) could help:

Code:
		if(trace_hit){//
			if(normal.z > 0.8){//lowen if needed
				my.speed_z = - (my.dist_to_ground - 0.2);
			}
			else{
				my.speed_z = -(my.entity_gravity * (1/(normal.z)));
			}
			
			my.speed_z = max (-my.entity_gravity*2 * time_step, my.speed_z);
		}