# Changing minigame for Cigarette packaging

## Overview

* By default we use our own minigame for the cigarette packagging, but we understand that you might like to change to use different ones.

## Location

Path: `rcore_prison/modules\base\client\api\cl-minigames.lua`

## Guide

1. You just need to remove the StartCigarProduction function.
2. Use minigame exports which you want to integrate
3. On the success callback you need to set this event

```lua
TriggerServerEvent('rcore_prison:server:requestCigarProductionReward', zoneId)
```

4. Done, now your minigame should be used for cigar production!

* By default state:

```lua
--- Function to start a minigame inside Prison for specific interaction place/task.
--- @param zoneId number Unique zone identifier
--- @param place string  Place type to start minigame for
function StartMinigame(zoneId, place)
    dbg.debug('Starting minigame for zoneId (%s) as place type: (%s)\nFunction path: modules/base/client/api/cl-minigames.lua', zoneId, place)

    if place == MINIGAME_PLACE_TYPE.CIGAR then
        StartCigarProduction(
            Config.Minigame.Steps or 5,
            Config.Minigame.TimeAcc or 0.3,
            Config.Minigame.AnimDict, 
            Config.Minigame.AnimName, 
            function() 
                PlaySoundFrontend(-1, "PICKUP_WEAPON_BALL", "HUD_FRONTEND_WEAPONS_PICKUPS_SOUNDSET", 0)
                TriggerServerEvent('rcore_prison:server:requestCigarProductionReward', zoneId)
                dbg.debug('RCore Minigame success!')
            end, 
            function() 
                dbg.debug('RCore Minigame failed!')
            end
        )
    end
end
```

* PS UI Example:

```lua
--- Function to start a minigame inside Prison for specific interaction place/task.
--- @param zoneId number Unique zone identifier
--- @param place string  Place type to start minigame for
function StartMinigame(zoneId, place)
    dbg.debug('Starting minigame for zoneId (%s) as place type: (%s)\nFunction path: modules/base/client/api/cl-minigames.lua', zoneId, place)

    if place == MINIGAME_PLACE_TYPE.CIGAR then
      exports['ps-ui']:Circle(function(success)
         if success then
            TriggerServerEvent('rcore_prison:server:requestCigarProductionReward', zoneId)
         else
            print("fail")
         end
      end, 2, 20) -- NumberOfCircles, MS
    end
end
```
