@name IHouse FDoor
@inputs [D1 D2 D3 D4]:entity 
@outputs 
@persist A State 
@trigger 
interval(15)

R = owner():keyWalk()

if (changed(R) & R) {if(State == 0) {State = 1} else {State = 0}}

if(State == 1) {
    if(A < 490) {
        A += 5
        D1:setPos(D1:pos() - vec(0,0,1))
    }
} else {
    if(A > 0) {
        A -= 5
        D1:setPos(D1:pos() + vec(0,0,1))
    }
}

if(State == 1) {
    if (A > 122.5) {
        A += 5
        D2:setPos(D2:pos() - vec(0,0,1))
    }
}  else {
    if(A < 122.5) {
        A -= 5
        D2:setPos(D2:pos() + vec(0,0,1))
    }
}
