> ## Documentation Index
> Fetch the complete documentation index at: https://luau.limerence.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# Phantom Forces

> Phantom Forces api.game: match state, rounds, dropped weapons, and live grenades.

**Phantom Forces only.** Match state, rounds, dropped weapons, and live grenades. Every getter returns the current value the moment you call it.

## Getters

| Call                  | Returns                         | What it tells you                                         |
| --------------------- | ------------------------------- | --------------------------------------------------------- |
| `isInGame()`          | `boolean`                       | Whether you're in a match (deployed lobby counts as out). |
| `getGamemode()`       | `string?`                       | The current game mode, or `nil` when unknown.             |
| `getDroppedWeapons()` | `{ { name, position, model } }` | Every weapon lying on the ground.                         |
| `getGrenades()`       | `{ grenade }`                   | Live grenades in flight or cooking. See below.            |

Each `grenade`: `{ name, position, detonateAt, blastRadius, friendly, mine }`. `position` is the predicted landing spot, `detonateAt` compares against `os.clock()`, `mine` is `true` for your own throws.

## Signals

Call `:Connect(callback)` on these. They get cleaned up when your script unloads.

| Signal           | Your callback receives         |
| ---------------- | ------------------------------ |
| `onMatchChanged` | `()`: the map or mode changed. |
| `onRoundStarted` | `()`: a round started.         |
| `onRoundEnded`   | `()`: a round ended.           |

## Example

```luau theme={null}
-- List enemy grenades in the air
for _, grenade in api.game.getGrenades() do
    if not grenade.friendly then
        print(grenade.name, "lands at", grenade.position, "in", grenade.detonateAt - os.clock())
    end
end

-- Toast every new round
api.game.onRoundStarted:Connect(function()
    api.ui.toast("Round started")
end)
```
