/*  NEEDS THESE THINGS:
	_this
	walkInertia.as  (as walk_obj)
	react.as
	[walkSpeed]
	"terrainChange" event
*/
slippery_obj = runFunc(function(){
	var iceTerrain = [4];
	#include "../walkSpeed.as"
	walkSpeed.ice = {
		walkSpeed: 3,
		acel: 0.1,
		decel: 0.9
	}
	
	function terrainChange(evt){
		var newTerrain = evt.newTerrain;
		var oldTerrain = evt.oldTerrain;
		if( isIceTerrain(newTerrain)  &&  !isIceTerrain(oldTerrain) ){
			// slippery
			walkSpeed.change( "ice" );
		}
		else if( !isIceTerrain(newTerrain)  &&  isIceTerrain(oldTerrain) ){
			// normal
			if( walkSpeed.value == "ice" )		walkSpeed.change( "normal" );
		}
	}// terrainChange()
	
	function isIceTerrain( checkTerrain ){
		var output = false;
		for(var t=0; t<iceTerrain.length; t++){
			if(iceTerrain[t] === checkTerrain){
				output = true;
				break;
			}// if:  checkTerrain is one of the valid options, then pass
		}// for:  each groundTerrain
		return output;
	}// isIceTerrain()
	
	react.to("terrainChange").then = terrainChange;
});// make slippery_obj()