@name POWER RING FAILCAKE follow people
@inputs Reset
@persist Timer EE:entity O:entity FollowT:entity Follow T R G B
runOnTick(1)

if (first()){EE = entity()}

Timer += 0.1
EA=(EE:angles()*5+EE:angVel())*5
EV=EE:massCenter(),ER=EE:right()
EF=EE:forward(),EU=EE:up()
Lev=sqrt((EE:inertia():length()^2)/15)
Circle = vec(0, 0, 0)
TV = (O:pos() + vec(0,0,O:height() + 20))- (O:forward() * 10) + Circle - EV + vec(0,0,O:height() / 2) - EE:vel() / 5
EE:applyForce(TV*EE:mass())

findIncludeClass("player")
findExcludePlayer(owner())
Fsphere = findInSphere(entity():pos(), 50000)
if(Fsphere > 0){O = findClosest(entity():pos())}

Timer=Timer+0.2*0.3
T=Timer


R = random(255)
G = random(255)
B = random(255)


if(first()) {holoCreate(1) holoCreate(2)
    
}
    

holoModel(1,"torus3")
holoAng(1,ang(T,T,T))
holoColor(1,vec(255,215,0))
holoAlpha(1, 100)
holoScale(1, vec(-1.5,-1.5,-1.5))
holoModel(2,"torus3")
holoPos(2,O:pos() + vec(0,0,O:height() + 10))
holoPos(1,O:pos() + vec(0,0,O:height() + 10))
holoAng(2,ang(T,T,T))
holoColor(2,vec(255,215,0))
holoScale(2, vec(1.5,1.5,1.5))
holoParent(1,O)
holoParent(2,O)

if(chatClk(owner()) &  owner():lastSaid() == "on") {
holoAlpha(1,220)
}
if(lastSaid()=="hide" & lastSpoke()==owner())
{
holoAlpha(1,0)
}
if(chatClk(owner()) &  owner():lastSaid() == "on") {
holoAlpha(2,220)
}
if(lastSaid()=="hide" & lastSpoke()==owner())
{
holoAlpha(2,0)
}
if(duped()){selfDestructAll()}
if(duped()){selfDestructAll()}
if(duped()){selfDestructAll()}

## invisible ##
entity():setColor(0,0,0,0)
