Skip to content

Features & Configuration

Alienmario edited this page Jun 30, 2024 · 37 revisions

SourceCoop makes an effort to only alter gameplay on maps that it knows are cooperative, while keeping others near stock.

Some crash-fixes and patches are always applied as long as the plugin is running, regardless of mode.

COOP mode features

Overview

  • Re-enabled SP functionality (prop pickup, sprinting, suit sounds, ...)
  • Entity adaptations for multiplayer
  • Custom mapchange handling, supporting campaigns
  • Expansive map oriented configuration setup with equipment, entity fixes, checkpoints, etc
  • Map start and mapchange timers
  • Delayed map intros
  • Survival mode with revives
  • Player persistence
  • Pickup item instancing
  • Coop menu
  • Modular addons, each providing unique functionality
  • Smaller tweaks for improved overall experience

Togglable coop features

Syntax: sc_ft <FEATURE> <1/0>

These on/off switches are usually configured per map in edt configs. Server configuration is optional and could negatively affect some maps.
A collection of these commands can simply be put in server.cfg, which will load on each map-change and override the map's default configuration.

FIRSTPERSON_DEATHCAM Re-Enables first person death camera.

HEV_SOUNDS Re-Enables HEV sounds

INSTANCE_ITEMS Instances pickup items and weapons for each player. They disappear once picked up, and 'respawn' along with the player.

INSTANCE_ITEMS_NORESET If enabled, won't 'respawn' picked up items after death.

KEEP_EQUIPMENT Makes players spawn with previously picked up equipment (suit, weapons). Global for all players.

STRIP_DEFAULT_EQUIPMENT Removes default multiplayer equipment.

STRIP_DEFAULT_EQUIPMENT_KEEPSUIT

DISABLE_CANISTER_DROPS Disables the drops when players die in multiplayer

NO_TELEFRAGGING Prevents teleporting props and players from slaying other players.

NOBLOCK Prevents player-player collisions. (Needs mp_teamplay 1 for smoothness)

SHOW_WELCOME_MESSAGE Shows players a greeting message with basic plugin info.

AUTODETECT_MAP_END Detects commonly used commands for ending singleplayer maps from point_clientcommand and point_servercommand entities and changes the map. At first, checks if sourcecoop_homemap is set (see below), then checks if nextmap is set. If none are set, the map is not changed. Recommended to keep enabled.

CHANGELEVEL_FX Show visual effects (spawn particles) at level change locations.

TRANSFER_PLAYER_STATE Enables player persistence through level changes. Currently, players will carry over their equipment, hp and suit charge for the first spawn point (checkpoint) in the map. Afterwards, the default map equipment is used.

Configuration convars

Intended to be modified by servers in server.cfg.

sourcecoop_respawntime Sets player respawn time in seconds.
Min: 0.1 Default: 2.0

sourcecoop_team Sets which team to use when mp_teamplay is 1. Valid values are "marines", "scientist", or a valid team number. Any other values will not enforce teams.
Default: scientist

sourcecoop_disable_teamselect Whether to skip the team select screen and spawn in instantly.
Default: 1

sourcecoop_start_wait_period The max number of seconds to wait since first player spawned in to start the map. The timer is skipped when all players enter the game.
Default: 15.0

sourcecoop_end_wait_period The max number of seconds to wait since first player triggered a changelevel. The timer speed increases each time a new player finishes the level.
Default: 60.0

sourcecoop_end_wait_factor Controls how much the number of finished players increases the changelevel timer speed. 1.0 means full, 0 means none (timer will run full length).
Default: 1.0

sourcecoop_end_wait_display_mode Sets which method to show changelevel countdown. 0 is panel, 1 is hud text.
Default: 1

sourcecoop_validate_steamids Validate players steam id's? Increases security at the cost of some functionality breakage when Steam goes down. At the time of writing this includes survival mode and equipment persistence.
Default: 0

sourcecoop_homemap The map to return to after finishing a campaign/map.
Default:

