@name Door
@inputs 
@outputs 
@persist [E E2]:entity
@trigger 

# SOME TESTS?

interval(10)

Yaw = entity():angles():yaw()
findIncludeClass("player")
findInSphere(entity():pos(),250)
if(findResult(1):type() == "player")
{
    TargetPos = entity():right() * -64 + vec(0,0,32)
    TargetPos2 = entity():right() * 64 + vec(0,0,32)
}
else
{
    TargetPos = entity():right() * -24 + vec(0,0,32)
    TargetPos2 = entity():right() * 24 + vec(0,0,32)
}

if(!E)
{
    E = propSpawn("models/props_phx/construct/windows/window1x2.mdl",entity():pos() + TargetPos,0)
    E:setAng(ang(0,90 + Yaw,90))
}
if(!E2)
{
    E2 = propSpawn("models/props_phx/construct/windows/window1x2.mdl",entity():pos() + TargetPos2,0)
    E2:setAng(ang(0,90 + Yaw,90))
}

E:setAng(ang(0,90 + Yaw,90))
E2:setAng(ang(0,90 + Yaw,90))

E2:applyForce(((entity():pos() + TargetPos2 - E2:pos()) * 10 - E2:vel()) * E2:mass())
E:applyForce(((entity():pos() + TargetPos - E:pos()) * 10 - E:vel()) * E:mass())
