feedc0de Coop Addon

This repository is a complete Garry's Mod addon. It contains the feedc0de_coop gamemode under gamemodes/ and reusable Lua entities under lua/entities/. Installing the repository as garrysmod/addons/feedc0de_coop enables both the campaign gamemode and the standalone friendly scanner.

Persistent progression and rewards shop

Players earn Lifetime Score and spendable Credits for eligible monster kills; harder enemies award more. Lifetime Score determines rank and never decreases. Every ten connected minutes also awards five Credits. Shop purchases deduct Credits only. Changes remain in memory during active play and are written to Garry's Mod's SQLite database at garrysmod/sv.db only when the server is empty or shutting down, avoiding gameplay stalls from synchronous SQLite I/O.

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
  • F3 Players: view the all-time rankings; right-click or double-click a row to open that player's Steam profile
  • Chat !points: print personal Score, Credits, rank, and total playtime
  • 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
  • With Hoverpack enabled, jump normally and continue holding Space to hover
  • Hold TAB: compare connected players' Lifetime Scores, ranks, and total playtime

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.

The permanent weapon catalogue contains all thirteen spawnable weapons from the gamemode's CO-OP Q-menu category: Glock, P228, USP, Five-Seven, MAC-10, MP5, Pump Shotgun, FAMAS, AK-47, M4A1, Desert Eagle, Automatic Shotgun, and M249. The Workshop novelty weapons are Nyan Gun, Lightsaber, HAAAX! SWEP, Popcorn Spammable, Orbital Friendship Cannon, and Sexyness (2-bit). They are permanent unlocks at their higher prices.

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 Behaviours category contains persistent, toggleable player abilities. The Hoverpack costs 500 Credits by default and is enabled immediately after buying it. A short Space press remains a normal jump; holding Space for 0.3 seconds in the air maintains altitude and rises slowly. Releasing Space stops thrust and restores normal gravity. Pressing and holding Space again can restart thrust while still airborne. Thrust consumes the standard AUX power meter and stops at zero. After a 1.25-second pause with Space released, AUX recharges while waiting and recharges faster while walking; active sprinting does not receive the extra hoverpack recharge. Its built-in looping thruster sound follows the player and is audible to nearby players.

God Mode is a non-permanent Behaviour purchase. Each activation costs 1,000 Credits by default and immediately grants 90 seconds of server-enforced damage immunity. It creates no ownership record. Attempting to activate it while it is already running reports the remaining time and does not spend Credits.

A cheaper 30-second God Mode is available for 400 Credits by default. It follows the same rules and does not stack with an already active God Mode timer.

The Player Trails category contains permanent trail unlocks with one equipped at a time. The included choices use Garry's Mod's built-in LOL, love, plasma, electric, laser, and smoke materials, so they require no extra downloads. The rainbow plasma trail cycles colour continuously. Equipping No Trail disables the effect without removing purchased trails.

The Entities category contains consumable deployables. Aim at a clear floor and purchase one to spawn it there. Default prices are 10 Credits for a Bouncy Ball, 20 for a cyan Glowstick, 25 for a Health Kit, 35 for a Suit Battery, 60 for an Explosive Barrel, 125 for a five-second 250-damage TNT charge, and 150 for the red damage-triggered Nuke Pack TNT. The red charges can chain-react. These are not permanent unlocks; every spawned item is a separate purchase.

The Helping NPCs category contains consumable Resistance reinforcements. Default prices are 175 Credits for a Rebel, 275 for a Rebel Paramedic, 325 for Barney, 350 for Alyx, 400 for Father Grigori, and 500 for a friendly floor turret. Their kills never award Score or Credits. Per-player active-spawn limits remove the oldest purchases when exceeded, and remaining purchases are removed when their buyer disconnects.

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.

Every player gets one Players tab containing all SQLite player records, including offline players, sorted by all-time Lifetime Score. The public payload contains only SteamID64, name, online status, rank inputs, Score, Credits, and playtime. It never sends equipped models, weapons, trails, behaviours, or purchases. SteamID64 is used only for the explicit profile action; the list has no automatic player-detail tooltip. Offline history is loaded once when F3 opens; online rows and ranking then update automatically from the same networked Score, Credits, and playtime fields used by the regular TAB scoreboard. There is no manual refresh button, and the regular TAB scoreboard is unchanged. For admins, the same table adds model, weapon, trail, and purchase-count columns plus hover and selected-row details for enabled behaviours and permanent purchases. The server appends these private fields only to responses for an authenticated admin; it does not send them to guests and hide them in the UI. Connected players' newer in-memory totals are merged without forcing a synchronous SQLite save.

The equivalent server/admin console command is:

coop_setprice <model|weapon|music|behaviour|trail|entity|helper> <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 gamemodes/feedc0de_coop/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.Behaviours: toggleable ability catalogue and default prices
  • Progression.Trails: player-trail materials, colours, properties, and prices
  • Progression.Entities: consumable entity catalogue, spawn settings, and prices
  • Progression.Helpers: friendly NPC catalogue, equipment, variants, and prices
  • Progression.ShopSpawnDistance and Progression.Purchased*Limit: safe spawning distance and per-player cleanup caps
  • Progression.Hoverpack*: hover delay, rise speed, AUX drain/recharge rates, and thruster sound settings
  • Progression.Playtime*: in-memory update rate, reward interval, and Credits
  • Progression.MonsterClasses: NPC classes and their Score/Credit rewards

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.

Each map also gets one yellow friendly scanner near the preferred player spawn. It is an independently reusable scripted entity listed in the Q-menu under feedc0de Coop, so admins can spawn it in Sandbox and other gamemodes too. It uses normal VPhysics, patrols around its anchor, notices injured players farther away, flies toward them, and heals them in range with a visible yellow electrical beam. It cannot award Score or Credits. When destroyed it addresses its killer with a random farewell and falls as a gravity-enabled physical wreck for 25 seconds. The gamemode—not the reusable entity—creates a new living scanner at the same spawn anchor after five seconds. The defaults can be adjusted with gc_friendlyscanner_enabled, gc_friendlyscanner_healradius, gc_friendlyscanner_searchradius, gc_friendlyscanner_healrate, and gc_friendlyscanner_respawntime.

The gamemode establishes its map anchor only after the first player's position has remained free of teleport-sized jumps for several samples. A downward brush trace acts as the scanner's floor-distance sensor: every patrol target, initial Q-menu spawn, and physgun release resolves to the local floor plus the hover offset and is clamped below the ceiling. This lets the scanner glide up and down stairs and return to flying height after being placed low or high.

Purchase, equip, behaviour, and price responses update the existing F3 controls in place. They do not recreate, close, move, or scroll the window, so there is no visible frame flash and the selected tab and scroll position stay untouched.

S
Description
No description provided
Readme GPL-3.0
6.7 MiB
Languages
Lua 88.9%
Python 4%
JavaScript 3.3%
CSS 2.7%
HTML 1.1%