Weapons & Projectiles
Relevant source files
The following files were used as context for generating this wiki page:
Weapons and projectiles encompass the systems governing ballistic firearms, energy weapons, and specialized combat modules used by crew members and vehicles. This system manages the mechanical behavior of various "bolt types" for ballistic guns, ammo consumption, and projectile interactions such as ricochets and embedding.
Ballistic Firearms Mechanics
Ballistic guns in the /obj/item/gun/ballistic class rely on specific bolt configurations to determine how they cycle rounds and interact with magazines. The bolt_type variable defines whether a gun holds a round in the chamber, drops all internal rounds upon reloading, or locks its slide back when empty.
Bolt Type Classifications
The system utilizes four primary bolt types to simulate different firearm actions:
- BOLT_TYPE_STANDARD: Used for guns with internal bolts like the C20r. These do not lock the slide back.
- BOLT_TYPE_OPEN: Rounds feed directly from the magazine. Removing the magazine leaves the chamber empty.
- BOLT_TYPE_NO_BOLT: Used for revolvers and break-action shotguns. Reloading drops all internal ammunition.
- BOLT_TYPE_LOCKING: Common for pistols and bolt-action rifles. The slide locks back when the gun is empty, requiring a manual cycle to return the slide home.
Sources: code/modules/projectiles/guns/bolt_types_explained.md:13-39
Visual Feedback and Ammo Display
Guns support visual overlays to represent current ammunition levels. When mag_display_ammo is enabled, the sprite updates to show increments of 100%, 80%, 60%, 40%, and 20%.
Sources: code/modules/projectiles/guns/bolt_types_explained.md:52-57
Projectile Behavior and Armor Interaction
Projectiles interact with targets based on their ammo type and the target's protection. Advanced projectiles like .38 DumDum can embed in unarmored targets, while .38/L6 Match Grade rounds are tuned for ricochets.
Damage and Protection
Armor protects against projectiles by reducing the chance of embedding. The system compares the projectile's properties against the target's bullet or bomb armor values for specific limbs.
Sources: html/changelogs/archive/2020-04.yml:104-114, html/changelogs/archive/2022-05.yml:710-713
The diagram shows the logic flow when a projectile impacts a target. Sources: html/changelogs/archive/2020-04.yml:104-114
Vehicle and Exosuit Weaponry
Exosuits (Mechas) utilize a dedicated weapons interface managed through a modules pane. These systems include safety protocols that prevent accidental discharge.
Weapons Safety Protocol
Mecha weapons default to a "Safety Enabled" state. When enabled, the reticle is disabled, and AI users are restricted from using equipment. Disabling the safety allows full use of ballistic and energy modules.
Sources: tgui/packages/tgui/interfaces/Mecha/ModulesPane.tsx:47-66, html/changelogs/archive/2022-05.yml:162-167
Ballistic Module Data Structure
The UI parses ballistic weapon data to track magazine capacity and stored caches.
| Field | Description |
|---|---|
projectiles | Number of rounds currently in the magazine. |
max_magazine | Total capacity of the inserted magazine. |
projectiles_cache | Number of reserve rounds stored in the module. |
ammo_type | The string identifier of the loaded ammunition. |
Sources: tgui/packages/tgui/interfaces/Mecha/ModulesPane.tsx:216-240
Global Combat Configuration
The server's combat balance is tuned via global configuration files. These settings apply to all weapons and projectiles.
| Option | Default Value | Description |
|---|---|---|
DAMAGE_MULTIPLIER | 1 | Multiplier for all weapon damage and healing. |
BOMBCAP | 20 | Maximum range of explosions in (light damage) notation. |
REACTIONARY_EXPLOSIONS | Disabled | Determines if explosions react to walls and doors. |
Sources: config/game_options.txt:5-6, config/game_options.txt:398-410
Martial Arts and Unarmed Combat
Martial techniques like "The Tunnel Arts" (Maint-fu) and "Sleeping Carp" provide alternatives to firearms. These systems focus on stamina damage, grabs, and specialized blocks.
- Sleeping Carp: Allows users to deflect projectiles while in combat mode.
- Tackling: Outcomes depend on the attacker's unarmed effectiveness and the target's armor (e.g., Riot Armor provides tackle resistance).
- Stamina Damage: Exhaustion from stamina damage pauses natural regeneration for 10 seconds.
Sources: html/changelogs/archive/2019-06.yml:43-45, html/changelogs/archive/2023-11.yml:517-535, html/changelogs/archive/2023-11.yml:795-816
The weapons and projectiles system provides a complex framework for combat, ranging from high-fidelity ballistic cycling to specialized martial arts and heavy exosuit modules, all governed by centralized damage and armor logic.