@name Bone Recorder
@inputs 
@outputs Ragdoll:table B:array P:entity
@persist 
@trigger 

O=owner()
findInSphere(O:pos(),200)
findIncludeClass("ragdoll")
P=find()
B=P:bones()

#[
if(first()){
    for(C=1,P:boneCount()){
        Ragdoll[C,array]=array()
    }
}
]#

interval(100)
for(C=1,P:boneCount()){
    Bone=B[C,bone]
    #Boney=Ragdoll[C,table]
    #Boney[1,vector]=Bone:toLocal(O:pos())
    #Boney[2,angle]=Bone:toLocal(O:pos())
    Ragdoll["Bone"+C,array]:pushVector(round(Bone:toLocal(O:pos())))
    #Ragdoll[C,table]=Boney
}

timer("write",2000)
if(clk("write")){
    fileWrite("runanim.txt",glonEncode(Ragdoll))
}
