@name anim/projects/zoid_cmdwolf/init
@inputs
@outputs
@persist Base:entity
@trigger none
@model models/maxofs2d/cube_tool.mdl

#----------------------
#-- Setup
if (first()) {
    #include "anim/libraries/holocore"
    #include "anim/libraries/animate"
    
    ID = "ANIM_CommandWolf_V1"
    
    Chip = entity()
    ScaleFactor = 1
    ToggleColMat = 1
    ToggleShading = 1
} 


#----------------------
#-- Load the hologram and clip data arrays.
elseif (CoreStatus == "InitSpawn") {
    loadContraption()
} 


#----------------------
#-- This is like if (first()) { }, code here is run only once.
elseif (CoreStatus == "InitPostSpawn") {
    CoreStatus = "RunThisCode"  
    
    Base = holoEntity(999)
        #holoUnparent(999)


    addFootController("fr",Base,vec(30,-18,0),0,6,25,15)
    addFootController("fl",Base,vec(30,18,0),45,6,25,15)
    addFootController("rr",Base,vec(-43,-18,0),180,6,30,15)
    addFootController("rl",Base,vec(-43,18,0),225,6,30,15)
    
    addIKinematics("fr","Humanoid.Basic",array(holoEntity(1),10,11,12))
    addIKinematics("fl","Humanoid.Basic",array(holoEntity(1),14,15,16))
    addIKinematics("rr","Humanoid.Digitigrade",array(holoEntity(2),18,19,20,21))
    addIKinematics("rl","Humanoid.Digitigrade",array(holoEntity(2),23,24,25,26))

    
    interval(500)
    runOnTick(0)
    runOnLast(1)
} 


#----------------------
#-- This is where executing code goes
elseif (CoreStatus == "RunThisCode") {
    interval(90)
    
    
    #local RD = rangerOffset(DestHeight*2,Base:pos(),WorldDownVec):position() + vec(0,0,DestHeight+5+abs(cos(FrameTime/2)*FootControllers["fl", table]["stepH", number]))
    #holoPos(10, RD) #Base:toWorld(vec(15, 0, abs(cos(FrameTime/2)*FootControllers["fl", table]["stepH", number]))))
    #holoAng(10, Base:toWorld(ang(5+sin(-FrameTime)*FootControllers["fl", table]["stepH", number], 0, -Base:toLocalAxis(MoveDir*Speed):y())))
    
    holoPos(1, Base:toWorld(vec(0, 0, abs(cos(FrameTime/2)*FootControllers["fl",table]["stepH",number]))))
    holoAng(1, Base:toWorld(ang(sin(-FrameTime)*FootControllers["fl",table]["stepH",number], 0, 0)))

    #holoPos(1, Base:toWorld(vec(0, 0, abs(cos(FrameTime/2)*FootControllers["fl",table]["stepH",number]))))
    holoAng(2, Base:toWorld(ang(sin(FrameTime)*FootControllers["fl",table]["stepH",number], 0, 0)))

    
    updateFootControllers( 15, 0 )
    
}