sourcecoop_survival_mode Sets survival mode. 0 = off. 1 will respawn players if all are dead, 2 will restart the map.
Default: 0

sourcecoop_survival_respawn Whether to respawn dead players at checkpoints.
Default: 1

sourcecoop_survival_spawn_timeout Number of seconds after the map starts (after initial timer) to allow spawning in, or -1 for no time limit. Do not use too low values so players have some time to join in.
Default: -1

sourcecoop_debug Sets debug log locations. Only available if plugin has been compiled with debugging enabled.
Default: 0

sourcecoop_debug_parts Selects additional information included in debug logs. Only available if plugin has been compiled with debugging enabled.
Default: 6

Game resource configuration

All game resources used by the plugins (materials, sounds, particles) and related properties are externalized to this config file:

addons/sourcemod/gamedata/srccoop_config.games.txt

Keep in mind this file will be overwritten when updating.

As it is a SourceMod gamedata file, a standard mechanism exist to prevent overwriting. All you need to do is create a custom subfolder and copy your modified config in.

Key Plugin Type Description
SND_BRINGALL core string Sound played when teleported by a bring-all checkpoint
SND_BRINGALL_VOL core float Volume
SND_PORTAL core string Sound played when walking into a checkpoint portal
SND_PORTAL_VOL core float Volume
PORTAL_PARTICLE core string Particle effect name used by checkpoint portals
PORTAL_TOUCH_SIZE core float The collision box size for checkpoint portals
FROZEN_FADE_COLOR core RGBA Color of "freeze" intro screen fade
FROZEN_FADE_DUR_IN core int Fade in duration in milliseconds
FROZEN_FADE_DUR_OUT core int Fade out duration in milliseconds
SND_TICK core string Tick sound played by intro timer
SND_TICK_VOL core float Volume
SND_3 core string Sound played when intro timer reaches 3 seconds
SND_2 core string Sound played when intro timer reaches 2 seconds
SND_1 core string Sound played when intro timer reaches 1 second
SND_CHANGELEVEL core string Sound played when changelevel timer starts
SND_CHANGELEVEL_VOL core float Volume
SND_CHANGELEVEL_TICK core string Tick sound played by changelevel timer
SND_CHANGELEVEL_TICK_VOL core float Volume
CHANGELEVEL_EFFECT_MODEL core string Material used for changelevel effect particles
CHANGELEVEL_EFFECT_AMOUNT core int Number of changelevel particles spawned
CHANGELEVEL_EFFECT_SPEED core float Movement speed of changelevel particles
CHANGELEVEL_EFFECT_PERIOD core float Repeat period of changelevel particles
KILLSOUNDS_SND killsounds string Sound effect used kill confirm sound
KILLSOUNDS_SND_VOL killsounds float Volume
REVIVE_SND_START revive string Sound for start of revive
REVIVE_SND_DENY revive string Sound for revive denied
REVIVE_SND_RESPAWN revive string Sound played after reviving
REVIVE_SND_RESPAWN_PITCH revive int Pitch
REVIVE_SNDLEVEL revive int Travel distance of revive sounds
REVIVE_BAR_COLOR revive RGBA Revive bar color
REVIVE_BAR_MODEL revive string Revive bar material
REVIVE_RAGDOLL_PARTICLE revive string Particle effect name spawned in dead players

Compile time feature switches

These are selected at compile time. Each game may have a different set of enabled features / patches. SourceCoop ships with the majority enabled, where applicable.
You can compile SourceCoop customizing your own build if needed.

