@name new Mech robot
@inputs 
@outputs 
@persist [E R L]:entity
@trigger 
@model models/hunter/blocks/cube05x05x05.mdl

interval(1)
if(first()) {
    E = entity()
    L = propSpawn("models/hunter/plates/plate025x05.mdl",E:pos()-E:right()*50,0)
    R = propSpawn("models/hunter/plates/plate025x05.mdl",E:pos()+E:right()*50,0)
    E:propFreeze(0)
    L:setMass(25)
    R:setMass(25)
    holoCreate(1)
    holoPos(1,E:pos()+E:forward()*10)
    holoParent(1,E)
}

E:applyForce(((vec(-E:pos():x()+((L:pos():x()+R:pos():x())/2),-E:pos():y()+((L:pos():y()+R:pos():y())/2),60-E:pos():z()+((L:pos():z()+R:pos():z())/2)))-E:vel()/2)*20)
E:applyAngForce((ang(-E:angles():pitch(),0,-E:angles():roll())-E:angVel()/10)*100)
R:applyAngForce(angnorm(-R:angles()+E:angles()+ang(0,90,0)-R:angVel()/2)*20)
L:applyAngForce(angnorm(-L:angles()+E:angles()+ang(0,90,0)-L:angVel()/2)*20)
R:applyForce(((E:pos()+E:right()*10-vec(0,0,50))-R:pos()-R:vel()/10)*50)
L:applyForce(((E:pos()-E:right()*10-vec(0,0,50))-L:pos()-L:vel()/10)*50)
