class IgnoreBarbedWirePrereq extends IScriptablePrereq
{
	var m_minStateTime : Float;
	var m_invert : Bool;

	protected export override function Initialize( recordID : TweakDBID )
	{
		m_minStateTime = TweakDBInterface.GetFloat( recordID + T".minStateTime", 0.0 );
		m_invert = TweakDBInterface.GetBool( recordID + T".invert", false );
	}

	protected export const override function OnApplied( state : PrereqState, game : GameInstance, context : IScriptable )
	{
		state.OnChanged( IsFulfilled( game, context ) );
	}

	public const override function IsFulfilled( game : GameInstance, context : IScriptable ) : Bool
	{
		var bb : IBlackboard;
		var stateEnterTime : Float;
		var checkPassed : Bool;
		checkPassed = false;
		bb = GameInstance.GetBlackboardSystem( game ).GetLocalInstanced( ( ( ScriptedPuppet )( context ) ).GetEntityID(), GetAllBlackboardDefs().PlayerStateMachine );
		if( !( bb ) )
		{
			return false;
		}
		stateEnterTime = bb.GetFloat( GetAllBlackboardDefs().PlayerStateMachine.IgnoreBarbedWireStateEnterTime );
		checkPassed = ( stateEnterTime > 0.0 ) && ( ( EngineTime.ToFloat( GameInstance.GetSimTime( game ) ) - stateEnterTime ) > m_minStateTime );
		return checkPassed != m_invert;
	}

}

