# Configuration

## <mark style="color:yellow;">**Available Minigames**</mark>

### Circuit Minigame

**Game ID**: `circuit`

A puzzle-based minigame where players must complete electrical circuits by connecting nodes and paths.

<figure><img src="https://1714064783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6r0GTBPEC7Oy1kbdLspK%2Fuploads%2FN3aCZrPHzSAdMTDg4TiP%2Fcircuit.png?alt=media&#x26;token=a1834018-d953-408d-b342-fb89c7e02ccd" alt=""><figcaption></figcaption></figure>

***

### Enigma Minigame

**Game ID**: `enigma`

A sequence-based decryption challenge where players must decode encrypted patterns within a time limit.

<figure><img src="https://1714064783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6r0GTBPEC7Oy1kbdLspK%2Fuploads%2FkaNgayxEDj27Vcl2viWl%2Fenigma.png?alt=media&#x26;token=4cf97469-11ea-409b-9ad2-8f882c2cbe9f" alt=""><figcaption></figcaption></figure>

***

### Morse Code Minigame

**Game ID**: `morse`

A communication-based challenge where players must decode morse code messages using dots and dashes.

<figure><img src="https://1714064783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6r0GTBPEC7Oy1kbdLspK%2Fuploads%2FGcm8TCMjKeDAEygvbsTR%2Fmorse.png?alt=media&#x26;token=09ab3d5b-12b4-4c74-b6e9-200c85c93946" alt=""><figcaption></figcaption></figure>

***

### Bruteforce Minigame

**Game ID**: `bruteforce`

A password cracking simulation where players must break through security systems using various techniques.

<figure><img src="https://1714064783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6r0GTBPEC7Oy1kbdLspK%2Fuploads%2Fjkj72U4L5LLUvdYQ1vEE%2Fbruteforce.png?alt=media&#x26;token=3caf2708-0e05-4b64-96d0-428104bd1887" alt=""><figcaption></figcaption></figure>

***

### Tuning Minigame

**Game ID**: `tuning`

A frequency-based minigame where players must tune into the correct frequency or signal.

<figure><img src="https://1714064783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6r0GTBPEC7Oy1kbdLspK%2Fuploads%2FSops6pJGDiqhYMtNJsKN%2Fsignal.png?alt=media&#x26;token=5b7e31fc-c02c-4f48-a6c6-fd622337c889" alt=""><figcaption></figcaption></figure>

***

## <mark style="color:yellow;">**Command Configuration**</mark>

```lua
Config.CommandEnabled = true
```

* **Description**: Controls whether the test command for minigames is enabled or disabled.
* **Default**: `true`
* **Usage**: When enabled, allows the use of `/startMinigame` command for testing purposes.

***

## <mark style="color:yellow;">**Command Usage**</mark>

When `Config.CommandEnabled` is set to `true`, you can use the following command:

```
/startMinigame [minigame] [time]
```

**Parameters:**

* **minigame**: The type of minigame to start
  * Available options: `circuit`, `enigma`, `morse`, `bruteforce`, `tuning`
* **time**: Time limit in seconds (default: 60)

**Examples:**

```
/startMinigame circuit 60
/startMinigame enigma 45
/startMinigame morse 30
```

***

## <mark style="color:yellow;">**Export Function**</mark>

```lua
local result = exports['devhub_hackingMinigames']:startMinigame(minigame, time)
```

* **Description**: Programmatically start a minigame from another resource.
* **Parameters**:
  * `minigame` (string): The minigame type to start
  * `time` (number): Time limit in seconds
* **Returns**: Boolean indicating success or failure of the minigame
* **Example Usage**:

```lua
local success = exports['devhub_hackingMinigames']:startMinigame("circuit", 60)
if success then
    print("Player successfully completed the minigame!")
else
    print("Player failed the minigame.")
end
```

***

## <mark style="color:yellow;">**Integration**</mark>

To integrate these minigames into your scripts:

1. **Basic Integration**:

```lua
local result = exports['devhub_hackingMinigames']:startMinigame("circuit", 45)
if result then
    -- Player succeeded
    -- Grant rewards, continue mission, etc.
else
    -- Player failed
    -- Handle failure, retry option, etc.
end
```

2. **Advanced Integration EXAMPLE**:

```lua
-- Before starting a heist hacking sequence
if PlayerHasHackingDevice() then
    local minigameType = GetRandomMinigame() -- Your custom function
    local timeLimit = CalculateTimeLimit() -- Based on player skill, etc.
    
    local success = exports['devhub_hackingMinigames']:startMinigame(minigameType, timeLimit)
    
    if success then
        TriggerEvent('heist:hackingSuccess')
    else
        TriggerEvent('heist:hackingFailed')
    end
end
```

***

## <mark style="color:yellow;">**Sound Configuration**</mark>

<mark style="color:$primary;">**Path: html/config.js**</mark>

```lua
window.config = {
    soundVolume: 0.5,
};
```

* **Description**: Controls the volume level for minigame sound effects.
* **Range**: 0.0 to 1.0 (0% to 100%)
* **Default**: 0.5 (50%)

***
