# searph

BedWars kit: strategy engine + game remote wiring. Everything runs through the game's own remotes and controllers — no fabricated hits, no fake damage packets. Server sees normal gameplay inputs.

## Files

| file | what it is |
|---|---|
| `bedwars.lua` | main module: Vape-style GUI toggles, `Store` (shared match state), exports `slopBedwars = { Store = Store, deps = ... }` onto `getgenv()` |
| `strategy.lua` | policy engine (`Actor`): Snapshot → Evaluate → Decide → Hands (Move/Attack/Break/Bridge/Buy/Upgrade). Auto-installs onto `getgenv().slopBedwars.Store` when loaded |
| `kit-reference.md` | **ground truth**: exact remote names, shop items, prices, kit metadata, tag/attribute names. Read it before touching shop/bed code |
| `dumps/`, `tools/`, `dump.js`, `mcp-call.js` | live-server dumps + MCP bridge helpers used to capture `kit-reference.md` |
| `check.sh` | syntax gate — run before every push |

## Load order (executor)

```lua
-- 1. boot cat vape cracked first (loader/gui host), then:
loadstring(readfile("searph/bedwars.lua"))()
loadstring(readfile("searph/strategy.lua"))()
```

`strategy.lua` tail auto-installs: it reads `getgenv().slopBedwars` (or `getgenv().searph.bedwars`) and calls `Actor.Install(Store, deps)`. Installed actor is reachable at `getgenv().searphActor` — `:Pause()` / `:Resume()` / `:Status()`.

`Store.MatchState`: `1` = live match, `0` = lobby/match over. Strategy modules gate on it (line 134: `if state ~= 1 then return end`).

## Syntax gate (do this every time)

```bash
./check.sh
```

Uses real `luau-compile` (Luau, https://luau.org) in `--only-parse` mode — plain lua/luajit can't parse Luau (string interpolation backticks, `+=`, `--!nocheck`). Gate fails on: parse errors, js syntax errors, or any secret-like string (`glpat-`, `cfut_`) in tracked files. Tokens live outside the repo in `.secrets/` and never get committed.

Binary: https://github.com/luau-lang/luau/releases → `luau-macos.zip` → keep at `../.tools/luau-bin/`.

## Tunables

Strategy config lives in `strategy.lua` → `Actor.Config` (Interval, RepathCooldown, shop prices, buy/upgrade order). Module-level toggles are created in `bedwars.lua` via `CreateToggle` under the searph GUI category. Kit metadata (wizard staff damage tiers, mage rules) is in `kit-reference.md` — that file wins over code comments if they disagree.
