@name VNC Mouse
@inputs Num:wirelink
@outputs Pitch Yaw On YRate PRate Rad XYZ:vector
@persist Pitch Yaw On YRate PRate Rad
@trigger 
@model models/props_junk/sawblade001a.mdl
runOnTick(1)
runOnChat(1)
#by Captain Maim
N0 = Num:number("0")
N1 = Num:number("1")
N2 = Num:number("2")
N3 = Num:number("3")
N4 = Num:number("4")
N5 = Num:number("5")
N6 = Num:number("6")
N7 = Num:number("7")
N8 = Num:number("8")
N9 = Num:number("9")
Slash = Num:number("/")
Astrix = Num:number("*")
Minus = Num:number("-")
Plus = Num:number("+")
Enter = Num:number("enter")
Del = Num:number(".")
O=owner()
Chat=O:lastSaid()
if(chatClk()&Chat:find("VNC")){

    if(Chat=="on"){On=1 print("VNC On")}
    if(Chat=="off"){On=0 print("VNC Off")}
    if(Chat:find("<")){  #so say VNC<2<4 to set yaw sensitivity to 2, and pitch to 4
        Dump=Chat:explode("<")
        PRate=Dump[2,string]:toNumber()
        YRate=Dump[3,string]:toNumber()
    }
    
}
timer("toggle",250)
if(Minus&clk("toggle")){On=!On}
if(first()){
    Pitch=O:eyeAngles():pitch() Yaw=O:eyeAngles():yaw()
    YRate=2
    PRate=1
    Rad=30
}


if(On){
    if(N8){Pitch+=PRate} 
    if(N2){Pitch-=PRate}
    if(N4){Yaw-=YRate}
    if(N6){Yaw+=YRate}
    XYZ=vec(ang(sin(Yaw)*Rad,cos(Yaw)*Rad,Pitch))+O:shootPos()
    if(!holoEntity(1)){
        holoCreate(1,XYZ,vec(1,1,1)*0.1)
        holoAlpha(1,128)
    }else{holoPos(1,XYZ)}    
    Ang=(XYZ-O:shootPos()):toAngle()
    O:setEyeAngle(Ang)
}else{holoDelete(1)}



