@name Plug and Play Controller
@inputs Linkup W A S D R Mouse1 Mouse2 Shift Alt Space Active User:entity
@outputs Linked:entity PosVec:vector AngVec:vector CamOn
@persist X Y Z
@trigger all
Angle=User:passenger():eye():toAngle()
interval(10)
if(first()){Linked = entity()}
if(Linkup){
if(W) {Y +=sin(Angle:yaw())*sin(Angle:pitch()+90)*4*((Shift*5)+1)
       X +=cos(Angle:yaw())*sin(Angle:pitch()+90)*4*((Shift*5)+1)
       Z +=cos(Angle:pitch()+90)*4*((Shift*5)+1)}
if(S) {Y -=sin(Angle:yaw())*4*sin(Angle:pitch()+90)*((Shift*5)+1)
       X -=cos(Angle:yaw())*4*sin(Angle:pitch()+90)*((Shift*5)+1)
       Z -=cos(Angle:pitch()+90)*4*((Shift*5)+1)}
if(A) {Y +=cos(Angle:yaw())*4*((Shift*5)+1)
       X -=sin(Angle:yaw())*4*((Shift*5)+1)}
if(D) {Y -=cos(Angle:yaw())*4*((Shift*5)+1)
       X +=sin(Angle:yaw())*4*((Shift*5)+1)}
if(Mouse1) {Z +=1*(Shift*10)+1}
if(Mouse2) {Z -=1*(Shift*10)+1}
entity():setPos(vec(X,Y,Z))
}
if(Active){
    PosVec = entity():pos()
    AngVec = User:passenger():eye()
    CamOn = 1
    entity():setColor(0,0,0,0)
}
if(!Active){
    CamOn = 0
    entity():setColor(255,255,255,255)
}
if(R){X = User:pos():x() 
      Y = User:pos():y()
      Z = User:pos():z() +100
}
