@name Lerp Function
@inputs 
@outputs 
@persist State Rng:ranger 
@trigger 
interval(1)

Prop = entity():isWeldedTo()

if(first()) {
    State = 0
    function vector lerp(V0:vector,V1:vector,T) {
        return (1-T)*V0 + T*V1
    }
    
    holoCreate(2)
    holoModel(2,"hq_dome")
    #holoDisableShading(2,1)
    holoParent(2,Prop)
    
    holoCreate(3)
    holoModel(3,"hq_cone")
    holoPos(3,Prop:toWorld(vec(0,0,-7)))
    holoAng(3,Prop:toWorld(ang(0,0,180)))
    #holoDisableShading(3,1)
    holoScale(3,vec(1,1,1.5))
    holoParent(3,Prop)
    
    Prop:setAlpha(0)
}

rangerFilter(entity())
rangerFilter(entity():isWeldedTo())
rangerFilter(players())
Rng = rangerOffset(1000,entity():isWeldedTo():pos(),-entity():isWeldedTo():up())

R = owner():keyWalk()

if(changed(R) & R) {holoCreate(1) holoAlpha(1,0) if(State == 0) {State = 1} else {State = 0}}

if (State == 1) {
    Prop:setPos(lerp(Rng:pos() + vec(0,0,14),holoEntity(1):pos() + vec(0,0,5),(cos(curtime() * 105) + 1) / 2))
}

if (changed(State == 0) & State == 0) {
    Prop:setPos(Rng:pos() + vec(0,0,40))
    holoDelete(1)
}