Define Description
INTRO_TIMER_HUDTEXT For games other than Black Mesa that don't have a built-in 'waiting for players' display. Displays timer via hud-text.
ENTPATCH_CUSTOM_NPC_MODELS Enables mappers to use custom NPC models
ENTPATCH_UPDATE_ENEMY_MEMORY Fixes UpdateEnemyMemory input when targeting a player
ENTPATCH_SNIPER Fixes Sniper NPC server and client crash
ENTPATCH_TRIGGER_CHANGELEVEL Integrates trigger_changelevel fix/enhancements
ENTPATCH_TRIGGER_AUTOSAVE Allow spawning trigger_autosave in MP so they can be used for checkpoints
ENTPATCH_POINT_TELEPORT Multiplayer support for point_teleport
ENTPATCH_POINT_VIEWCONTROL Multiplayer support for point_viewcontrol
ENTPATCH_PLAYER_SPEEDMOD Multiplayer support for player_speedmod
ENTPATCH_POINT_CLIENTCOMMAND Multiplayer support for point_clientcommand
ENTPATCH_POINT_SERVERCOMMAND_CHANGELEVEL Integrates point_servercommand induced mapchanges
ENTPATCH_ENV_ZOOM Multiplayer support for env_zoom
ENTPATCH_ENV_CREDITS Fixes env_credits
ENTPATCH_ENV_SPRITE Fixes m_flGlowProxySize out of bounds console spam
ENTPATCH_AI_SCRIPT_CONDITIONS Fixes ai_script_conditions
ENTPATCH_FUNC_ROTATING Fixes func_rotating entity's "Bad SetLocalAngles" error
ENTPATCH_PLAYER_LOADSAVED Multiplayer support for player_loadsaved (kill + screenfade)
ENTPATCH_LOGIC_AUTOSAVE_SURVIVAL_RESPAWN Allows adapting logic_autosave for survival respawns
ENTPATCH_GAME_END Integrates game_end induced mapchanges
ENTPATCH_FIND_NAMED_ENTITY Scripted scenes filter for all players
ENTPATCH_REMOVE_BONE_FOLLOWERS Deletes selected NPC's (Gargantua) bone followers to increase multiplayer server perf
ENTPATCH_WEAPON_MODELS Fixes NPCs not being able to shoot with anything but the shotgun
ENTPATCH_PLAYER_ALLY Fixes friendly NPCs not triggering 'player ally only' triggers
ENTPATCH_RELATION_TYPE Fixes scientists NPC crash when seeing a non-friendly
ENTPATCH_PLAYER_COMPANION npc_human_scientist*, npc_human_security crash fix
ENTPATCH_GOALENTITY_RESOLVENAMES Fixes ai_goal_* for multiplayer
ENTPATCH_GOAL_LEAD Fixes ai_goal_lead for multiplayer
ENTPATCH_SETPLAYERAVOIDSTATE Fixes NPCs not pushing players away from their scripted path, resulting in stuckage
ENTPATCH_NPC_SLEEP Multiplayer support for NPC sleep states
ENTPATCH_BM_XENTURRET Fixes XenTurret NPC crash. Swaps to model with removed clientside particles.
ENTPATCH_BM_ICHTHYOSAUR Fixes Ichtyosair NPC crash
ENTPATCH_BM_GARGANTUA Fixes Gargantua's ChasePlayer/ChaseEnd inputs. Switches to SOLID_BBOX for collisions (workaround for removed bone followers)
ENTPATCH_BM_HOUNDEYE Fixes Houndeye crash
ENTPATCH_BM_GONARCH Fixes Gonarch crash
ENTPATCH_BM_NIHILANTH Fixes Nihilanth crash
ENTPATCH_BM_PUFFBALLFUNGUS Fixes npc_puffballfungus TakeDamage crash
ENTPATCH_BM_TRIPMINE_COLORS Fixes map-placed tripmines not having the proper color with mp_teamplay 1
ENTPATCH_BM_LAV Fixes client crash seen in bm_c2a5g related to LAV npc
ENTPATCH_BM_PROP_CHARGERS not implemented
ENTPATCH_BM_MISC_MARIONETTIST misc_marionettist multiplayer support
ENTPATCH_BM_MUSIC_TRACK music_track multiplayer support
ENTPATCH_FUNC_TRACKAUTOCHANGE Prevents track from being blocked by players and forced to go back down
ENTPATCH_FUNC_TRACKTRAIN Prevents trains from being blocked by players
PLAYERPATCH_SETSUITUPDATE Fixes suit sounds
PLAYERPATCH_PICKUP_FORCEPLAYERTODROPTHISOBJECT Fixes a crash on Pickup_ForcePlayerToDropThisObject
PLAYERPATCH_SERVERSIDE_RAGDOLLS Forces server-side player ragdolls
PLAYERPATCH_RESTORE_MP_FORCERESPAWN Restores mp_forcerespawn functionality, allowing the player to stay dead (for revives)
PLAYERPATCH_OVERRIDE_DEATH_OBSMODE Force "chase" death camera. This blocks death/freezecam mode, problematic for serverside ragdolls.
PLAYERPATCH_FINDLADDER Fixes mounting ladders with many players nearby
GAMEPATCH_UTIL_GETLOCALPLAYER Overrides UTIL_GetLocalPlayer. Required for many AI crash-fixes.
GAMEPATCH_IS_MULTIPLAYER Overrides CMultiplayRules::IsMultiplayer. Required for player fixes and spawning items with physics.
GAMEPATCH_BLOCK_RESTOREWORLD Blocks gamerules resetting the world on 'round start'
GAMEPATCH_BLOCK_RESPAWNPLAYERS Blocks gamerules respawning players on 'round start'
GAMEPATCH_ALLOW_FLASHLIGHT Re-Enables flashlight, so it can be toggled with mp_flashlight convar
GAMEPATCH_TEAMSELECT_UI For games that have team-select UI, enables convar sourcecoop_disable_teamselect

