@name FailCake Spirit E2
@inputs 
@outputs Hide Scale Use 
@persist Timer Holding Use Ent:entity 
@trigger all
runOnTick(1)
O = owner()
E = entity()


if(first()){
Hide = 1
Use= 1
E:setAlpha(0) 
}


if(Hide == 1){
Hide = 1
O:setAlpha(0)
Timer+=0.1

if(Timer == 1){
holoEntity(8):soundPlay(1000,1000,"player/heartbeat1.wav")
holoEntity(8):setTrails(10,10,10,"trails/laser",vec(0,155,255),30) 
holoEntity(7):setTrails(10,10,10,"trails/laser",vec(255,255,255),30)    
}

holoCreate(1)
holoModel(1,"hqicosphere")
holoScaleUnits(1,vec(-16,-16,-16))
holoPos(1,O:pos()+vec(0,0,Scale))
holoColor(1,vec(0,0,255))
holoAlpha(1,20)
holoMaterial(1,"models/props_combine/portalball001_sheet")

holoCreate(2)
holoModel(2,"hqicosphere")
holoScaleUnits(2,vec(-14,-14,-14))
holoPos(2,O:pos()+vec(0,0,Scale))
holoColor(2,vec(0,50,255))
holoAlpha(2,50)
holoMaterial(2,"models/props_combine/portalball001_sheet")

holoCreate(3)
holoModel(3,"hqicosphere")
holoScaleUnits(3,vec(-12,-12,-12))
holoPos(3,O:pos()+vec(0,0,Scale))
holoColor(3,vec(0,150,255))
holoAlpha(3,50)
holoMaterial(3,"models/props_combine/portalball001_sheet")

holoCreate(4)
holoModel(4,"hqicosphere")
holoScaleUnits(4,vec(-10,-10,-10))
holoPos(4,O:pos()+vec(0,0,Scale))
holoColor(4,vec(0,200,255))
holoAlpha(4,50)
holoMaterial(4,"models/props_combine/portalball001_sheet")

holoCreate(5)
holoModel(5,"hqicosphere")
holoScaleUnits(5,vec(-8,-8,-8))
holoPos(5,O:pos()+vec(0,0,Scale))
holoColor(5,vec(0,255,255))
holoAlpha(5,100)
holoMaterial(5,"models/props_combine/portalball001_sheet")

holoCreate(6)
holoModel(6,"hqicosphere")
holoScaleUnits(6,vec(-7,-7,-7))
holoPos(6,O:pos()+vec(0,0,Scale))
holoColor(6,vec(255,255,255))
holoAlpha(6,100)
holoMaterial(6,"models/props_combine/portalball001_sheet")

holoCreate(7)
holoModel(7,"hqicosphere")
holoScaleUnits(7,vec(-6,-6,-6))
holoPos(7,O:pos()+vec(0,0,Scale))
holoColor(7,vec(255,255,255))
holoAlpha(7,150)
holoMaterial(7,"models/props_combine/portalball001_sheet")

holoCreate(8)
holoModel(8,"hqicosphere")
holoScaleUnits(8,vec(-5.5,-5.5,-5.5))
holoPos(8,O:pos()+vec(0,0,Scale))
holoColor(8,vec(255,255,255))
holoAlpha(8,200)
holoMaterial(8,"models/props_combine/portalball001_sheet")
}

if(O:isCrouch() & Hide == 1){
Scale = 30   
}else{
Scale = 50
}



HoldDistance = 100
ThrowStrength = 999999
Use = owner():keyUse()

if(Use&$Use){
    if(Holding){
        Holding = 0
    }else{
        Ent = owner():aimEntity()
        if((Ent:type()=="prop_physics"&!Ent:isFrozen()&Ent:owner()==owner()))
        {Holding = 1}
    }
}
if(Holding){
    Ent:soundPlay(222,222,"misc/hologram_move.wav")
    Ent:setColor(70,70,70)
    soundPitch(222,100)
    Point = owner():shootPos()+owner():eye()*(HoldDistance+Ent:radius())
    Ent:applyForce(((Point-Ent:pos())*25-Ent:vel())*Ent:mass())
    if(!Ent){Holding = 0}
    if(owner():keyAttack2()){
        Holding = 0
        Ent:setColor(255,255,255)
        soundStop(222)
        Ent:applyForce(owner():eye()*ThrowStrength*Ent:mass())
    }
}

