class APCleanList extends Info;

var string MSG_Clean[4];

function Clean(PlayerController pc, UltraAdmin Admin, string trash)
{
  local Pickup Pickup;
  local CrossbuzzsawBlade CrossbuzzsawBlade;
  local PipeBombProjectile Pipes;
  local bool bAll, bSaw, bPipe, bDosh;

  switch(trash)
  {
    case "saw":
      bSaw = true;
      trash = MSG_Clean[0];
      break;
    case "pipe":
      bPipe = true;
      trash = MSG_Clean[1];
      break;
    case "dosh":
      bDosh = true;
      trash = MSG_Clean[2];
      break;
    default:
      bAll = true;
      trash = MSG_Clean[3];
  }

  foreach DynamicActors(class'Pickup', Pickup)
  {
    if(Pickup == none)
      continue;
    // remove dosh only if specified
    if(Pickup.bDropped || ((bAll || bDosh) && Pickup.IsA('CashPickup')))
      Pickup.Destroy();      
  }
  // saw removing
  if(bSaw || bAll)
  {
    //remove this annoying shit
    foreach DynamicActors(class'CrossbuzzsawBlade', CrossbuzzsawBlade)
    {
      if(CrossbuzzsawBlade == none)
        continue;

      if(CrossbuzzsawBlade.ImpactActor != none)
        CrossbuzzsawBlade.Destroy();
    }
  }
  // pipe removing
  if(bPipe || bAll)
  {
    foreach DynamicActors(class'PipeBombProjectile', Pipes)
    {
      if(Pipes == none)
        continue;
      Pipes.Destroy();
    }
  }

  Admin.BroadcastText("%b"$class'Helper'.static.ParsePlayerName(pc)@trash);
}

defaultproperties
{
  MSG_Clean[0]="%wcleaned all %rbuzzsaws%w."
  MSG_Clean[1]="%wcleaned all %rpipes%w."
  MSG_Clean[2]="%wcleaned all %rdosh%w."
  MSG_Clean[3]="%wcleaned all %rgarbage%w."
}