class ReportInteraction extends Interaction;

event NotifyLevelChange()
{
    if (master != none) {
        master.RemoveInteraction(self);
    }
}

final private function KFPlayerController getController()
{
  return KFPlayerController(viewportOwner.actor);
}

exec function mySp(string s)
{
  local bool b;
  if (s ~= "1") {
    b = true;
  }
  ShowPathNodes(b);
  ShowPaths(b);
}

simulated function ShowPathNodes(bool b)
{
  local NavigationPoint np;
  local int i, j;
  if (b)
  {
    foreach GetController().AllActors(class'NavigationPoint', np)
    {
      if (np == none)
        continue;
      np.bHidden = false;
      np.resetStaticFilterState();

      j++;
      i++;
    }
  }
  else
  {
    foreach GetController().AllActors(class'NavigationPoint', np)
    {
      if (np == none)
        continue;
      np.bHidden = true;
      np.resetStaticFilterState();
    }
  }
}


// show zed paths:
//  Orange - Flying path, narrow.
//  Light Orange - Flying path, wide.
//  Light Purple - requires high jump (higher than normal jump capability).
//  Blue - narrow path.
//  Green - normal width.
//  White - wide path.
//  Pink - very wide path.
//  Yellow - forced path.
//  Purple - "advanced" path (requires "intelligence" to be used).
//  Red - "one-way" path (i.e. path going from node A->B, but B->A is proscribed).
final function ShowPaths(bool b)
{
  local KFPlayerController pc;
  local NavigationPoint np;
  local array<NavigationPoint> np_array;
  local ReachSpec Spec;
  local vector SpecColor;
  local int i, j;
  local int debugLinesDrawn;

  pc = getController();

  if (!b)
  {
    pc.ClearStayingDebugLines();
    return;
  }

  foreach GetController().AllActors(class'NavigationPoint', np)
  {
    if (np == none)
      continue;

    np_array.length = i + 1;
    np_array[i] = np;

    i++;
  }

  for (i = np_array.length - 1; i >= 0; i--)
  {
    for (j = 0; j < np_array[i].PathList.Length; j++)
    {
      Spec = np_array[i].PathList[j];
      SpecColor = vect(0, 255, 0);
      // 260 = MAXVEHICLERADIUS 80 = MINCOMMONHEIGHT
      if (( Spec.CollisionRadius >= 260 ) && (Spec.CollisionHeight >= 80))
      {
        SpecColor = vect( 255,255,255 );
      }
      // Jump spec
      else if( ( Spec.reachFlags & 8 ) == Spec.reachFlags )
      {
        SpecColor = vect( 191, 165, 99 );
      }
      // Proscribed
      else if( ( Spec.reachFlags & 128 ) == Spec.reachFlags )
      {
        SpecColor = vect( 255, 0, 0 );
      }
      // Forced
      else if( ( Spec.reachFlags & 256 ) == Spec.reachFlags )
      {
        SpecColor = vect( 255, 255, 0 );
      }
      // Blue (narrow)
      else if( ( Spec.CollisionRadius < 72 || Spec.CollisionHeight < 80 ) )
      {
        SpecColor = vect( 0, 0, 255 );
      }

      pc.DrawStayingDebugLine(np_array[i].PathList[j].Start.Location, np_array[i].PathList[j].End.Location, SpecColor.X, SpecColor.Y, SpecColor.Z);
      debugLinesDrawn += 1;
    }
  }
  GetController().ClientMessage("Path segments amount is:" @ debugLinesDrawn);
}

defaultproperties
{
    bVisible = true
}