@name Gmodder - By Croco
@inputs Pod:wirelink Cam:wirelink Seat:entity  
@persist Fall MODEL:string E:entity LL
@outputs Jump T

runOnTick(1)
runOnChat(1)




if (first())
{
    T = 0
    LL = 0
holoCreate(1)
holoModel(1,"models/Humans/Group01/male_07.mdl")
holoAnim(1,124)
holoScale(1,vec(0.2,0.2,0.4))
holoCreate(2)
holoModel(2,"models/Weapons/w_physics.mdl")
holoSkin(2,1)
holoPos(2,holoEntity(1):pos() + vec(5,0,40))
holoParentAttachment(2,holoEntity(1),"anim_attachment_RH")
holoCreate(3)
holoModel(3,"hq_cylinder")    
T = 0
}
if(chatClk(owner())){
    if(owner():lastSaid()=="/kill"){
        Seat:killPod()
        hideChat(1)
    }    
}


timer("idle",5000)
if(clk("idle")){
    holoAnim(1,3)
}

Ang = Seat:driver():eyeAngles():yaw()
Ang2 = Seat:driver():eyeAngles()
holoAng(1,ang(0,Ang,0))
W = Pod["W",number]
A = Pod["A",number]
S = Pod["S",number]
D = Pod["D",number]
Mouse1 = Pod["Mouse1",number]
Mouse2 = Pod["Mouse2",number]
Space = Pod["Space",number]
Shift = Pod["Shift",number]
GH = Pod["Active",number]
if(W){
holoPos(1,holoEntity(1):pos()+holoEntity(1):forward()*3)
timer("step",1000)
}
if(clk("step")){
holoAnim(1,13)}


if(S){
holoPos(1,holoEntity(1):pos()+holoEntity(1):forward()*-3) 
}


if(A){
 holoPos(1,holoEntity(1):pos()+holoEntity(1):right()*-3)
}   


if(D){
holoPos(1,holoEntity(1):pos()+holoEntity(1):right()*3)
timer("step",1000)
}

if(Mouse1){
    if(T == 1){
        MODEL = "models/props_borealis/bluebarrel001.mdl"
        findByModel(MODEL)
        E = findClosest(holoEntity(3):pos())
        E:parentTo(holoEntity(3))
       LL = 1
        holoCreate(3)
holoModel(3,"hq_cylinder")    
holoAlpha(3,255)
holoPos(3,holoEntity(1):pos() + vec(70,-7,38):rotate(holoEntity(1):angles()))
holoAng(3,holoEntity(2):angles() + ang(90,0,0))
holoParent(3,holoEntity(1))
holoColor(3,vec(30,30,255))
holoScale(3,vec(0.5,0.5,10))
}}


else{
    if(LL == 1){  
        propSpawnEffect(0)
      JJ = propSpawn("models/props_borealis/bluebarrel001.mdl",E:pos(),0)
    JJ:setAng(E:angles())
    holoDelete(3)
    LL = 0
}}

if(!W & !S & !A & !D){
    if(GH > 0){
holoAnim(1,124)
T = 1}}
else{T = 0 

    if(GH > 0){stoptimer("idle")}
}

if(changed(Space)){
Jump =1
}


Cam["Angle",angle] = holoEntity(1):angles()

Cam["Position",vector] = holoEntity(1):pos()+vec(10,10,65):rotate(holoEntity(1):angles())

Cam["Activated",number] = Pod["Active",number]      


Ranger = rangerOffset(500000000,holoEntity(1):pos()+vec(0,0,15),-holoEntity(1):up())
G = rangerOffsetHull(holoEntity(1):toWorld(vec(0,0,50)),holoEntity(1):toWorld(vec(0,0,-3)),vec(-10,-10,1),vec(10,10,1))

if(!G:hit()){
    if(!Fall){Fall = 1}
    if (Jump==0){
    Fall+=0.15
    Fall = clamp(Fall,-25,25)
    holoPos(1,holoEntity(1):pos()-vec(0,0,Fall))
}
}
if(G:hit()){Fall = 0 holoPos(1,G:position())}

if(Ranger:pos():z()>holoEntity(1):pos():z()){
    holoPos(1,Ranger:pos())
}

if(!holoEntity(1):pos():isInWorld()){
 holoPos(1,holoEntity(1):toWorld(vec(-50,0,0)))
}

if (changed(Space)&Space==1&Fall==0){Jump=1
    J=40}
if (Jump==1){J-=1
    holoPos(1,holoEntity(1):pos()+vec(0,0,J))
}
if (J<=-1){Jump=0}

