# LethalControls

See which button does what, per situation, and share your keybinds.

- **Controller layout page**: a pad diagram with a label on every button, for the situations you pick: on foot, driving
  the Cruiser, spectating, ship build mode, terminal, emotes, plus every InputUtils mod's own map. Buttons with two or
  more actions in the same situation are shown **in red**; overlaps that only *might* clash are **amber**. There is
  also a keyboard & mouse list.
- **Binds import / export**: save all your binds (vanilla and every InputUtils mod) to a file, or copy them as a short
  share code you can paste into Discord. Importing shows a preview first and always makes a backup.
- **Stick aim tuning** (new in 0.2.0): the right stick turns the camera at the same speed at any frame rate (vanilla
  turns faster the higher your fps), plus deadzone, response curve, separate horizontal/vertical pad sensitivity and
  optional turn acceleration. The mouse is never changed.
- **Terminal favorites** (new in 0.2.0): hold **Y** at the terminal for a radial of your favorite commands and
  signal-translator messages; with ClickableTerminal they also appear on its MODS page.

Client-side only. Nobody else in the lobby needs it.

## How to open it

| Where | What |
|---|---|
| Settings > Change keybinds (the InputUtils menu) | Two buttons to the right of the list: **> Controller layout** and **> Import / Export** |
| **F5** (in a lobby or in the main menu) | Controller layout. Rebind it, or bind it to a pad button, in the InputUtils menu under "LethalControls". |
| "Open binds import/export" hotkey | Unbound by default; bind it in the InputUtils menu. |

In a lobby the page pauses your character like the pause menu does, and while it is open it also pauses the vehicle
controls and other mods' hotkeys, so steering through the page in the driver's seat doesn't drive the car. Close the
page with **Close**, **B / Circle** or **Escape / Start**.

F5 was picked because F1, F2, F3, F6, F8 and F11 are Imperium's, F1/F2 can be GeneralImprovements' emote keys and F7 is
UnityExplorer's.

## Controller layout page

- **Auto** ticks the situation you are in right now: dead, terminal, build mode, driving, or on foot.
- Each situation has its own label colour (the checkbox labels double as the legend).
- With BetterVehicleControls installed, the Cruiser page shows its Gas, Brake, Turbo and other binds instead of vanilla
  Jump = Turbo, and vanilla Move only steers (BVC drives with its own Drive Forward / Backward and pedals).
- Binds of two different vehicle mods (BetterVehicleControls, Company Hauler, ScanVan...) on the same button are not
  a conflict: you only drive one vehicle at a time.
- **Amber "?"** marks a possible conflict with a mod map that isn't sorted into a situation (see below). Many such binds
  only work while you hold that mod's item, so they may not clash at all.
- Icons come from InputUtils, so Davesco-CorrectControllerIcon's Xbox / PlayStation choice is respected. The picture
  switches between an Xbox-style and a DualSense-style pad to match.
- Some inputs are hard-wired by the game and marked "(fixed)": rotate in build mode is L-shoulder on a pad, and
  Esc / Tab / Start leaves the terminal.

### Telling it about a mod (optional)

`BepInEx/config/LethalControls.contexts.json` is created on first use. Mod maps are sorted into situations by name
(Vehicle, Hauler and Van go to the Cruiser; Emote to Emotes; Terminal to Terminal). Everything else counts as on foot by
guess, and its overlaps are shown in amber. To sort a map (which turns its amber overlaps red or clears them), add
entries like these:

```json
{
  "uk.1a3.bettervehiclecontrols.VehicleControls": ["Cruiser"],
  "vanilla/Jump": ["OnFoot"],
  "$allowOverlap": [["uk.1a3.bettervehiclecontrols.VehicleControls/TurboKey",
                     "uk.1a3.bettervehiclecontrols.VehicleControls/JumpKey"]]
}
```

`$allowOverlap` stops a pair you share on purpose from being shown in red. Situations: `OnFoot`, `Cruiser`, `Spectating`,
`BuildMode`, `Terminal`, `Emotes`. An empty list hides a map or action.

## Import / export

