@name Field Gen
@outputs A
@persist [E F]:entity
interval(15)
if(first())
{
    E = entity()
    F = E:isConstrainedTo()
    if(F:type()=="gmod_wire_field_device")
    {
        F:setColor(0,0,0,0)
        F:createWire(E,"Active","A")
        F:propNotSolid(1)
        F:propFreeze(1)
    }else
    {
        print("Spawn on field gen.")
        selfDestruct()
    }
    
    E:setColor(0,0,0,0)
    E:propNotSolid(1)
    
    runOnTick(1)
}

if(changed(owner():keyJump())&owner():keyJump()&owner():keyAttack2())
{
    A = !A
}

F:setPos(owner():boxCenterW())

