A contract, step by step#
- The leader picks an order on the tablet. The server checks the level of every roster member, the perk, free ore at the site and the $500 truck deposit, then reserves enough matching veins plus one decoy. The truck spawns at the bay, and the job lends a pick to anyone without one for a $100 deposit.
- The crew surveys the reserved rock faces. A survey shows the ore type and how rich the face is, and the grade with the Survey reading perk.
- Matching faces are cut one unit at a time, with the swing minigame. The ore lands on a pile at the face.
- Workers fill their ore sack from the pile and put it in the truck bed, an ox_inventory stash opened at the truck.
- At the wash station, sacks come out of the bed one at a time and are tipped into the hopper. Whoever drove the loaded truck gets drive credit, split by the distance each driver covered.
- Washing takes batches out of the hopper. Low grade ore loses more to rejects, and the loss is shown before the wash starts. If the crew ends up short, the foreman reserves another vein.
- Once the washed ore is handed over and the truck is parked back at the bay, the foreman pays out on the spot.
The leader can cancel a running contract on the tablet's Contract tab. Cancelling pays only for ore already handed over.
Server checks#
Every action asks the server to begin, which claims the rock face or wash batch and remembers when. The completion is checked for the right player, contract, distance, tool, order and minimum time, and is applied once. A minigame result from the client only counts as an attempt.
Company cargo (ore_sack, washed_ore) carries its contract id. ox_inventory hooks keep it in the worker's pockets or the crew's truck bed, and only crew members standing at the truck can open the bed. The cargo is removed when the contract ends, or when the player logs in without a running contract.
Callbacks that read the database (the tablet, the foreman dialogue, the claim locker) answer each player at most once a second, and work actions are limited to one every 300 ms.
Disconnects and the truck#
A crew member who disconnects or logs out keeps their place for Config.Crew.reconnectGrace (300 seconds) and picks the contract up again when the character comes back. If the leader leaves, the next crew member online becomes leader. A contract with nobody left after the grace period is settled as abandoned.
If the truck is wrecked or lost, its bed goes with it. Sacks in it have to be cut again, and washed ore stored in it comes off the washed count, so the step list asks for more and the foreman reserves another vein when the crew is short. Any crew member can get a new truck from the foreman for a new deposit, and the old one is forfeited.
Only the crew member who paid the truck deposit can settle without the truck and lose it. If that member has dropped off the roster, the crew may settle anyway.
A crew member who is offline when the crew settles keeps the loaned pick for now. Their tool deposit is held and lands in the claim locker when the pick goes back to the company at their next login.
Pay split#
80% of the cash is split equally between the workers who earned at least Config.Split.minCredits (3). The other 20% follows the work each one did: surveying, cutting, loading, driving, washing and delivering, each capped at twice a fair share. Each extra eligible worker adds 5% to the pot, up to 15%. On supply orders the crew keeps 30% of the value as raw_ore, split by cash share.
Payout ledger#
Everything a contract owes a character (wages, kept ore, deposit refunds, completion XP for offline workers) is written to mining_entitlements in one transaction before anything is paid. Each row has a unique key and moves from unclaimed to paying to paid once, so a repeated request or a crash cannot pay twice. Rows that cannot be paid right away wait in the claim locker on the tablet. Item rows expire after Config.ClaimDays (7).
If the server stops in the middle of a payout, the row stays in paying and is not retried, because that could pay twice. The console lists such rows at start so staff can set them to paid or unclaimed by hand.
Restarts#
Running contracts are saved to mining_contracts every 5 seconds while they change, in one transaction when the resource stops, and early when txAdmin announces a restart or shutdown. At the next start each unfinished contract is settled as a server-side cancellation: delivered ore is paid, a finished order still gives its completion XP, and held deposits are refunded, all through the claim locker.
A crash while a crew is settling leaves the contract saved as it was before settling, so the next start recovers it with the same row keys and nothing is written twice.
Database tables#
| Table | What it holds |
|---|---|
mining_contracts |
Contract records and their saved state |
mining_entitlements |
The payout ledger and the claim locker |
mining_veins |
Ore type, grade, units left and recovery time per vein |
At every start the resource deletes paid and expired payout rows and finished contracts older than Config.PruneDays (30). Rows still owed to a player are never deleted.