- **Export** covers vanilla binds plus every InputUtils mod. By default only the binds you changed are exported. Filters:
  controller and/or keyboard & mouse, a single situation, and which mods.
  - **Save to file** writes `BepInEx/config/LethalControls/exports/binds-<date>.json`.
  - **Copy share code** puts a code that starts with `LCB1:` on the clipboard.
- **Import** from a saved file or a pasted code. The preview shows what changes, mods you don't have (skipped) and
  binds that no longer exist.
  - **Merge** (the default) only changes the binds in the file. **Replace** also resets your other changed binds of
    those mods, for the devices the file covers. A file saved for one situation (e.g. Cruiser) only resets binds of
    that situation.
  - **Global** (the default) saves where InputUtils keeps binds for all profiles. **Local** saves only into this
    profile. With InputUtils' default priority (GlobalThenLocal), Global binds win over Local ones, and the preview
    warns about it.
  - A backup of your current binds is written to `exports/backups/` before anything changes. To undo, import the backup
    with Replace into the same Global/Local choice you imported into. The `backup-<date>-files` folder next to it holds
    exact copies of the binding files (Global, Local and the game's own), if you ever need to put them back by hand.
- Import and export are disabled while the InputUtils keybind menu is open: that menu shows one of its Global/Local tabs
  at a time instead of your real binds, and it would overwrite an import when it saves. Close it, then press **F5** (in
  a lobby or the main menu) and choose **Import / Export**.
- Import also waits until you have confirmed or discarded any pending changes in Settings.

The files are plain JSON (format `lc-binds` v1). Binds are matched by action name, not by internal IDs, so a file keeps
working across game and mod updates.

## Stick aim tuning

Vanilla moves the camera by a fixed amount **per frame** while you hold the right stick. At look sensitivity 10 and full
tilt that is 168 deg/s at 30 fps, 336 at 60 and 806 at 144: the pad gets twitchier the better your PC runs.

With `FrameRateIndependent` (on by default) the stick turns at the 60 fps speed at any frame rate (336 deg/s at
sensitivity 10, one full turn in about 1.07 s). **At 60 fps nothing changes**; above 60 fps the pad is slower than
vanilla was. Every other setting starts at the vanilla value, so out of the box this is the only difference.

All settings are in `BepInEx/config/dev.davesco.LethalControls.cfg` under `[Aim]` (LethalConfig shows them as sliders)
and apply immediately:

| Setting | Default | What it does |
|---|---|---|
| `Enabled` | true | Off = vanilla pad look |
| `PatchLookInput` | true | Off = the mod doesn't touch look at all (restart) |
| `FrameRateIndependent` | true | Same turn speed at any frame rate (see above) |
| `SensX`, `SensY` | 1.0 | Horizontal / vertical pad speed. Pad only: your in-game look sensitivity still sets the mouse. |
| `InnerDeadzone`, `OuterDeadzone` | 0.125, 0.925 | Below the inner value the stick does nothing; at the outer value it counts as full tilt. Lower the inner one for finer small movements, raise it if the camera drifts. |
| `DeadzoneShape` | Radial | Radial (vanilla) or Axial (easier pure horizontal turns) |
| `Curve`, `CurveExponent`, `CurveKnee` | Linear, 1.0, 0.5 | Power: small tilts are slower for precise aim. DualZone: power curve up to the knee, then straight up to full speed. |
| `AccelEnabled`, `AccelThreshold`, `AccelDelay`, `AccelRamp`, `AccelMaxBoost`, `AccelYawOnly` | false, 0.9, 0.15 s, 0.4 s, 1.0, true | Hold the stick at the edge and the turn speeds up (up to 2x with boost 1) |
| `VehicleMult`, `LadderMult`, `SpectateMult` | 1.0 | Extra pad multipliers in a vehicle seat, on a ladder, and while dead |

**Share it:** binds exports and share codes include your `[Aim]` settings (the "Include the stick aim profile"
checkbox, default from `[Export] IncludeAim`). On import the preview shows "Aim profile: N settings change" and lets
you keep yours. LethalControls 0.1.0 can still import such files; it just ignores the aim part.

**Steam Input:** if Steam Input is on for your pad, Steam applies its own deadzone first. Turn Steam Input off for this
game, or set Steam's deadzone to the minimum, and do the tuning here.

Works together with DualSenseHaptics' gyro aim: both add to the same look input, so the stick and the gyro move the
camera at the same time. If another mod replaced the game code this hooks into, stick aim tuning switches itself off
(vanilla look) and says so in the log.

## Terminal favorites

For controller players at the ship's terminal, alongside Davesco-ClickableTerminal (which covers the menus):

- **Radial:** at the terminal, **hold Y / Triangle** for 0.3 s. A ring of up to 8 entries opens: your favorites first,
  then your transmit presets. Point at one with the **right stick** or the **d-pad** and **release Y** to run it.
  **B** closes the ring without running anything. (ClickableTerminal may move its own highlight while you point, but it
  does not run anything.)
- **Transmit presets** send a message to everyone's signal translator, which ClickableTerminal's TRANSMIT window can
  only do by typing. They are greyed out while the translator is busy (8 s between messages) or missing. The game only
  sends **9 characters**, in lower case, so presets are limited to 9 letters, digits and spaces.
- **ClickableTerminal MODS page:** every favorite and preset is also listed there.
- **Never auto-confirms:** a `buy` or `route` favorite only opens the game's CONFIRM screen; you confirm through
  ClickableTerminal as usual. While a CONFIRM / DENY screen is up, the radial refuses to run anything (the game would
  take almost any word as an answer there).
- The radial also refuses, with a short message, while a ClickableTerminal window (TRANSMIT, a code entry...) or an
  InteractiveTerminalAPI app (e.g. the Lategame Upgrades store) is open.
- Commands run exactly as if typed, so other terminal mods see them normally.

Settings, under `[Terminal]`:

| Setting | Default | |
|---|---|---|
| `Enabled` | true | |
| `Favorites` | `view monitor\|scan\|switch` | Commands separated by `\|`, typed exactly as on the terminal, at most 5 words each. `buy` quantities above the game's limit (10, or GeneralImprovements' dropship limit) are lowered to it. |
| `TransmitPresets` | `GO BACK\|HURRY\|DANGER\|LOOT SHIP` | Up to 9 letters, digits and spaces each |
| `RegisterInClickableTerminal` | true | Add them to ClickableTerminal's MODS page |
| `Radial`, `RadialHoldSeconds`, `RadialButton` | true, 0.3, North | `RadialButton` can be a stick press instead of Y |
| `PatchTerminal` | true | Off = no ClickableTerminal entries (restart); the radial still works |

