# mack-smelter
A placeable smelter for RedM (rsg-core) that allows players to smelt gold nuggets into gold bars and silver ore into silver bars.
## Features
- **Placeable Prop** - Uses `p_campfirecombined01x` as the smelter prop
- **NUI Crafting Menu** - Clipboard-style UI with two tabs: **Gold** and **Silver**
- **Gold Smelting** - Convert small, medium, or large nuggets into gold bars
- **Silver Smelting** - Convert silver ore into silver bars
- **Sell Bars** - Sell gold and silver bars directly at the smelter
- **Gold Claim Restriction** (Optional) - Restrict smelter placement to licensed gold claim areas
- **Persistent Props** - Smelters persist across server restarts via database
- **bln_notify Notifications** - All notifications use the bln_notify system
## Dependencies
- [rsg-core](https://github.com/Starter-RSG/rsg-core)
- [ox_lib](https://github.com/overextended/ox_lib)
- [oxmysql](https://github.com/overextended/oxmysql)
- [rsg-target](https://github.com/Starter-RSG/rsg-target)
- [rsg-inventory](https://github.com/Starter-RSG/rsg-inventory)
- [bln_notify](https://github.com/BLN-Scripts/bln_notify)
- [mack-goldclaim](optional) - Only required if `Config.RequireGoldClaim = true`
## Installation
1. **Database** - Run `mack-smelter.sql` in your database to create the `player_smelter` table
2. **Items** - Add the contents of `installation/shared_items.lua` to your `rsg-core/shared/items.lua` file
- Only add items you don't already have (goldbar, silverbar, nuggets may already exist from other scripts)
- The `smelter` and `silverore` items are likely new
3. **Images** - Copy the images from `installation/images/` to your `rsg-inventory/html/images/` folder
4. **Resource** - Add `mack-smelter` to your `server.cfg`:
```
ensure mack-smelter
```
5. **Give Item** - Give a player the `smelter` item to use. They can then place it in the world.
## Configuration
### Smelting Recipes (Gold Tab)
| Recipe | Input | Amount | Output |
|--------|-------|--------|--------|
| Gold Bar (Small Nuggets) | smallnugget | 45 | 1x goldbar |
| Gold Bar (Medium Nuggets) | mediumnugget | 30 | 1x goldbar |
| Gold Bar (Large Nuggets) | largenugget | 15 | 1x goldbar |
### Smelting Recipes (Silver Tab)
| Recipe | Input | Amount | Output |
|--------|-------|--------|--------|
| Silver Bar | silverore | 15 | 1x silverbar |
### Sell Prices
- Gold Bar: $100 per bar
- Silver Bar: $90 per bar
### Gold Claim Restriction
Set `Config.RequireGoldClaim = true` in `config.lua` to restrict smelter placement to licensed gold claim areas.
> **NOTE:** If `Config.RequireGoldClaim` is set to `true`, the `mack-goldclaim` script must be installed and running. Players will only be able to place smelters within the radius of their own licensed gold claims.
### Key Config Options
```lua
Config.MaxSmelters = 2 -- max smelters per character
Config.SmeltTime = 30000 -- smelting time in ms (30 seconds)
Config.DestroyTime = 10000 -- destroy progress time in ms
Config.GoldBarPrice = 100 -- sell price per gold bar
Config.SilverBarPrice = 90 -- sell price per silver bar
Config.RequireGoldClaim = false -- require gold claim area for placement
```
## Usage
1. Use the `smelter` item from your inventory
2. Place the smelter using the placement system (rotate with controls, confirm to place)
3. Interact with the placed smelter via target:
- **Open Smelter** - Opens the smelting NUI with Gold/Silver tabs
- **Sell All Gold Bars** - Sells all gold bars in your inventory
- **Sell All Silver Bars** - Sells all silver bars in your inventory
- **Destroy Smelter** - Removes the smelter (owner only)
## Credits
- Based on mack-campfire-v2 for UI/crafting/prop placement system
- Gold smelting references from rex-goldrush
- Notifications via bln_notify