Skip to content

Stviri/st-mining

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

st-mining

Mining, gold panning, and stone washing for RedM RSGCore servers.

Cloned from jp-mining by JackP; adapted and extended for ST-Resources.


Dependencies

Resource Purpose
rsg-core Player data, item management
ox_lib Zones, progress bars, notifications
rsg-inventory ItemBox display when items are added/removed

Installation

  1. Copy the st-mining folder into resources/[custom]/.
  2. Add to server.cfg:
    ensure st-mining
    
  3. Add all items listed in shared/items.lua to your rsg-core/shared/items.lua.
  4. Copy the item images from ST-IMAGES into your rsg-inventory/html/images folder.

No database import required — st-mining has no SQL tables.


Required Items

These items must exist in your rsg-core shared items table:

Item useable Notes
pickaxe true Triggers mining
goldpan true Triggers gold panning
stone true, shouldClose = true Dropped by common mines; triggers washing
gold_ore Dropped by gold mines
goldflakes Reward from gold panning
iron_ore Washing reward
copper_ore Washing reward
silver_ore Washing / rare mine reward
coal Washing / rare mine reward

How It Works

Mining

  1. Player enters a mine zone (sphere centred on the mine's blip coordinate).
  2. Player uses the pickaxe item from their inventory.
  3. A 10-second pickaxe animation plays.
  4. The server rolls against the mine-type chance and awards items:
    • commonstone (stamped with the mine's ID as metadata)
    • goldgold_ore
    • rare → random item from Config.RareItems
  5. If Config.PickaxeBreak = true, there is a Config.BreakChance% chance the pickaxe is destroyed.

Gold Panning

  1. Player stands in water (any river/stream).
  2. Player uses the goldpan item.
  3. A 5-second progress bar runs.
  4. Success chance is Config.GoldFlakeChance% normally, or Config.HotspotChance% inside a hotspot river zone.
  5. On success the player receives goldflakes (1–3 outside a hotspot, 2–8 inside).

Stone Washing

  1. Player collects stone from a common mine (stone is stamped with the mine's ID).
  2. Player stands in water and uses the stone item.
  3. A 5-second progress bar runs.
  4. The stone is consumed and the player receives one ore item.
  5. Which ore is determined by the mine-specific weighted loot table (washingDrops) on the mine that produced the stone. If the stone has no metadata the fallback Config.WashingItems pool is used.

Config Reference

Drop Chances

Config.CommonChance = 80   -- % chance to receive stones from a common mine swing
Config.GoldChance   = 65   -- % chance to receive gold ore from a gold mine swing
Config.RareChance   = 50   -- % chance to receive a rare item from a rare mine swing

Gold Panning

Config.GoldFlakeChance = 15  -- % success chance outside a hotspot river
Config.HotspotChance   = 50  -- % success chance inside a hotspot river

Tools

Config.Pickaxe      = 'pickaxe'    -- Item name for the pickaxe
Config.PickaxeBreak = true          -- Enable pickaxe breaking
Config.BreakChance  = 10            -- % chance for the pickaxe to break per swing

Config.Goldpan     = 'goldpan'     -- Item name for the gold pan
Config.GoldpanItem = 'goldflakes'  -- Item awarded when panning succeeds

Item Pools

Config.CommonItems = 'stone'        -- Item dropped by common mines

Config.GoldItems = 'gold_ore'       -- Item dropped by gold mines

Config.RareItems = {                -- One picked at random for rare mines
    'silver_ore', 'gold_ore', 'coal',
}

Config.WashingItems = {             -- Fallback pool when stone has no mine metadata
    'iron_ore', 'copper_ore', 'silver_ore', 'coal',
}

Hotspot Rivers

Hotspots are polygon zones that give a higher gold panning success rate.

Config.Hotspots = {
    {
        label  = 'Kamassa River',          -- Display name (informational)
        id     = 'kamassa_river',          -- Unique zone ID
        coords = { vector2(...), ... },    -- Polygon vertices (vector2 list)
        minZ   = 43.87,                    -- Bottom of the zone
        maxZ   = 53.66,                    -- Top of the zone
    },
    ...
}

The zone extends ±20 units beyond minZ/maxZ in both directions to handle uneven terrain.

Mines

Config.Mines = {
    {
        label    = 'Grizzlies Mine',   -- Map blip label
        id       = 'grizzlies_mine',   -- Unique ID (also stored in stone metadata)
        blip     = vector3(...),        -- World position: blip + zone centre
        showBlip = true,                -- Show on map (false = hidden/secret)
        radius   = 80.0,                -- Detection sphere radius in metres
        type     = 'common',            -- 'common' | 'gold' | 'rare'
        washingDrops = {                -- Weighted loot table (common mines only)
            { item = 'iron_ore',   weight = 65 },
            { item = 'coal',       weight = 25 },
            { item = 'copper_ore', weight = 10 },
        },
    },
    ...
}

washingDrops is only used for type = 'common' mines. Weights are relative — 65/25/10 means 65%, 25%, 10% of the total.


Adding a New Mine

  1. Add an entry to Config.Mines in config.lua.
  2. Choose a type:
    • 'common' — drops stone; define a washingDrops table for washing loot
    • 'gold' — drops gold_ore
    • 'rare' — drops a random item from Config.RareItems
  3. Set showBlip = false for hidden/secret locations.
  4. Changes take effect on next resource start.

Adding a New Hotspot River

  1. Record polygon corner coordinates in-game.
  2. Add an entry to Config.Hotspots with coords (vector2 list), minZ, and maxZ.
  3. The zone detection thickness auto-expands ±20 units, so minZ/maxZ only need to roughly bracket the water surface.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages