70 lines
3.5 KiB
Markdown
70 lines
3.5 KiB
Markdown
# garrysmod-coop
|
|
|
|
## Persistent progression and rewards shop
|
|
|
|
Players earn one Lifetime Score and one spendable Credit for every eligible
|
|
monster kill. Lifetime Score determines rank and never decreases. Shop
|
|
purchases deduct Credits only. Data is committed immediately to Garry's Mod's
|
|
SQLite database at `garrysmod/sv.db`.
|
|
|
|
Dying deducts up to five Credits, stopping at zero. It never deducts Lifetime
|
|
Score and therefore cannot lower a player's rank.
|
|
|
|
Player controls:
|
|
|
|
- `F3`, chat `!shop`, or client console `coop_shop`: open the rewards shop
|
|
- Chat `!points`: print personal Score, Credits, and rank
|
|
- Chat `!musicmute` or client console `coop_music_mute`: toggle purchased server music locally
|
|
- Client console `coop_music_volume 0.0` through `coop_music_volume 1.0`: set music volume
|
|
- Hold `TAB`: compare all connected players' Lifetime Scores and ranks
|
|
|
|
The shop contains persistent Half-Life 2 player models and permanent bonus
|
|
weapon unlocks. Only one bonus weapon is equipped at a time. It also contains a
|
|
Music category. Buying a song unlocks it permanently; selecting Play broadcasts
|
|
it to all connected players. One song can play at a time, with a short cooldown
|
|
afterward. Each player can mute or adjust the music locally.
|
|
|
|
Music entries may set `spatial = true` plus `minimumDistance` and
|
|
`maximumDistance`. Spatial music follows the buyer's character while they move
|
|
and fades over distance. Supply spatial audio as 44.1 kHz mono MP3 or WAV for
|
|
reliable in-game positioning.
|
|
|
|
The server checks all kills, balances, live prices, ownership, equipment, and
|
|
music playback. A purchase request contains only the item type and ID: clients
|
|
cannot award points, submit a purchase price, or debit their own Credits.
|
|
|
|
Administrators get an `Admin Prices` tab in the F3 shop. Select an item, enter a
|
|
non-negative Credit price, and save it. The server permission-checks and persists
|
|
the change in SQLite, then broadcasts the new catalogue to all connected clients.
|
|
For testing, an administrator who cannot afford an item is allowed to unlock it
|
|
without a Credit charge; the server reports the shortfall and Credits remain at
|
|
their current non-negative value. Set `Progression.AdminShopTestingBypass` to
|
|
`false` to disable this behavior.
|
|
The equivalent server/admin console command is:
|
|
|
|
`coop_setprice <model|weapon|music> <item_id> <credits>`
|
|
|
|
For example: `coop_setprice music song_id 500`. The maximum accepted price is
|
|
100,000,000 Credits. Existing owners retain their unlocks when a price changes.
|
|
|
|
Configuration is in `gamemode/progression_shared.lua`:
|
|
|
|
- `Progression.Ranks`: rank names and Lifetime Score thresholds
|
|
- `Progression.Models`: player-model catalogue and prices
|
|
- `Progression.Weapons`: bonus-weapon catalogue and prices
|
|
- `Progression.Music`: music catalogue, default prices, paths, and durations
|
|
- `Progression.MonsterClasses`: NPC classes that award points
|
|
|
|
Catalogue prices are initial defaults. Once seeded, live prices come from the
|
|
`custom_coop_shop_prices` SQLite table so in-game edits survive crashes and
|
|
restarts.
|
|
|
|
Music files are not bundled with this repository. Every server owner must supply
|
|
the audio files referenced by their `Progression.Music` entries, place them
|
|
under `garrysmod/sound/`, and reconnect clients so the server can send them. The
|
|
gamemode automatically registers every configured file with `resource.AddFile`.
|
|
Keep locally supplied audio outside the gamemode source tree and distribute or
|
|
back it up separately.
|
|
|
|
Player-spawned NPCs and unknown/friendly NPC classes do not award points.
|