simtr/The-Powder-Toy — pull request #208 by boxmein (2014-02-22 13:18:46+00:00)
Title: Keyboard Sensor Element

KSNS is an element that detects key presses and allows users to create complex electronics that depend on key inputs. It'll facilitate game saves and all sorts of creations.

## How KSNS works

KSNS has two 'modes': simple and advanced.

In simple mode (tmp = 0), KSNS sparks a wire according to a cardinal direction, only responding to arrow keys. If you, for example, press the down arrow key, then KSNS sparks any type of wire leading downward from the particle (see image). Simple mode also works with more than one arrow key held down simultaneously.

![Directional wires](http://puu.sh/75WZp.png)

In advanced mode (tmp = 1), KSNS will check if its `tmp` value equals its `life` value (the life value is set via key events to the currently effective key code, providing a nice way to debug the element), and if it does, sparks a regular wire particle around it.

![Advanced mode](http://i.imgur.com/QIuRNOy.png)

## Supa useful pls ad