class GetTargetLastKnownPosition extends AIbehaviortaskScript
{
	protected editable inlined var m_inTargetObject : AIArgumentMapping;
	protected editable inlined var m_outPosition : AIArgumentMapping;
	protected editable inlined var predictionTime : Float;

	protected export override function Activate( context : ScriptExecutionContext )
	{
		var targetObject : weak< GameObject >;
		var targetVelocity : Vector4;
		var threats : array< TrackedLocation >;
		var targetLastKnownPosition : Vector4;
		var i : Int32;
		targetObject = ( ( weak< weak< GameObject > > )( ScriptExecutionContext.GetMappingValue( context, m_inTargetObject ) ) );
		if( !( targetObject ) )
		{
			return;
		}
		targetLastKnownPosition = targetObject.GetWorldPosition();
		threats = GetPuppet( context ).GetTargetTrackerComponent().GetThreats( false );
		for( i = 0; i < threats.Size(); i += 1 )
		{
			if( threats[ i ].entity.GetEntityID() == targetObject.GetEntityID() )
			{
				targetLastKnownPosition = threats[ i ].lastKnown.position;
			}
		}
		if( predictionTime > 0.0 )
		{
			targetVelocity = ( ( gamePuppet )( targetObject ) ).GetVelocity();
			targetVelocity.Z = 0.0;
			targetLastKnownPosition += ( targetVelocity * predictionTime );
		}
		ScriptExecutionContext.SetMappingValue( context, m_outPosition, targetLastKnownPosition );
	}

}

class GetOwnPosition extends AIbehaviortaskScript
{
	protected editable inlined var m_outPosition : AIArgumentMapping;

	protected override function Activate( context : ScriptExecutionContext )
	{
		ScriptExecutionContext.SetMappingValue( context, m_outPosition, ScriptExecutionContext.GetOwner( context ).GetWorldPosition() );
	}

}

