Files
SmArtKar 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

72 lines
2.8 KiB
Plaintext

/datum/round_event_control/wisdomcow
name = "Wisdom Cow"
typepath = /datum/round_event/wisdomcow
max_occurrences = 1
weight = 20
category = EVENT_CATEGORY_FRIENDLY
description = "A cow appears to tell you wise words."
admin_setup = list(
/datum/event_admin_setup/set_location/wisdom_cow,
/datum/event_admin_setup/listed_options/wisdom_cow_wisdom,
/datum/event_admin_setup/input_number/wisdom_cow,
/datum/event_admin_setup/listed_options/wisdom_cow_milk,
)
/datum/round_event/wisdomcow
///Location override that, if set causes the cow to spawn in a pre-determined locaction instead of randomly.
var/turf/spawn_location
///An override that if set rigs the cow to spawn with a specific wisdow rather than a random one.
var/selected_wisdom
///An override that if set modifies the amount of wisdow the cow will add/remove, if not set will default to 500.
var/selected_experience
///An override that if set modifies what you can milk out of the cow
var/datum/reagent/forced_reagent_type
/datum/round_event/wisdomcow/announce(fake)
priority_announce("A wise cow has been spotted in the area. Be sure to ask for her advice.", "Nanotrasen Cow Ranching Agency")
/datum/round_event/wisdomcow/start()
var/turf/targetloc
if(spawn_location)
targetloc = spawn_location
else
targetloc = get_safe_random_station_turf()
var/mob/living/basic/cow/wisdom/wise = new(targetloc, selected_wisdom, selected_experience, forced_reagent_type)
do_smoke(1, wise, targetloc)
announce_to_ghosts(wise)
/datum/event_admin_setup/set_location/wisdom_cow
input_text = "Spawn on current turf?"
/datum/event_admin_setup/set_location/wisdom_cow/apply_to_event(datum/round_event/wisdomcow/event)
event.spawn_location = chosen_turf
/datum/event_admin_setup/listed_options/wisdom_cow_wisdom
input_text = "Select a specific wisdom type?"
normal_run_option = "Random Wisdom"
/datum/event_admin_setup/listed_options/wisdom_cow_wisdom/get_list()
return subtypesof(/datum/skill)
/datum/event_admin_setup/listed_options/wisdom_cow_wisdom/apply_to_event(datum/round_event/wisdomcow/event)
event.selected_wisdom = chosen
/datum/event_admin_setup/input_number/wisdom_cow
input_text = "How much experience should this cow grant?"
default_value = 500
max_value = 2500
min_value = -2500
/datum/event_admin_setup/input_number/wisdom_cow/apply_to_event(datum/round_event/wisdomcow/event)
event.selected_experience = chosen_value
/datum/event_admin_setup/listed_options/wisdom_cow_milk
input_text = "Select a kind of milk?"
normal_run_option = "Random Reagent"
/datum/event_admin_setup/listed_options/wisdom_cow_milk/get_list()
return sort_list(subtypesof(/datum/reagent), /proc/cmp_typepaths_asc)
/datum/event_admin_setup/listed_options/wisdom_cow_milk/apply_to_event(datum/round_event/scrubber_overflow/event)
event.forced_reagent_type = chosen