class UpperBodyNPCStatePrereqState extends NPCStatePrereqState
{
}

class UpperBodyNPCStatePrereq extends NPCStatePrereq
{
	var m_valueToListen : gamedataNPCUpperBodyState;

	protected const override function OnRegister( state : PrereqState, game : GameInstance, context : IScriptable ) : Bool
	{
		var bb : IBlackboard;
		var castedState : UpperBodyNPCStatePrereqState;
		bb = ( ( ScriptedPuppet )( context ) ).GetPuppetStateBlackboard();
		castedState = ( ( UpperBodyNPCStatePrereqState )( state ) );
		castedState.m_owner = ( ( GameObject )( context ) );
		castedState.m_prevValue = bb.GetInt( GetAllBlackboardDefs().PuppetState.UpperBody );
		castedState.m_listenerInt = bb.RegisterListenerInt( GetAllBlackboardDefs().PuppetState.UpperBody, castedState, 'OnStateUpdate' );
		return false;
	}

	protected const override function OnUnregister( state : PrereqState, game : GameInstance, context : IScriptable )
	{
		var castedState : UpperBodyNPCStatePrereqState;
		castedState = ( ( UpperBodyNPCStatePrereqState )( state ) );
		( ( ScriptedPuppet )( context ) ).GetPuppetStateBlackboard().UnregisterListenerInt( GetAllBlackboardDefs().PuppetState.UpperBody, castedState.m_listenerInt );
	}

	protected override function Initialize( recordID : TweakDBID )
	{
		super.Initialize( recordID );
		m_valueToListen = ( ( gamedataNPCUpperBodyState )( ( ( Int32 )( EnumValueFromString( "gamedataNPCUpperBodyState", GetStateName( recordID ) ) ) ) ) );
	}

	protected const override function GetStateToCheck() : Int32
	{
		return ( ( Int32 )( m_valueToListen ) );
	}

}