Commands

Server commands

sc_ft - Command for toggling plugin features on/off.

sc_dump (Server console only) Command for dumping map entities to a file as they were loaded from the .bsp file.

sc_save <filename> - Exports all player's equipment and state to a file. If a player is not alive, their equipment at the start of the map is saved instead.

sc_load <filename> - Imports saved data from file and attempts to equip each player (if they were present when the data was saved).

sc_clear - Clear persisted equipment and equip players with the map defaults. Does not remove saved files.

Player commands

/coopmenu Displays the coop menu.

Addons

Since not everyone may enjoy all the extra functionality this project provides, or wants to use their own solutions, we've split some functionality into separate, modular plugins.

Thirdperson

Enables thirdperson via !thirdperson chat command, thirdperson command or coop menu. Beware that for this to work, it enables cheats on the client, but not the server, so it should be relatively safe for coop setting. It also has a enable convar called sourcecoop_thirdperson_enabled.

Using thirdperson will break some weapon effects due to client-side prediction glitch.

Scoring

Gives players score for killing NPCs in the scoreboard and shows who killed who.

Scoring display can be individually toggled in coop menu, which is saved in cookies. The default can be set by convar sourcecoop_killfeed_default.

Voting

As the name indicates, provides specific voting functionality via coop menu and player commands. The vote-map list is automatically built from available .edt config files. The list can be manually reloaded with sc_reload_maps or can be set to reload on mapchange with sourcecoop_voting_autoreload 1 (this however prolongs mapchanges due to file scanning)

Player commands

/skipintro Starts a skip intro vote
/restartmap Starts a restart map vote
/changemap Shows a menu for changing maps
/survival Starts a survival vote

Server commands

sc_reload_maps Reloads all entries in the votemap menu from storage

ConVars

sourcecoop_voting_autoreload default: 1, Sets whether to reload all votemap menu entries on mapchange, which can prolong map loading times.
sourcecoop_voting_skipintro default: 1, Allow skip intro voting?
sourcecoop_voting_restartmap default: 1, Allow restart map voting?
sourcecoop_voting_changemap default: 1, Allow change map voting?
sourcecoop_voting_survival default: 2, Allow survival mode voting? Use one of values from sourcecoop_survival_mode to select the mode to vote for.

