> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-advanced-gang/frameworks/rsg.md).

# RSG Core

How CAS Advanced Gang System uses RSG Core: cash, valbank or bloodmoney, rsg-inventory items, guns kept with serial and condition, food spoilage and notices.

**Uses:** `rsg-core`, `rsg-inventory` and `ox_lib`

## Money

```lua
Config.RsgMoneyType = 'cash'   -- 'cash', 'valbank' or 'bloodmoney'
```

## Items

Stash items go through RSG's player functions. Every `name` in `Config.StashItems` must exist in RSG's shared items.

## Guns

An RSG gun is a unique item whose `info` holds its serial (`serie`), condition (`quality`) and loaded rounds. The stash keeps that `info` with the gun's row and hands it back unchanged:

* a worn gun comes back worn, so the wagon isn't a free repair,
* guns are listed one by one in the satchel list, never as a stack.

Guns stored as plain items by older versions can still be taken out.

## Food spoils

RSG items with a `decay` value lose freshness (`info.quality`) over time, and keep losing it in the wagon:

```lua
Config.StashDecayRate = 1.0   -- 1 = as in a satchel, 0.3 = a cool cellar, 0 = never
```

* Each stack keeps one freshness. A fresh deposit onto an older stack averages the two.
* Items come out with the freshness they have left.
* A stack of an item RSG deletes at zero is thrown out when it gets there, even if nobody opens the wagon, and the ledger notes it.

The two stash columns this needs are added to older databases on start.

## Notices

Shown through `ox_lib`'s notify. If `ox_lib` isn't started, the ledger's own notice is shown instead.