Entries removed from `Favorites` stay on ClickableTerminal's MODS page until you restart the game (its list only grows).

## Known limitations

- Rebinding happens in the InputUtils menu. This mod only shows and transfers binds.
- The empty controller slots of vanilla push-to-talk and the two emotes can't be imported: InputUtils, which manages
  vanilla binds, finds a bind by its default button, and these have none. The preview lists them as "can't be set".
- No keyboard diagram, only a list.
- If a game window loses clipboard access (rare under Proton), use the file export instead.
- Stick aim tuning only shapes the right stick; there is no flick stick yet.
- The terminal radial is for controllers. Keyboard players have ClickableTerminal's menus.

## Dependencies

- `BepInEx-BepInExPack-5.4.2100`
- `Rune580-LethalCompany_InputUtils-0.7.14`

## Magyarul

**Kontroller-kiosztás és billentyűkiosztás export/import.**

- **Kontroller-kiosztás oldal**: egy pad rajzán minden gombhoz felirat jelzi, mit csinál az éppen kiválasztott
  helyzetben (gyalog, Cruiserben vezetve, nézőként, hajóépítő módban, terminálnál, emote-oknál, valamint minden
  InputUtils mod saját kiosztása). Ha egy gombon ugyanabban a helyzetben két művelet van, **pirossal** jelzi; a csak
  *lehetséges* ütközés (egy helyzetbe nem sorolt mod kiosztása) **sárga** „?” jelet kap. Két különböző jármű-mod
  ugyanazon a gombon nem ütközés, mert egyszerre csak egy járművet vezetsz. Az **Auto** pipa magától kiválasztja, épp
  mit csinálsz. Billentyűzet és egér lista is van.
