
An explanation of the game controls

[[_TOC_]]

## Game Controls

### Configurable

| default       | explanation |
|---------------|--------------|
| A             | strafe left |
| D             | strafe right |
| W             | move forward |
| S             | move backward |
| LEFT CTRL     | toggle crouching |
| LEFT SHIFT    | toggle running |
| SPACE         | jump |
| E             | interact with cell/mob under crosshairs |
| TAB           | open/close player's inventory |
| MOUSE RIGHT   | use held item |
| MOUSE LEFT    | break cell/mob under crosshairs |
| MOUSE MIDDLE  | set held item from drop of cell/mob under crosshairs |

### Non-Configurable

| value         | explanation |
|---------------|--------------|
| ESCAPE        | from regular game, enter main menu; otherwise exit current menu |
| 1             | toggle debug panel |
| 2             | toggle wireframe rendering |
| 3             | rebuild triangle meshes |
| 4             | toggle between debug and regular play mode |

## Player movement

The player movement is by default tied to the WASD keys (configurable)
and the mouse motion (not configurable) as with many othe first person games.

When on the ground, if the player moves head-on for four ticks against one cell
that has enough empty space on top, they will perform a jump to get on that
cell.

* if moving against the side of a cell, they must be facing in a direction
  mostly perpendicular to the face.
* if moving against an inner corner, they direction the player is facing is
  looser and it covers the full range between the faces that make up the
  corner.

Pressing space while on the ground will perform a jump.

### Running

Pressing Run (by default Left Shift) toggles running. The player remaings
running until they press Run again *or* toggle crouching.

While running the player moves faster.

While running, the player will climb single cells after just one frame of
pushing agaist them.

While running, the player will automatically perform a small jump after walking
off any surface. This is enough to jump over a two-cell hole, but smaller than
a regular jump.

### Crouching 

Pressing Crouch (by default Left Control) toggles crouching. The player remains
crouched until they press Crouch again *or* toggle running

While crouching, the player moves slower.

While crouching, the time required to start climbing a single cell is doubled.

### Swimming

When the player's feet are inside a cell with 'collision = buoy', they will
swim. They will still run, walk or crouch, but the following additional forces
will apply:

The player will be applied a buoyancy force directly proportional to how much
of them is submerged.

The player will be applied a fluid drag directly proportional to how much of
them is submerged.

From a fluid cell, they can not jump upwards, but they will auto-climb
one-cell-high walls adjacent to the fluid.

## World Edition

The player can place and remove both cells and mobs from the world

### Erasing

Pressing Erase (by default Left Mouse Button) while targeting an existing cell
or mob will remove them from the world.

Mobs will be merely removed; cells replaced with 'none'

### Picking

Pressing Pick (by default Middle Mouse Button) while targeting an existing cell
or mob will replace the current player's hand item with a copy of the drop item
for that particular cell or mob.

### Placing

Pressing Paint (by default Right Mouse Button) while targeting an existing cell
and holding an item with the place or spawn property will attempt to create a
new cell or mob in the targeted space.

For the new object to be created, the last cell before the cursor must be both
an empty cell and contain no mobs.

There's an special case where the target cell is occupied by *only* the player;
in that case the player will attempt to move away from the cell to make space,
and then place the new object. If placing on the floor, the player will jump
up, if placing on a wall, the player will move backwards. If the move can't be
completed (usually because the player collided with something else, but also
because a mob moved into the space as the player was exiting it) the player
will move anyway, but no object will be placed.

## Inventories

Inventory menus are the player's main method of moving items around.

Every inventory menu is split in two sides: the left always contains the
player's current inventory, the right depends on how the inventory was accessed
and might represent different things.

Each inventory slot is either empty or has a picture of the item contained,
with an optional number indicating the amount of items. Hovering the mouse
cursor over an occupied slot shows the item name.

In regular inventories, when you left click on a slot:

* if holding nothing, pick all the items on the slot
* if holding the same thing as the slot, merge your hand on the slot
* if holding something else, swap your hand and the slot

In regular inventories, when you right click on any slot:

* if holding nothing, pick half the items on the slot
* if holding the same thing as the slot, or the slot is empty drop one item on the slot
* if holding something else, swap your hand and the slot.

### Default

Pressing the Inventory key (by default Tab) while not in debug mode opens the
default inventory. The right side will then contain a list of all possible
items that the player can craft without the assistance of a specific bench.

In this inventory, hovering over the items in the right side will show in
addition to the item name a list of the ingredients required to craft them;
clicking on those items will consume the ingredients from the player's
inventory and add the result to it.

### Debug

Pressing the Inventory key (by default Tab) while in debug mode opens the debug
inventory. The right side will then contain a list of all possible items in the
game.

The debug inventory is not exactly an inventory because there's an endless
amount of items in each slot, and they can't be emptied. instead, attempting to
take the full slot will add sixteen items to your hand.

### Container

Pressing the Interact key (by default E) while looking at a container will show
the inventory corresponding to that container on the right side. It behaves the
same as the player's inventory, and items can be freely moved between them.

### Recipes

Pressing the Interact key (by default E) while looking at a workbench will show
the list of recipes corresponding to that bench. The interface works in exactly
the same way as the default inventory menu, just with a different recipe
selection.
