@name PropWalker Cenn
@inputs 
@outputs 
@persist [E Player]:entity A:angle Mode Use Speed
@model models/hunter/plates/plate2x2.mdl


if(first())
{

    Speed = 30 
    Name = ""
    Print = 0
    Material = "phoenix_storms/mat/mat_phx_metallic2" # Default = phoenix_storms/mat/mat_phx_metallic2 
    Color = vec(0,255,0) # Default = 0,150,255
    E = entity()
    if(Name)
    {
        Player = findPlayerByName(Name)
    }
    else
    {
        Player = owner()
    }
    holoCreate(1,Player:attachmentPos("anim_attachment_head"))
    holoAlpha(1,0)
    holoParent(1,Player)
    E:propFreeze(0)
    E:propGravity(0)
    E:setColor(Color)
    E:setMaterial(Material)
    Mode = 1

}


interval(1)
Use = Player:keyUse()
if(Use & $Use & Mode)
{
    Mode = 0
    holoEntity(1):soundPlay(1,1,"common/bugreporter_succeeded.wav")
}
elseif(!Player:isAlive() | Player:inNoclip() | Use & $Use & !Mode)
{
    Mode = 1
    if(Use)
    {
        holoEntity(1):soundPlay(1,1,"common/bugreporter_succeeded.wav")
    }
}
if(Mode)
{
    E:propNotSolid(1)
    E:setAlpha(0)
    Z = 5
}
else
{
    E:propNotSolid(0)
    E:setAlpha(255)
    if(Player:isCrouch())
    {
        Z = 3
    }
    else
    {
        Z = 1.6
    }
    if(Player:keyAttack2())
    {
        Z = 0.5
    }
}
V = Player:pos()-vec(0,0,Z)
A = ang(0,0,0)
for(I=1,Speed)
{
    E:applyForce(((-E:pos()+V)*60-E:vel())*E:mass())
}
TarQ = quat(A+ang(0,90,0))
CurQ = quat(E)
Q = TarQ/CurQ
S = E:toLocal(rotationVector(Q)+E:pos())
E:applyTorque((150*S - 12*E:angVelVector())*E:inertia())

