Files
SmArtKarandGitHub f58b8511f0 Refactors effect_system (#94999)
## About The Pull Request

This PR refactors ``effect_system``s to be a bit easier to use by
getting rid of ``set_up``, allowing ``attach()`` to be chained into
``start()`` and refactoring most direct system usages in our code to use
helper procs.

``set_up`` was unnecessary and only existed to allow ``New``'s behavior
to be fully overriden, which is not required if we split
sparks/lightning/steam into a new ``/datum/effect_system/basic`` subtype
which houses the effect spreading behavior. This allows us to roll all
logic from ``set_up`` into ``New`` and cut down on code complexity.
Chaining setup as ``system.attach(src).start()`` also helps a bit in
case no helper method exists

I've added ``do_chem_smoke`` and ``do_foam`` helpers, which respectively
allow chemical smoke or foam to be spawned easily without having to
manually create effect datums and reagent holders.

Also turns out we've had some nonfunctional effect systems which either
never set themselves up, or never started, so I fixed those while I was
at it (mostly by moving them to aforementioned helper procs)

## Why It's Good For The Game

Cleaner code, makes it significantly easier for users to work with. Also
most of our effect system usage was copypasta which was passing booleans
as numbers, while perfectly fine helper procs existed in our code.

## Changelog
🆑
refactor: Refactored sparks, foam, smoke, and other miscellaneous effect
systems.
refactor: Vapes now have consistent rigging with cigs using the new
system.
fix: Fixed some effects never working.
/🆑
2026-02-03 22:23:09 -05:00

237 lines
9.7 KiB
Plaintext

// Shotgun
/obj/item/ammo_casing/shotgun
name = "shotgun slug"
desc = "A 12 gauge lead slug."
icon_state = "blshell"
worn_icon_state = "shell"
caliber = CALIBER_SHOTGUN
custom_materials = list(/datum/material/iron=SHEET_MATERIAL_AMOUNT*2)
projectile_type = /obj/projectile/bullet/shotgun_slug
newtonian_force = 1.25
/obj/item/ammo_casing/shotgun/milspec
name = "shotgun milspec slug"
desc = "A 12 gauge milspec lead slug."
projectile_type = /obj/projectile/bullet/shotgun_slug/milspec
/obj/item/ammo_casing/shotgun/executioner
name = "executioner slug"
desc = "A 12 gauge lead slug purpose built to annihilate flesh on impact."
icon_state = "stunshell"
projectile_type = /obj/projectile/bullet/shotgun_slug/executioner
/obj/item/ammo_casing/shotgun/pulverizer
name = "pulverizer slug"
desc = "A 12 gauge lead slug purpose built to annihilate bones on impact."
icon_state = "stunshell"
projectile_type = /obj/projectile/bullet/shotgun_slug/pulverizer
/obj/item/ammo_casing/shotgun/beanbag
name = "beanbag slug"
desc = "A weak beanbag slug for riot control."
icon_state = "bshell"
custom_materials = list(/datum/material/iron=SMALL_MATERIAL_AMOUNT*2.5)
projectile_type = /obj/projectile/bullet/shotgun_beanbag
/obj/item/ammo_casing/shotgun/incendiary
name = "incendiary slug"
desc = "An incendiary-coated shotgun slug."
icon_state = "ishell"
projectile_type = /obj/projectile/bullet/incendiary/shotgun
/obj/item/ammo_casing/shotgun/incendiary/no_trail
name = "precision incendiary slug"
desc = "An incendiary-coated shotgun slug, specially treated to only ignite on impact."
projectile_type = /obj/projectile/bullet/incendiary/shotgun/no_trail
/obj/item/ammo_casing/shotgun/dragonsbreath
name = "dragonsbreath shell"
desc = "A shotgun shell which fires a spread of incendiary pellets."
icon_state = "ishell2"
projectile_type = /obj/projectile/bullet/incendiary/shotgun/dragonsbreath
pellets = 6
variance = 15
randomspread = TRUE
/obj/item/ammo_casing/shotgun/stunslug
name = "taser slug"
desc = "A stunning taser slug."
icon_state = "stunshell"
projectile_type = /obj/projectile/bullet/shotgun_stunslug
custom_materials = list(/datum/material/iron=SMALL_MATERIAL_AMOUNT*2.5)
/obj/item/ammo_casing/shotgun/meteorslug
name = "meteorslug shell"
desc = "A shotgun shell rigged with CMC technology, which launches a massive slug when fired."
icon_state = "mshell"
projectile_type = /obj/projectile/bullet/cannonball/meteorslug
custom_materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT * 8, /datum/material/glass = SHEET_MATERIAL_AMOUNT * 4)
/obj/item/ammo_casing/shotgun/pulseslug
name = "pulse slug"
desc = "A delicate device which can be loaded into a shotgun. The primer acts as a button which triggers the gain medium and fires a powerful \
energy blast. While the heat and power drain limit it to one use, it can still allow an operator to engage targets that ballistic ammunition \
would have difficulty with."
icon_state = "pshell"
projectile_type = /obj/projectile/beam/pulse/shotgun
custom_materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT * 2.1, /datum/material/glass = SMALL_MATERIAL_AMOUNT * 1.2)
/obj/item/ammo_casing/shotgun/frag12
name = "FRAG-12 slug"
desc = "A high explosive breaching round for a 12 gauge shotgun."
icon_state = "heshell"
projectile_type = /obj/projectile/bullet/shotgun_frag12
/obj/item/ammo_casing/shotgun/buckshot
name = "buckshot shell"
desc = "A 12 gauge buckshot shell."
icon_state = "gshell"
projectile_type = /obj/projectile/bullet/pellet/shotgun_buckshot
pellets = 6
variance = 15
randomspread = TRUE
/obj/item/ammo_casing/shotgun/buckshot/old
projectile_type = /obj/projectile/bullet/pellet/shotgun_buckshot/old
can_misfire = TRUE
misfire_increment = 2
integrity_damage = 4
/obj/item/ammo_casing/shotgun/buckshot/old/fire_casing(atom/target, mob/living/user, params, distro, quiet, zone_override, spread, atom/fired_from)
. = ..()
if(fired_from)
do_smoke(0, fired_from, fired_from)
/obj/item/ammo_casing/shotgun/buckshot/milspec
name = "milspec buckshot shell"
desc = "A 12 gauge buckshot shell, used by various paramilitaries and mercernary forces."
projectile_type = /obj/projectile/bullet/pellet/shotgun_buckshot/milspec
/obj/item/ammo_casing/shotgun/buckshot/spent
projectile_type = null
/obj/item/ammo_casing/shotgun/rubbershot
name = "rubber shot"
desc = "A shotgun casing filled with densely-packed rubber balls, used to incapacitate crowds from a distance."
icon_state = "rshell"
projectile_type = /obj/projectile/bullet/pellet/shotgun_rubbershot
pellets = 6
variance = 15
randomspread = TRUE
custom_materials = list(/datum/material/iron=SHEET_MATERIAL_AMOUNT*2)
/obj/item/ammo_casing/shotgun/incapacitate
name = "custom incapacitating shot"
desc = "A shotgun casing filled with... something. used to incapacitate targets."
icon_state = "bountyshell"
projectile_type = /obj/projectile/bullet/pellet/shotgun_incapacitate
pellets = 12//double the pellets, but half the stun power of each, which makes this best for just dumping right in someone's face.
variance = 25
custom_materials = list(/datum/material/iron=SHEET_MATERIAL_AMOUNT*2)
/obj/item/ammo_casing/shotgun/flechette
name = "flechette shell"
desc = "A shotgun casing filled with small metal darts. Pokes many tiny holes into meat and kevlar alike. Useful for turning someones insides \
into outsides."
icon_state = "flechette"
projectile_type = /obj/projectile/bullet/pellet/flechette
custom_materials = list(/datum/material/iron = HALF_SHEET_MATERIAL_AMOUNT, /datum/material/glass = SMALL_MATERIAL_AMOUNT * 2)
pellets = 8
variance = 10
/obj/item/ammo_casing/shotgun/flechette/donk
name = "\improper Donk Co. 'Donk Spike' Shell"
desc = "Donk Co., looking to create a new and exciting shell to move onto the open market, invented what they call the 'Donk Spike'. \
A flechette not made from standard ferrous metals. But...plastic. It was a financial failure due to a complete lack of \
confidence in the product. Now there are millions of these things in landfills across the sector. This is one such example. \
Looks like a donk-pocket! Tastes like death!"
icon_state = "flechette_donk"
projectile_type = /obj/projectile/bullet/pellet/flechette/donk
custom_materials = list(/datum/material/iron = HALF_SHEET_MATERIAL_AMOUNT, /datum/material/plastic = SMALL_MATERIAL_AMOUNT * 2)
pellets = 5
/obj/item/ammo_casing/shotgun/ion
name = "ion shell"
desc = "An advanced shotgun shell which uses a subspace ansible crystal to produce an effect similar to a standard ion rifle. \
The unique properties of the crystal split the pulse into a spread of individually weaker bolts."
icon_state = "ionshell"
projectile_type = /obj/projectile/ion/weak
pellets = 4
variance = 15
randomspread = TRUE
custom_materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT * 2, /datum/material/glass = SMALL_MATERIAL_AMOUNT * 0.7)
/obj/item/ammo_casing/shotgun/scatterlaser
name = "scatter laser shell"
desc = "An advanced shotgun shell that uses a micro laser to replicate the effects of a scatter laser weapon in a ballistic package."
icon_state = "lshell"
projectile_type = /obj/projectile/beam/scatter
pellets = 6
variance = 15
randomspread = TRUE
/obj/item/ammo_casing/shotgun/scatterlaser/emp_act(severity)
. = ..()
if(isnull(loaded_projectile) || !prob(40/severity))
return
name = "malfunctioning laser shell"
desc = "An advanced shotgun shell that uses a micro laser to replicate the effects of a scatter laser weapon in a ballistic package. The capacitor powering this assembly appears to be smoking."
projectile_type = /obj/projectile/beam/scatter/pathetic
loaded_projectile = new projectile_type(src)
/obj/item/ammo_casing/shotgun/techshell
name = "unloaded technological shell"
desc = "A high-tech shotgun shell which can be loaded with materials to produce unique effects."
icon_state = "cshell"
projectile_type = null
/obj/item/ammo_casing/shotgun/techshell/Initialize(mapload)
. = ..()
var/static/list/slapcraft_recipe_list = list(/datum/crafting_recipe/meteorslug, /datum/crafting_recipe/pulseslug, /datum/crafting_recipe/dragonsbreath, /datum/crafting_recipe/ionslug)
AddElement(
/datum/element/slapcrafting,\
slapcraft_recipes = slapcraft_recipe_list,\
)
/obj/item/ammo_casing/shotgun/dart
name = "shotgun dart"
desc = "A dart for use in shotguns. Can be injected with up to 15 units of any chemical."
icon_state = "cshell"
projectile_type = /obj/projectile/bullet/dart
var/reagent_amount = 15
/obj/item/ammo_casing/shotgun/dart/Initialize(mapload)
. = ..()
create_reagents(reagent_amount, OPENCONTAINER)
/obj/item/ammo_casing/shotgun/dart/attackby()
return
/obj/item/ammo_casing/shotgun/dart/large
name = "XL shotgun dart"
desc = "A dart for use in shotguns. Can be injected with up to 25 units of any chemical."
reagent_amount = 25
/obj/item/ammo_casing/shotgun/dart/bioterror
name = "bioterror dart"
desc = "An improved shotgun dart filled with deadly toxins. Can be injected with up to 30 units of any chemical."
reagent_amount = 30
/obj/item/ammo_casing/shotgun/dart/bioterror/Initialize(mapload)
. = ..()
reagents.add_reagent(/datum/reagent/consumable/ethanol/neurotoxin, 6)
reagents.add_reagent(/datum/reagent/toxin/spore, 6)
reagents.add_reagent(/datum/reagent/toxin/mutetoxin, 6) //;HELP OPS IN MAINT
reagents.add_reagent(/datum/reagent/toxin/coniine, 6)
reagents.add_reagent(/datum/reagent/toxin/sodium_thiopental, 6)
/obj/item/ammo_casing/shotgun/breacher
name = "breaching slug"
desc = "A 12 gauge anti-material slug. Great for breaching airlocks and windows, quickly and efficiently."
icon_state = "breacher"
projectile_type = /obj/projectile/bullet/shotgun_breaching
custom_materials = list(/datum/material/iron=SHEET_MATERIAL_AMOUNT*2)