@name Halivare
@inputs 
@outputs 
@persist State CPit 
@trigger 
interval(100)

EW = entity():isWeldedTo()

if (first()) {
    holoCreate(0)
    holoPos(0,EW:toWorld(vec(0,-16,44.34)))
    holoAng(0,EW:toWorld(ang(0,90,0)))
    holoScale(0,vec(0.1,0.1,0.1))
    holoParent(0,EW)
    
    holoCreate(1)
    holoPos(1,EW:toWorld(vec(0,23.36,10)))
    holoAng(1,EW:toWorld(ang(0,90,0)))
    holoScale(1,vec(0.1,1,1.5))
    holoParent(1,0)
    
    holoCreate(2)
    holoPos(2,EW:toWorld(vec(0,20.34,27.25)))
    holoAng(2,EW:toWorld(ang(-20,90,0)))
    holoScale(2,vec(0.1,1,1.5))
    holoParent(2,1)
    
    holoCreate(3)
    holoPos(3,EW:toWorld(vec(0,9.72,39.91)))
    holoAng(3,EW:toWorld(ang(-60,90,0)))
    holoScale(3,vec(0.1,1,1.5))
    holoParent(3,2)
    
    holoCreate(4)
    holoPos(4,EW:toWorld(vec(0,-6.8,44.34)))
    holoAng(4,EW:toWorld(ang(90,90,0)))
    holoScale(4,vec(0.1,1,1.5))
    holoParent(4,3)
    
    for(I = 1,4) {holoMaterial(I,"models/props_combine/citadel_cable_b")}
}

R = owner():keyWalk()

if(changed(R) & R & (CPit == -45 | CPit == 0)) {
if(State == 0) {State = 1} else {State = 0}}

if(State == 1) {
    if(CPit > -45) {
        CPit -= 1
        holoAng(0,EW:toWorld(ang(CPit,90,0)))
    }
} else {
    if(CPit < 0) {
        CPit += 1
        holoAng(0,EW:toWorld(ang(CPit,90,0)))
    }
}
