# nova\_bridge

NOVA Framework compatibility bridge. Allows scripts written for ESX, QBCore, vRPex, or Creative frameworks to work with NOVA without any code changes.

## Features

* **ESX Compatibility** — Provides `es_extended` resource
* **QBCore Compatibility** — Provides `qb-core` resource
* **vRPex Compatibility** — Provides `vrp` resource
* **Creative Compatibility** — Provides Creative framework functions
* **Single Mode** — One compatibility mode active at a time

## Configuration

Edit `config.lua`:

```lua
BridgeConfig = {
    Mode = 'esx',    -- 'esx', 'qbcore', 'vrpex', 'creative', 'none'
}
```

### Available Modes

| Mode       | Description                         | Provides Resource |
| ---------- | ----------------------------------- | ----------------- |
| `esx`      | ESX Legacy compatibility            | `es_extended`     |
| `qbcore`   | QBCore compatibility                | `qb-core`         |
| `vrpex`    | vRPex compatibility                 | `vrp`             |
| `creative` | Creative Network compatibility      | —                 |
| `none`     | No compatibility (NOVA-native only) | —                 |

## How It Works

The bridge intercepts calls to the target framework's API and translates them to NOVA equivalents:

**Example with ESX mode:**

```lua
-- A script written for ESX does this:
local ESX = exports['es_extended']:getSharedObject()
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.addMoney(500)

-- The bridge translates it to:
-- exports['nova_core']:GetPlayer(source)
-- exports['nova_core']:AddPlayerMoney(source, 'cash', 500)
```

### Mapped Functions

The bridge maps common framework functions including:

* Player data retrieval
* Money operations (add, remove, get)
* Job management
* Inventory operations
* Notification triggers
* Callbacks

## Usage

1. Set `BridgeConfig.Mode` to match the scripts you want to use
2. Ensure `nova_bridge` loads after `nova_core`
3. Start your ESX/QBCore/vRPex scripts as normal — they'll use NOVA through the bridge

```
# server.cfg
ensure nova_core
ensure nova_bridge

# ESX scripts work without changes
ensure esx_skin
ensure esx_policejob
```

## Dependencies

* **nova\_core** — Core framework (source of all player data)

## Notes

* Only one mode can be active at a time
* Not all edge-case functions may be mapped; test your scripts
* Native NOVA scripts do not need the bridge
* The bridge adds minimal overhead since it's just function mapping
* If you're writing new scripts, use NOVA's native API for best performance