Killsounds

Plays a confirmation sound after killing a NPC.

Killsounds can be individually toggled in coop menu, which is saved in cookies. The default can be set by convar sourcecoop_ks_default.

Difficulty

Provides NPC difficulty scaling (damage dealt and damage received)

Chat commands

difficulty Display current difficulty

ConVars

sourcecoop_difficulty Sets the difficulty - from 0 (base difficulty) and up.
sourcecoop_difficulty_auto Sets automatic difficulty mode. -1 disables. 0 balances difficulty between min and max convars. Values above 0 set the difficulty increment per player, ignoring the min and max cvars.
sourcecoop_difficulty_auto_min When automatic difficulty mode is set to 0, this is the difficulty at 1 player.
sourcecoop_difficulty_auto_max When automatic difficulty mode is set to 0, this is the difficulty at max players.
sourcecoop_difficulty_announce Toggles announcing changes in difficulty.
sourcecoop_difficulty_ignoredmgto List of classnames where player->npc damage is exempt from difficulty scaling. Separated by semicolon.
sourcecoop_difficulty_ignoredmgfrom List of classnames where npc->player damage is exempt from difficulty scaling. Separated by semicolon.

Revive

Enables revive by pressing <USE> while looking at player ragdoll. Adds effects to ragdolls to improve visibility.

Admin Commands

sc_revive Force respawn player.

ConVars

sourcecoop_revive_time default: "4.0", Sets time that you have to hold E to revive.
sourcecoop_revive_score default: "1", Sets score to give for reviving a player.
sourcecoop_revive_messages default: "0", Shows messages such as You have started reviving x.
sourcecoop_revive_ragdoll_effects_timer default: "4.0", Delay for applying ragdoll highlighting effects. -1 to disable all ragdoll effects.
sourcecoop_revive_ragdoll_particle default: "1", Whether to spawn a particle inside player ragdolls to improve their visibility.
sourcecoop_revive_ragdoll_blink default: "1", Whether to blink player ragdolls to improve their visibility.
sourcecoop_revive_in_classic_mode default: "1", Whether to allow reviving in non-survival mode.

Workshop manager

Kicks players who are missing workshop maps with a custom message. Can be disabled per map in edt. Overrides net_maxfilesize to very large value. Does not currently work if fastdl is enabled.

ConVars

sourcecoop_workshop_message The message to display to players missing workshop maps. Supported placeholders: {BSPNAME}

Landing screen

Displays an overlay during the initial team select screen - by default the included SourceCoop logo.

ConVars

sourcecoop_logo_material default "sourcecoop/landing_screen", .vmt and .vtf files under this name are automatically downloaded to players.

Effects fix

Client side damage effects fix for all weapons. Spawns missing blood particles. Respects violence_ablood and violence_hblood convars.

FPD (First person death)

Adds death screen fade and an accurate first person death camera moving with your actual server-side ragdoll (created by the main plugin). What you see / where you are is in sync with how other players see you!

If player toggle is enabled, FPD can be individually toggled in coop menu, which is saved in cookies. The default uses current state of the "FIRSTPERSON_DEATHCAM" feature.

ConVars

sourcecoop_fpd_fade_ms default "1500", Duration in milliseconds to fade first-person death screen to black. 0 to disable.
sourcecoop_fpd_player_toggle default "1", Enable players to choose death camera option regardless of server/map settings.

Unstuck

Provides unstuck command by teleporting players to the active checkpoint.

Player commands

/stuck
/unstuck

ConVars

sourcecoop_next_stuck default "60.0", Prevents using stuck for this many seconds after using.

Earbleed

Adds a toggle for the ringing sound effect from explosions.

Earbleed can be individually toggled in coop menu, which is saved in cookies. The default can be set by convar sourcecoop_earbleed_default.

ConVars

sourcecoop_earbleed_default default: "0", Sets the default setting of the earbleed player preference.