class proj_GetName extends KFMod.ShotgunBullet;


final protected function pcClientMessage(string s)
{
  if (KFPlayerController(owner) != none)
    KFPlayerController(owner).clientMessage(s);
}


simulated function processTouch(Actor other, vector hitLocation)
{
  if (other == none || other == KFPlayerController(owner).pawn || other.base == instigator || KFBulletWhipAttachment(other) != none)
    return;

  pcClientMessage(other.name);
  //  pcClientMessage(""@GetPropertyText(StaticMeshActor(other).StaticMesh.Materials[0].Material));
  //  pcClientMessage(""@GetPropertyText(StaticMeshActor(other).StaticMesh.Materials);
  pcClientMessage(""@StaticMeshActor(other).StaticMesh.GetPropertyText("Materials"));
  destroy();
}


simulated singular function hitWall(vector hitNormal, actor wall)
{
  pcClientMessage(wall.name@"Do I need this function at all?!");
  if (StaticMeshActor(wall) != none)
  {
    pcClientMessage(StaticMeshActor(wall).StaticMesh.GetPropertyText("Materials"));
    pcClientMessage(ReplaceText2(StaticMeshActor(wall).StaticMesh.GetPropertyText("Materials"), "true", "false"));
    pcClientMessage(SetPropertyText("Materials",ReplaceText2(StaticMeshActor(wall).StaticMesh.GetPropertyText("Materials"), "true", "false")));
  }
  spawn(impactEffect, , , location, rotator(-hitNormal));
  destroy();
}


static final function string ReplaceText2(coerce string Text, coerce string Replace, coerce string With)
{
  local int i;
  local string Output;

  i = InStr(Text, Replace);
  while (i != -1)
  {
    Output = Output $ Left(Text, i) $ With;
    Text = Mid(Text, i + Len(Replace));
    i = InStr(Text, Replace);
  }
  Output = Output $ Text;
  return Output;
}


// Referencers of Struct Engine.StaticMesh.StaticMeshMaterial:
//    ObjectProperty Engine.StaticMesh.StaticMeshMaterial.Material
//    BoolProperty Engine.StaticMesh.StaticMeshMaterial.EnableCollision
//    StructProperty Engine.StaticMesh.Materials.StructProperty0
// Can't save HideMut.u: Graph is linked to external private object Struct Engine.StaticMesh.StaticMeshMaterial
// History: UObject::SavePackage <- UMakeCommandlet::Main

defaultproperties
{
}
