class NPCLocomotionTypePrereqState extends PrereqState
{
	var m_owner : weak< GameObject >;
	var m_listenerInt : CallbackHandle;

	protected event OnLocomotionTypeChanged( value : Int32 )
	{
		var checkPassed : Bool;
		const var prereq : NPCLocomotionTypePrereq;
		prereq = ( ( NPCLocomotionTypePrereq )( GetPrereq() ) );
		checkPassed = prereq.Evaluate( m_owner, value );
		OnChanged( checkPassed );
	}

}

class NPCLocomotionTypePrereq extends IScriptablePrereq
{
	var m_locomotionMode : array< gamedataLocomotionMode >;
	var m_invert : Bool;

	protected override function Initialize( recordID : TweakDBID )
	{
		var str : String;
		str = TweakDBInterface.GetString( recordID + T".locomotionType", "" );
		m_locomotionMode.PushBack( ( ( gamedataLocomotionMode )( ( ( Int32 )( EnumValueFromString( "gamedataLocomotionMode", str ) ) ) ) ) );
		m_invert = TweakDBInterface.GetBool( recordID + T".invert", false );
	}

	protected const override function OnRegister( state : PrereqState, game : GameInstance, context : IScriptable ) : Bool
	{
		var bb : IBlackboard;
		var castedState : NPCLocomotionTypePrereqState;
		var owner : weak< ScriptedPuppet >;
		owner = ( ( ScriptedPuppet )( context ) );
		if( owner )
		{
			bb = owner.GetPuppetStateBlackboard();
		}
		castedState = ( ( NPCLocomotionTypePrereqState )( state ) );
		castedState.m_owner = ( ( GameObject )( owner ) );
		castedState.m_listenerInt = bb.RegisterListenerInt( GetAllBlackboardDefs().PuppetState.LocomotionMode, castedState, 'OnLocomotionTypeChanged' );
		return false;
	}

	public const function Evaluate( owner : GameObject, value : Int32 ) : Bool
	{
		if( m_locomotionMode.Contains( ( ( gamedataLocomotionMode )( value ) ) ) )
		{
			return ( ( m_invert ) ? ( false ) : ( true ) );
		}
		return ( ( m_invert ) ? ( true ) : ( false ) );
	}

}

