Reference mods
The dedicated server comes with eight game modes of its own in data/plugins/, made from scratch as examples of the plugin API and as its tests. Each is a plain plugin (a plugin.toml, a main.luau of a few hundred lines and its tests/); read them to learn how a mode is put together, copy one to start your own.
They are off until the server enables one in its plugins/plugins.toml (in the user folder). A mode takes the server over, so enable one at a time; the game's own plugins (docs/plugins_shipped.md) go with any of them:
# plugins/plugins.toml
enable = ["zombie", "admin", "mapvote"]
Each mode runs from the map's start (cs.register_mode and cs.set_mode): the server browser shows its title, and the rules it turns off come back when it unloads.
| Mod | What it is | Commands | Settings |
|---|---|---|---|
deathmatch | Everyone respawns a moment after dying, at the spawn point farthest from the enemies, with the weapons they chose; a spawned player cannot be hurt until they shoot. No rounds, no buying, no objectives; mp_fraglimit or mp_timelimit ends the map. | guns | dm_respawn (1.5 s), dm_protect (2 s) |
zombie | Everyone starts each round as a human. After the freeze time and zm_delay, one player in zm_ratio becomes a zombie (a knife, much health, speed, low gravity); a zombie's hit turns a human. The zombies win when no human is left, the humans when the time runs out or every zombie is dead. | zm_delay (10 s), zm_ratio (8), zm_health (2000), zm_speed (290), zm_gravity (0.8) | |
jailbreak | Prisoners (terrorists, a knife only) and guards (at most one for jb_ratio prisoners, with an M4A1 and a Desert Eagle). A guard takes the warden's role and opens the cells (the map's doors named cell or jail); a prisoner who hurts a guard turns rebel (red). The last prisoner gets a last request: a knife or pistol duel. | warden, open | jb_ratio (3) |
surf | Each player gets the surf's air acceleration as their own (their client predicts with it), falls do not hurt, nobody hurts anybody, the dead spawn again in a second. A speedometer, and the map's speed record. | cp (a checkpoint), tp (back to it), speed | surf_airaccelerate (150), surf_respawn (1 s) |
hideseek | The terrorists hide (a knife that does not hurt, flashbangs, a smoke grenade) while the counter-terrorists wait frozen and blind; then they seek. A terrorist alive at the end of the time wins the round, and each survivor scores. | hns_hidetime (30 s), hns_flashbangs (2) | |
deathrun | One terrorist, the activator, works the map's traps; everyone else runs. Knives only; the activator's place goes round each round. | dr_activator_speed (300) | |
gungame | Each kill moves the killer up a ladder of 22 weapons; a knife kill also takes a level from the victim. The last levels are an HE grenade (given again after each throw) and the knife: a knife kill there wins, and the game starts again. Respawn after a second; no rounds, no buying. | level | |
races | A role-playing mod over the normal game (rounds, buying and objectives stay). Four races (Humans, Orcs, Undead, Elves) with three skills each; kills and won rounds give experience, each of ten levels a skill point, each skill up to rank 3. Kept by player ID, for each race. | race, skills, races | races_kill_xp (20), races_win_xp (10) |
What each one shows
| Mod | The API it leans on |
|---|---|
deathmatch | cs.register_mode with rules off; player_spawn_point (choose the spot), player_equip (block the game's items and arm), takedamage for the protection, weapon_attack, Player:respawn, menus, an export. |
zombie | player_choose_team (everyone a human), team_win_check blocked and Game:end_round (the mode decides the winner), player_damage blocked and changed into an infection, Player:switch_team, per-player gravity and speed, player_pickup, team titles and colours, the team_balance rule, a HUD counter. |
jailbreak | Team limits by ratio in player_choose_team, player_equip, the map's doors (cs.find_entities, Entity:use), render effects, player_damage (rebels), player_killed (the last request), menus with a timeout. |
surf | Player.air_accelerate (a movement setting the client predicts), player_land (no fall damage), the pvp_damage rule, a HUD widget fed every frame, cs.store (the record). |
hideseek | cs.flag.frozen, screen fades, freeze_end, a HUD timer, player_damage (harmless knives), round_end changed (a draw becomes the hiders' win). |
deathrun | Teams chosen by the mode (player_choose_team, round_end, Player:switch_team), per-player speed, weapon_deploy. |
gungame | player_killed and the killer's weapon, Player:strip, Player:give and Player:select, grenade_thrown, Game:restart, HUD lists. |
races | cs.store per player ID, player_damage (evasion, critical strikes, life drain, thorns), timers (regeneration), round_end (experience for the winners), bots handled apart. |
Tests
Each mod's tests/ is played by cs_plugin test (docs/plugins_tools.md, "Testing") on cs_office, with bots and scripted players: modes, teams, weapons, infections, duels, levels and saved progress. The game's tools/reference_mods_test.sh runs all eight (MODS="zombie gungame" runs only those).