@name BlankSpace AutoDoor
@persist [Door Using]:entity
@outputs A
#include "lib/gang/func"
interval(100)
if (first()) {
    local That=entity():isWeldedTo()
    if (1 | That:wirelink():hasInput("Fade")) {
        print("[DOOR] Spawned on a fading door, auto-wiring")
        That:createWire(entity(),"Fade","A")
        Door=That
    } else {
        print("[DOOR] 404 Error: Door not Found")
        selfDestruct()
    }
}
findByClass("player")
local Player=findClosest(Door:pos())
if (!Using & Player:keyUse() & Player:aimEntity()==Door & inGang(Player)) {
    Using=Player
}
if (Using & !Using:keyUse()) {
    Using=noentity()
}
if (Using) {A=1} else {A=0}
