mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-11 16:14:08 +01:00
f58b8511f0
## 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. /🆑
84 lines
3.3 KiB
Plaintext
84 lines
3.3 KiB
Plaintext
/obj/effect/decal/remains
|
|
name = "remains"
|
|
gender = PLURAL
|
|
icon = 'icons/effects/blood.dmi'
|
|
|
|
/obj/effect/decal/remains/acid_act()
|
|
visible_message(span_warning("[src] dissolve[gender == PLURAL?"":"s"] into a puddle of sizzling goop!"))
|
|
playsound(src, 'sound/items/tools/welder.ogg', 150, TRUE)
|
|
new /obj/effect/decal/cleanable/greenglow(drop_location())
|
|
qdel(src)
|
|
return TRUE
|
|
|
|
/obj/effect/decal/remains/human
|
|
desc = "They look like human remains. They have a strange aura about them."
|
|
icon_state = "remains"
|
|
|
|
/obj/effect/decal/remains/human/NeverShouldHaveComeHere(turf/here_turf)
|
|
return !istype(here_turf, /obj/structure/closet/crate/grave/filled) && ..()
|
|
|
|
/obj/effect/decal/remains/human/smokey
|
|
name = "remains of Charles Morlbaro"
|
|
desc = "I guess we figured out what happened to the guy who lives here. You'd best tread lightly around this..."
|
|
///Our proximity monitor, for detecting nearby looters.
|
|
var/datum/proximity_monitor/proximity_monitor
|
|
///The reagent we will release when our remains are disturbed.
|
|
var/datum/reagent/that_shit_that_killed_saddam
|
|
///A cooldown for how frequently the gas is released when disturbed.
|
|
COOLDOWN_DECLARE(gas_cooldown)
|
|
///The length of the aforementioned cooldown.
|
|
var/gas_cooldown_length = (20 SECONDS)
|
|
|
|
/obj/effect/decal/remains/human/smokey/Initialize(mapload)
|
|
. = ..()
|
|
|
|
proximity_monitor = new(src, 1)
|
|
var/list/blocked_reagents = subtypesof(/datum/reagent/medicine) + subtypesof(/datum/reagent/consumable) //Boooooriiiiing
|
|
that_shit_that_killed_saddam = get_random_reagent_id(blacklist = blocked_reagents)
|
|
|
|
/obj/effect/decal/remains/human/smokey/HasProximity(atom/movable/tomb_raider)
|
|
if(!COOLDOWN_FINISHED(src, gas_cooldown))
|
|
return
|
|
|
|
if(iscarbon(tomb_raider))
|
|
var/mob/living/carbon/nearby_carbon = tomb_raider
|
|
if(nearby_carbon.move_intent != MOVE_INTENT_WALK || prob(5))
|
|
release_smoke(nearby_carbon)
|
|
COOLDOWN_START(src, gas_cooldown, gas_cooldown_length)
|
|
|
|
///Releases a cloud of smoke based on the randomly generated reagent in Initialize().
|
|
/obj/effect/decal/remains/human/smokey/proc/release_smoke(mob/living/smoke_releaser)
|
|
visible_message(span_warning("[smoke_releaser] disturbs [src], which releases a huge cloud of gas!"))
|
|
do_chem_smoke(2, src, get_turf(src), that_shit_that_killed_saddam, 15)
|
|
|
|
///Subtype of smokey remains used for rare maintenance spawns.
|
|
/obj/effect/decal/remains/human/smokey/maintenance
|
|
name = "smokey remains"
|
|
desc = "They look like human remains. They have a strange, smokey aura about them... You should tread lightly when walking near this."
|
|
|
|
/obj/effect/decal/remains/human/smokey/maintenance/Initialize(mapload)
|
|
. = ..()
|
|
gas_cooldown_length = rand(4 MINUTES, 6 MINUTES)
|
|
|
|
/obj/effect/decal/remains/plasma
|
|
icon_state = "remainsplasma"
|
|
|
|
/obj/effect/decal/remains/plasma/NeverShouldHaveComeHere(turf/here_turf)
|
|
return isclosedturf(here_turf)
|
|
|
|
/obj/effect/decal/remains/xeno
|
|
desc = "They look like the remains of something... alien. They have a strange aura about them."
|
|
icon_state = "remainsxeno"
|
|
|
|
/obj/effect/decal/remains/xeno/larva
|
|
icon_state = "remainslarva"
|
|
|
|
/obj/effect/decal/remains/robot
|
|
desc = "They look like the remains of something mechanical. They have a strange aura about them."
|
|
icon = 'icons/mob/silicon/robots.dmi'
|
|
icon_state = "remainsrobot"
|
|
|
|
/obj/effect/decal/cleanable/blood/gibs/robot_debris/old
|
|
name = "dusty robot debris"
|
|
desc = "Looks like nobody has touched this in a while."
|