- **Export / import**: az összes kiosztást (alapjáték és minden InputUtils mod) fájlba mented, vagy egy `LCB1:` kezdetű
  kódként a vágólapra másolod, és Discordon megosztod. Importálás előtt előnézet jelenik meg, és mindig készül biztonsági
  mentés (`exports/backups/`).
- **Megnyitás**: Beállítások > Billentyűk (InputUtils menü), a lista jobb oldalán két gomb. Vagy **F5** (az InputUtils
  menüben átállítható). Bezárás: Close gomb, B / Kör, Esc / Start. Amíg az oldal nyitva van, a karaktered, a jármű
  irányítása és a többi mod gyorsbillentyűi szünetelnek, így vezetés közben sem indul el az autó.
- **Merge** csak a fájlban szereplő kiosztásokat írja át; **Replace** a többi módosítást is visszaállítja (egy adott
  helyzetre, pl. Cruiserre mentett fájl csak annak a helyzetnek a kiosztásait). **Global** = minden profilra érvényes,
  **Local** = csak erre a profilra. A biztonsági mentés mellett a `-files` mappában a kiosztásfájlok pontos másolata is
  ott van.
- Amíg az InputUtils kiosztás menüje nyitva van, az import és az export le van tiltva (a menü egyszerre csak a Global
  vagy a Local fület mutatja, és mentéskor felülírná az importot). Zárd be, majd nyomd meg az **F5**-öt, és válaszd az
  Import / Export gombot. Ha a Beállításokban jóváhagyatlan változás van, előbb azt hagyd jóvá vagy vesd el.
- Az alapjáték üres kontroller-helyeit (push-to-talk, a két emote) nem lehet importálni: az InputUtils az alapgomb
  alapján keresi a kiosztást, ezeknek pedig nincs ilyen.
- **Botkormány-célzás (0.2.0):** a játék a jobb bottal képkockánként fix szöget fordít, ezért minél több az FPS, annál
  gyorsabban fordul a kamera (10-es érzékenységnél 30 / 60 / 144 FPS mellett 168 / 336 / 806 fok/s). A
  `FrameRateIndependent` (alapból bekapcsolva) bármilyen FPS-nél a 60 FPS-es sebességet adja; **60 FPS-nél semmi nem
  változik**. A `[Aim]` részben állítható még a holtjáték (`InnerDeadzone` / `OuterDeadzone`, az alapjátékénál kisebb
  is), a görbe (`Curve`: Linear, Power, DualZone), a vízszintes és függőleges pad-érzékenység (`SensX` / `SensY`, az
  egérre nincs hatással), a gyorsítás (`Accel...`) és a jármű / létra / néző szorzó. Minden azonnal életbe lép. Az
  export és a megosztó kód a célzási beállításokat is viheti; importkor eldöntheted, átveszed-e. Steam Input mellett a
  Steam saját holtjátéka is hat: kapcsold ki a Steam Inputot, vagy állítsd a Steam holtjátékát minimumra. A
  DualSenseHaptics giroszkópos célzásával együtt működik.
- **Terminál-kedvencek (0.2.0):** a terminálnál **tartsd nyomva az Y / Háromszög** gombot: megnyílik egy kör legfeljebb
  8 kedvenc paranccsal és rádióüzenettel. A jobb bottal vagy a d-paddal válassz, majd **engedd el az Y-t**; a **B**
  bezárja a kört. A rádióüzenet (transmit) legfeljebb 9 karakter (betű, szám, szóköz), mert a játék csak ennyit küld,
  és 8 másodpercig szürke, amíg a jeladó foglalt. Vásárlást sosem hagy jóvá: a CONFIRM képernyőt neked kell
  megerősítened, és amíg az látszik, a kör nem futtat semmit. ClickableTerminal mellett minden kedvenc a MODS oldalán is
  megjelenik. Beállítás: `[Terminal] Favorites` és `TransmitPresets`, `|` jellel elválasztva.
- Csak kliens oldali, a többi játékosnak nem kell telepítenie.
