class StartedUsingHealingItemOrCyberwarePrereqState extends PrereqState
{
	var m_listenerInfo : CallbackHandle;

	protected event OnStateUpdate( value : Uint32 )
	{
		var checkPassed : Bool;
		const var prereq : StartedUsingHealingItemOrCyberwarePrereq;
		prereq = ( ( StartedUsingHealingItemOrCyberwarePrereq )( GetPrereq() ) );
		checkPassed = prereq.Evaluate( value );
		if( checkPassed )
		{
			OnChangedRepeated( false );
		}
	}

}

class StartedUsingHealingItemOrCyberwarePrereq extends IScriptablePrereq
{
	var m_curValue : Uint32;
	default m_curValue = 0;

	public const function Evaluate( value : Uint32 ) : Bool
	{
		return value != m_curValue;
	}

	protected const override function OnRegister( state : PrereqState, game : GameInstance, context : IScriptable ) : Bool
	{
		var bb : IBlackboard;
		var castedState : StartedUsingHealingItemOrCyberwarePrereqState;
		var player : weak< PlayerPuppet >;
		player = ( ( PlayerPuppet )( context ) );
		if( player )
		{
			bb = GameInstance.GetBlackboardSystem( player.GetGame() ).Get( GetAllBlackboardDefs().PlayerPerkData );
			castedState = ( ( StartedUsingHealingItemOrCyberwarePrereqState )( state ) );
			castedState.m_listenerInfo = bb.RegisterListenerUint( GetAllBlackboardDefs().PlayerPerkData.StartedUsingHealingItemOrCyberware, castedState, 'OnStateUpdate' );
		}
		return false;
	}

	protected const override function OnUnregister( state : PrereqState, game : GameInstance, context : IScriptable )
	{
		var bb : IBlackboard;
		var castedState : StartedUsingHealingItemOrCyberwarePrereqState;
		var player : weak< PlayerPuppet >;
		player = ( ( PlayerPuppet )( context ) );
		if( player )
		{
			bb = GameInstance.GetBlackboardSystem( player.GetGame() ).Get( GetAllBlackboardDefs().PlayerPerkData );
			castedState = ( ( StartedUsingHealingItemOrCyberwarePrereqState )( state ) );
			bb.UnregisterListenerUint( GetAllBlackboardDefs().PlayerPerkData.StartedUsingHealingItemOrCyberware, castedState.m_listenerInfo );
		}
	}

}

