# KTag Mine Subapp

A Jetpack Compose Android application that acts as a proximity-triggered "mine" for KTag laser tag devices. When an enemy device comes within range, the mine automatically tags it with configurable damage.

## How It Works

The Mine scans for nearby KTag devices broadcasting Status packets via BLE. When a device matching the target team enters the configured RSSI threshold, the mine:

1. Triggers a "BOOM!" explosion animation with haptic feedback
2. Broadcasts a Tag packet to damage the target device
3. Enters a rearm countdown period
4. Returns to armed state, ready to tag again

## State Machine

The mine operates using a three-state machine:

| State | Description | Display |
|-------|-------------|---------|
| **Armed** | Ready to tag incoming devices | "ARMED" watermark |
| **Tagging** | Explosion animation playing | BOOM! animation |
| **Rearming** | Countdown before re-arming | Countdown number |

## Settings

Access settings via the gear icon in the app bar.

| Setting | Description | Default |
|---------|-------------|---------|
| **Minimum RSSI** | Signal strength threshold for triggering (-120 = far, 0 = close) | -60 dBm |
| **Damage Applied** | Amount of damage dealt to tagged devices | 100 |
| **Target Team** | Which team(s) to target (Red, Blue, or All) | All |
| **Time to Rearm** | Seconds before mine can tag again after detonation | 5 seconds |

## UI Elements

- **Status Bar**: Shows current target team, damage, and RSSI threshold
- **Device List**: Displays detected KTag devices with:
  - Device name and BLE address
  - Current RSSI signal strength
  - Status: IN RANGE, OUT OF RANGE, TAGGED, or TAGGED OUT
- **Watermark**: Large centered text showing current state (ARMED or countdown)
- **Explosion Animation**: Full-screen animation with expanding rings and "BOOM!" text

## Permissions

- `BLUETOOTH_SCAN` / `BLUETOOTH_CONNECT` - BLE operations
- `ACCESS_COARSE_LOCATION` - Required for BLE scanning on older Android versions
- `VIBRATE` - Haptic feedback on explosion
