From f58b8511f07bf12e76de0558ce04e88ec86bf739 Mon Sep 17 00:00:00 2001 From: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Date: Wed, 4 Feb 2026 04:23:09 +0100 Subject: [PATCH] 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 :cl: 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. /:cl: --- code/__HELPERS/reagents.dm | 3 +- code/controllers/subsystem/explosions.dm | 12 +- code/controllers/subsystem/market.dm | 5 +- code/datums/components/jetpack.dm | 3 +- code/datums/elements/deliver_first.dm | 3 +- code/datums/helper_datums/teleport.dm | 9 +- code/game/machinery/ai_slipper.dm | 3 +- code/game/machinery/autolathe.dm | 4 +- code/game/machinery/computer/robot.dm | 4 +- code/game/machinery/doors/door.dm | 9 +- code/game/machinery/igniter.dm | 5 +- code/game/machinery/launch_pad.dm | 4 +- .../machinery/porta_turret/portable_turret.dm | 8 +- code/game/machinery/quantum_pad.dm | 4 +- code/game/machinery/slotmachine.dm | 3 +- code/game/machinery/suit_storage_unit.dm | 15 +-- .../machinery/telecomms/computers/message.dm | 32 +++-- .../effects/decals/cleanable/robots.dm | 4 +- code/game/objects/effects/decals/remains.dm | 6 +- .../effects/effect_system/effect_system.dm | 87 +++++++++----- .../effect_system/effects_explosion.dm | 32 ++--- .../effects/effect_system/effects_other.dm | 113 ------------------ .../effects_reagents_explosion.dm | 30 +++++ .../effects/effect_system/effects_sparks.dm | 30 ++--- .../effects/effect_system/effects_trail.dm | 103 ++++++++++++++++ .../effects/effect_system/effects_water.dm | 27 ++--- .../fluid_spread/_fluid_spread.dm | 14 ++- .../fluid_spread/effects_foam.dm | 55 ++++++--- .../fluid_spread/effects_smoke.dm | 94 +++++++++------ code/game/objects/effects/mines.dm | 4 +- .../effect_shield.dm => shield.dm} | 5 +- .../objects/effects/spawners/gibspawner.dm | 4 +- code/game/objects/effects/step_triggers.dm | 18 +-- code/game/objects/items/cigarettes.dm | 27 ++--- code/game/objects/items/clown_items.dm | 4 +- .../objects/items/devices/chameleonproj.dm | 5 +- .../items/devices/radio/electropack.dm | 5 +- code/game/objects/items/dice.dm | 10 +- code/game/objects/items/food/burgers.dm | 4 +- code/game/objects/items/grenades/smokebomb.dm | 5 +- .../objects/items/implants/implant_misc.dm | 4 +- .../implants/security/implant_noteleport.dm | 8 +- code/game/objects/items/rcd/RHD.dm | 5 +- code/game/objects/items/rcd/RPD.dm | 5 +- .../objects/items/robot/robot_upgrades.dm | 4 +- code/game/objects/items/tanks/watertank.dm | 4 +- code/game/objects/items/toys.dm | 6 +- .../objects/items/weaponry/melee/energy.dm | 5 +- code/game/objects/structures/grille.dm | 5 +- code/game/objects/structures/hivebot.dm | 4 +- code/game/objects/structures/maintenance.dm | 4 +- code/game/objects/structures/tables_racks.dm | 5 +- code/game/objects/structures/toiletbong.dm | 7 +- code/game/objects/structures/traps.dm | 16 +-- .../abductor/equipment/gear/abductor_items.dm | 4 +- .../antagonists/abductor/machinery/pad.dm | 4 +- .../fugitive/hunters/hunter_gear.dm | 4 +- .../modules/antagonists/heretic/influences.dm | 3 +- .../heretic/knowledge/moon_lore.dm | 3 +- .../equipment/nuclear_bomb/beer_nuke.dm | 8 +- .../space_ninja/equipment/energy_katana.dm | 5 +- .../wizard/equipment/wizard_hammer.dm | 5 +- .../wizard/grand_ritual/grand_side_effect.dm | 4 +- code/modules/assembly/igniter.dm | 11 +- .../atmospherics/gasmixtures/reactions.dm | 4 +- .../machinery/air_alarm/air_alarm_interact.dm | 7 +- .../gas_recipe_machines/crystallizer_items.dm | 9 +- .../modules/awaymissions/super_secret_room.dm | 4 +- .../components/bitrunning_points.dm | 6 +- code/modules/bitrunning/objects/byteforge.dm | 5 +- code/modules/bitrunning/server/util.dm | 4 +- code/modules/cargo/markets/market_telepad.dm | 6 +- code/modules/clothing/head/perceptomatrix.dm | 18 +-- code/modules/clothing/head/tophat.dm | 2 +- .../modules/clothing/suits/reactive_armour.dm | 18 +-- .../under/jobs/Plasmaman/civilian_service.dm | 6 +- .../events/immovable_rod/immovable_rod.dm | 4 +- code/modules/events/radiation_leak.dm | 8 +- code/modules/events/wisdomcow.dm | 2 +- code/modules/events/wizard/curseditems.dm | 4 +- code/modules/events/wizard/shuffle.dm | 12 +- code/modules/explorer_drone/exodrone.dm | 2 +- .../food_and_drinks/machinery/grill.dm | 8 +- .../food_and_drinks/machinery/microwave.dm | 4 +- .../food_and_drinks/recipes/soup_mixtures.dm | 5 +- code/modules/holodeck/holo_effect.dm | 4 +- code/modules/hydroponics/grown/onion.dm | 6 +- code/modules/hydroponics/plant_genes.dm | 5 +- .../generic_skillchips/acrobatics.dm | 16 ++- code/modules/meteors/meteor_dark_matteor.dm | 5 +- .../equipment/monster_organs/brimdust_sac.dm | 2 +- .../basic/bots/cleanbot/cleanbot_abilities.dm | 4 +- .../mob/living/basic/bots/firebot/firebot.dm | 4 +- .../basic/bots/hygienebot/hygienebot.dm | 4 +- .../basic/farm_animals/cow/cow_wisdom.dm | 2 +- .../basic/minebots/minebot_abilities.dm | 8 +- .../revenant/revenant_abilities.dm | 4 +- code/modules/mob/living/silicon/ai/ai.dm | 3 +- .../mob/living/silicon/ai/ai_defines.dm | 2 +- .../modules/mob/living/silicon/robot/robot.dm | 6 +- .../mob/living/silicon/robot/robot_defines.dm | 2 +- .../hostile/mining_mobs/elites/legionnaire.dm | 4 +- code/modules/mod/modules/modules_general.dm | 4 +- code/modules/mod/modules/modules_ninja.dm | 54 ++++----- code/modules/mod/modules/modules_security.dm | 7 +- code/modules/mod/modules/modules_service.dm | 8 +- .../programs/antagonist/revelation.dm | 3 +- code/modules/power/singularity/emitter.dm | 5 +- .../ammunition/ballistic/shotgun.dm | 7 +- code/modules/projectiles/guns/magic/wand.dm | 18 ++- code/modules/projectiles/projectile/magic.dm | 24 ++-- code/modules/reagents/chem_splash.dm | 7 +- .../chemistry/machinery/smoke_machine.dm | 22 ++-- .../reagents/pyrotechnic_reagents.dm | 9 +- code/modules/reagents/chemistry/recipes.dm | 11 +- .../reagents/chemistry/recipes/drugs.dm | 5 +- .../chemistry/recipes/pyrotechnics.dm | 12 +- .../reagents/reagent_containers/inhaler.dm | 16 +-- code/modules/reagents/reagent_dispenser.dm | 5 +- code/modules/research/experimentor.dm | 46 ++----- .../xenobiology/crossbreeding/burning.dm | 13 +- .../vatgrowing/samples/_micro_organism.dm | 4 +- code/modules/spells/spell.dm | 4 +- .../spell_types/jaunt/ethereal_jaunt.dm | 3 +- .../spells/spell_types/pointed/swap.dm | 11 +- .../spells/spell_types/summon/servant.dm | 2 +- code/modules/station_goals/bsa.dm | 4 +- .../internal/cyberimp/augments_internal.dm | 4 +- code/modules/vehicles/atv.dm | 4 +- code/modules/vehicles/cars/clowncar.dm | 22 +--- code/modules/vehicles/mecha/_mecha.dm | 10 +- code/modules/vehicles/scooter.dm | 8 +- code/modules/vehicles/secway.dm | 4 +- tgstation.dme | 5 +- 134 files changed, 621 insertions(+), 904 deletions(-) delete mode 100644 code/game/objects/effects/effect_system/effects_other.dm create mode 100644 code/game/objects/effects/effect_system/effects_reagents_explosion.dm create mode 100644 code/game/objects/effects/effect_system/effects_trail.dm rename code/game/objects/effects/{effect_system/effect_shield.dm => shield.dm} (80%) diff --git a/code/__HELPERS/reagents.dm b/code/__HELPERS/reagents.dm index 181fa0d06db..aff9e5b7c54 100644 --- a/code/__HELPERS/reagents.dm +++ b/code/__HELPERS/reagents.dm @@ -86,8 +86,7 @@ /datum/reagents/proc/create_foam(foamtype, foam_volume, result_type = null, notification = null, log = FALSE) var/location = get_turf(my_atom) - var/datum/effect_system/fluid_spread/foam/foam = new foamtype() - foam.set_up(amount = foam_volume, holder = my_atom, location = location, carry = src, result_type = result_type) + var/datum/effect_system/fluid_spread/foam/foam = new foamtype(location, null, foam_volume, my_atom, carry = src, result_type) foam.start(log = log) clear_reagents() diff --git a/code/controllers/subsystem/explosions.dm b/code/controllers/subsystem/explosions.dm index 4ca6932cb3c..c01fe4f718f 100644 --- a/code/controllers/subsystem/explosions.dm +++ b/code/controllers/subsystem/explosions.dm @@ -383,13 +383,11 @@ ADMIN_VERB(check_bomb_impacts, R_DEBUG, "Check Bomb Impact", "See what the effec shake_the_room(epicenter, orig_max_distance, far_dist, devastation_range, heavy_impact_range) if(heavy_impact_range > 1) - var/datum/effect_system/explosion/E - if(smoke) - E = new /datum/effect_system/explosion/smoke - else - E = new - E.set_up(epicenter) - E.start() + var/effect_type = /datum/effect_system/explosion + if (smoke) + effect_type = /datum/effect_system/explosion/smoke + var/datum/effect_system/explosion/system = new effect_type(epicenter) + system.start() //flash mobs if(flash_range) diff --git a/code/controllers/subsystem/market.dm b/code/controllers/subsystem/market.dm index 283a147d5ae..a56ad90b1fd 100644 --- a/code/controllers/subsystem/market.dm +++ b/code/controllers/subsystem/market.dm @@ -116,10 +116,7 @@ SUBSYSTEM_DEF(market) return var/atom/movable/thing = purchase.entry.spawn_item(target, purchase) purchase.post_purchase_effects(thing) - var/datum/effect_system/spark_spread/sparks = new - sparks.set_up(5, 1, target) - sparks.attach(thing) - sparks.start() + do_sparks(5, TRUE, target) qdel(purchase) /// Used to add /datum/market_purchase to queued_purchases var. Returns TRUE when queued. diff --git a/code/datums/components/jetpack.dm b/code/datums/components/jetpack.dm index 5498a8a81ef..65b3a9e1376 100644 --- a/code/datums/components/jetpack.dm +++ b/code/datums/components/jetpack.dm @@ -94,9 +94,8 @@ /datum/component/jetpack/proc/setup_trail(mob/user) if(trail) QDEL_NULL(trail) - trail = new effect_type + trail = new effect_type(user) trail.auto_process = FALSE - trail.set_up(user) trail.start() /datum/component/jetpack/proc/activate(datum/source, mob/new_user) diff --git a/code/datums/elements/deliver_first.dm b/code/datums/elements/deliver_first.dm index b49c4dc28f4..7455c0646a1 100644 --- a/code/datums/elements/deliver_first.dm +++ b/code/datums/elements/deliver_first.dm @@ -97,8 +97,7 @@ ///called to remove the element in a flavorful way, either from delivery or from emagging/breaking open the crate /datum/element/deliver_first/proc/remove_lock(obj/structure/closet/target) target.visible_message(span_notice("[target]'s delivery lock self destructs, spewing sparks from the mechanism!")) - var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread() - spark_system.set_up(4, 0, target.loc) + var/datum/effect_system/basic/spark_spread/spark_system = new(target.loc, 4, 0) spark_system.start() playsound(src, SFX_SPARKS, 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) target.RemoveElement(/datum/element/deliver_first, goal_area_type, payment) diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index 9983761fa91..4d0b715d762 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -46,8 +46,7 @@ // if effects are not specified and not explicitly disabled, sparks if((!effectin || !effectout) && !no_effects) - var/datum/effect_system/spark_spread/sparks = new - sparks.set_up(5, 1, teleatom) + var/datum/effect_system/basic/spark_spread/sparks = new(teleatom, 5, TRUE) if (!effectin) effectin = sparks if (!effectout) @@ -55,8 +54,7 @@ if(TELEPORT_CHANNEL_QUANTUM) // if effects are not specified and not explicitly disabled, rainbow sparks if ((!effectin || !effectout) && !no_effects) - var/datum/effect_system/spark_spread/quantum/sparks = new - sparks.set_up(5, 1, teleatom) + var/datum/effect_system/basic/spark_spread/quantum/sparks = new(teleatom, 5, TRUE) if (!effectin) effectin = sparks if (!effectout) @@ -127,8 +125,7 @@ if(sound) playsound(location, sound, 60, TRUE) if(effect) - effect.attach(location) - effect.start() + effect.attach(location).start() /** * Attempts to find a "safe" floor turf within some given z-levels diff --git a/code/game/machinery/ai_slipper.dm b/code/game/machinery/ai_slipper.dm index 08cd5bdc61a..bca3a66c2a8 100644 --- a/code/game/machinery/ai_slipper.dm +++ b/code/game/machinery/ai_slipper.dm @@ -45,8 +45,7 @@ if(!COOLDOWN_FINISHED(src, foam_cooldown)) to_chat(user, span_warning("[src] cannot be activated for [DisplayTimeText(COOLDOWN_TIMELEFT(src, foam_cooldown))]!")) return - var/datum/effect_system/fluid_spread/foam/foam = new - foam.set_up(4, holder = src, location = loc) + var/datum/effect_system/fluid_spread/foam/foam = new(loc, 4, holder = src) foam.start() uses-- to_chat(user, span_notice("You activate [src]. It now has [uses] uses of foam remaining.")) diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 92e6c994305..58800d06398 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -518,9 +518,7 @@ return FALSE if(!prob(prb)) return FALSE - var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread - s.set_up(5, 1, src) - s.start() + do_sparks(5, TRUE, src) return electrocute_mob(user, get_area(src), src, 0.7, TRUE) /** diff --git a/code/game/machinery/computer/robot.dm b/code/game/machinery/computer/robot.dm index 228391e6bde..0111a5c71b2 100644 --- a/code/game/machinery/computer/robot.dm +++ b/code/game/machinery/computer/robot.dm @@ -155,9 +155,7 @@ var/turf/T = get_turf(drone) message_admins("[ADMIN_LOOKUPFLW(usr)] detonated [key_name_admin(drone)] at [ADMIN_VERBOSEJMP(T)]!") log_silicon("[key_name(usr)] detonated [key_name(drone)]!") - var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread - s.set_up(3, TRUE, drone) - s.start() + do_sparks(3, TRUE< drone) drone.visible_message(span_danger("\the [drone] self-destructs!")) drone.investigate_log("has been gibbed by a robotics console.", INVESTIGATE_DEATHS) drone.gib() diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 1951d84a775..2288eae191e 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -55,7 +55,7 @@ var/safe = TRUE ///whether the door is bolted or not. var/locked = FALSE - var/datum/effect_system/spark_spread/spark_system + var/datum/effect_system/basic/spark_spread/spark_system ///ignore this, just use explosion_block var/real_explosion_block ///if TRUE, this door will always open on red alert @@ -120,8 +120,7 @@ GLOB.elevator_doors += src else stack_trace("Elevator door [src] ([x],[y],[z]) has no linked elevator ID!") - spark_system = new /datum/effect_system/spark_spread - spark_system.set_up(2, 1, src) + spark_system = new(src, 2, TRUE) if(density) flags_1 |= PREVENT_CLICK_UNDER_1 else @@ -178,9 +177,7 @@ /obj/machinery/door/Destroy() if(elevator_mode) GLOB.elevator_doors -= src - if(spark_system) - qdel(spark_system) - spark_system = null + QDEL_NULL(spark_system) QDEL_NULL(filler) air_update_turf(TRUE, FALSE) return ..() diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm index 285b19b6c4b..35c967e0f28 100644 --- a/code/game/machinery/igniter.dm +++ b/code/game/machinery/igniter.dm @@ -151,7 +151,7 @@ var/id = null var/disable = 0 var/last_spark = 0 - var/datum/effect_system/spark_spread/spark_system + var/datum/effect_system/basic/spark_spread/spark_system MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/sparker, 26) @@ -160,8 +160,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/sparker, 26) /obj/machinery/sparker/Initialize(mapload) . = ..() - spark_system = new /datum/effect_system/spark_spread - spark_system.set_up(2, 1, src) + spark_system = new(2, TRUE, src) spark_system.attach(src) register_context() if(mapload) diff --git a/code/game/machinery/launch_pad.dm b/code/game/machinery/launch_pad.dm index e45daf7a98e..646d5288c51 100644 --- a/code/game/machinery/launch_pad.dm +++ b/code/game/machinery/launch_pad.dm @@ -184,9 +184,7 @@ if(!hidden) playsound(target, 'sound/items/weapons/flash.ogg', 25, TRUE) - var/datum/effect_system/spark_spread/quantum/spark_system = new /datum/effect_system/spark_spread/quantum() - spark_system.set_up(5, TRUE, target) - spark_system.start() + do_sparks(5, TRUE, target, spark_type = /datum/effect_system/basic/spark_spread/quantum) sleep(teleport_speed) diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index 23579cf31e7..cf9f42ee778 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -94,7 +94,7 @@ DEFINE_BITFIELD(turret_flags, list( /// Determines if our projectiles hit our faction var/ignore_faction = FALSE /// The spark system, used for generating... sparks? - var/datum/effect_system/spark_spread/spark_system + var/datum/effect_system/basic/spark_spread/spark_system /// The turret will try to shoot from a turf in that direction when in a wall var/wall_turret_direction /// If the turret is manually controlled @@ -124,11 +124,9 @@ DEFINE_BITFIELD(turret_flags, list( if(!base) base = src update_appearance() - //Sets up a spark system - spark_system = new /datum/effect_system/spark_spread - spark_system.set_up(5, 0, src) + // Sets up a spark system + spark_system = new(src, 5, FALSE) spark_system.attach(src) - tracker = new(src, scan_range) tracker.recalculate_field(full_recalc = TRUE) // manually call this so that our tracker var is set before we set anything up setup() diff --git a/code/game/machinery/quantum_pad.dm b/code/game/machinery/quantum_pad.dm index d09f2af6e7a..841f2099ca4 100644 --- a/code/game/machinery/quantum_pad.dm +++ b/code/game/machinery/quantum_pad.dm @@ -116,9 +116,7 @@ doteleport(user, target_pad) /obj/machinery/quantumpad/proc/sparks() - var/datum/effect_system/spark_spread/quantum/s = new /datum/effect_system/spark_spread/quantum - s.set_up(5, 1, get_turf(src)) - s.start() + do_sparks(5, TRUE, src, spark_type = /datum/effect_system/basic/spark_spread/quantum) /obj/machinery/quantumpad/attack_ghost(mob/dead/observer/ghost) . = ..() diff --git a/code/game/machinery/slotmachine.dm b/code/game/machinery/slotmachine.dm index ded188b82bd..7a965b2c42c 100644 --- a/code/game/machinery/slotmachine.dm +++ b/code/game/machinery/slotmachine.dm @@ -149,8 +149,7 @@ if(obj_flags & EMAGGED) return FALSE obj_flags |= EMAGGED - var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread() - spark_system.set_up(4, 0, src.loc) + var/datum/effect_system/basic/spark_spread/spark_system = new(src.loc, 4, 0) spark_system.start() playsound(src, SFX_SPARKS, 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) balloon_alert(user, "machine rigged") diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 64e4e735afd..72fb2659959 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -507,9 +507,7 @@ if(uv_super) visible_message(span_warning("[src]'s door creaks open with a loud whining noise. A cloud of foul black smoke escapes from its chamber.")) playsound(src, 'sound/machines/airlock/airlock_alien_prying.ogg', 50, TRUE) - var/datum/effect_system/fluid_spread/smoke/bad/black/smoke = new - smoke.set_up(0, holder = src, location = src) - smoke.start() + do_smoke(0, src, src, smoke_type = /datum/effect_system/fluid_spread/smoke/bad/black) QDEL_NULL(helmet) QDEL_NULL(suit) QDEL_NULL(mask) @@ -568,12 +566,11 @@ charge_cell(charge_per_item, cell, grid_only = TRUE) /obj/machinery/suit_storage_unit/proc/shock(mob/user, prb) - if(!prob(prb)) - var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread - s.set_up(5, 1, src) - s.start() - if(electrocute_mob(user, src, src, 1, TRUE)) - return 1 + if(prob(prb)) + return + do_sparks(5, TRUE, src) + if(electrocute_mob(user, src, src, 1, TRUE)) + return TRUE /obj/machinery/suit_storage_unit/relaymove(mob/living/user, direction) if(locked) diff --git a/code/game/machinery/telecomms/computers/message.dm b/code/game/machinery/telecomms/computers/message.dm index b822b0c4b69..20b77b00ee6 100644 --- a/code/game/machinery/telecomms/computers/message.dm +++ b/code/game/machinery/telecomms/computers/message.dm @@ -16,8 +16,6 @@ light_color = LIGHT_COLOR_GREEN /// Server linked to. var/obj/machinery/telecomms/message_server/linked_server = null - /// Sparks effect - For emag - var/datum/effect_system/spark_spread/spark_system /// Computer properties. /// 0 = Main menu, 1 = Message Logs, 2 = Hacked screen, 3 = Custom Message var/screen = MSG_MON_SCREEN_MAIN @@ -34,7 +32,6 @@ /obj/machinery/computer/message_monitor/Initialize(mapload) ..() - spark_system = new return INITIALIZE_HINT_LATELOAD /obj/machinery/computer/message_monitor/post_machine_initialize() @@ -69,22 +66,21 @@ /obj/machinery/computer/message_monitor/emag_act(mob/user, obj/item/card/emag/emag_card) if(obj_flags & EMAGGED) return FALSE - if(!isnull(linked_server)) - obj_flags |= EMAGGED - screen = MSG_MON_SCREEN_HACKED - spark_system.set_up(5, 0, src) - spark_system.start() - var/obj/item/paper/monitorkey/monitor_key_paper = new(loc, linked_server) - // Will help make emagging the console not so easy to get away with. - monitor_key_paper.add_raw_text("

£%@%(*$%&(£&?*(%&£/{}") - var/time = 100 * length(linked_server.decryptkey) - addtimer(CALLBACK(src, PROC_REF(unemag_console)), time) - error_message = "%$&(£: Critical %$$@ Error // !RestArting! - ?pLeaSe wAit!" - linked_server.toggled = FALSE - return TRUE - else + if(isnull(linked_server)) to_chat(user, span_notice("A no server error appears on the screen.")) - return FALSE + return FALSE + + obj_flags |= EMAGGED + screen = MSG_MON_SCREEN_HACKED + do_sparks(5, FALSE, src) + var/obj/item/paper/monitorkey/monitor_key_paper = new(loc, linked_server) + // Will help make emagging the console not so easy to get away with. + monitor_key_paper.add_raw_text("

£%@%(*$%&(£&?*(%&£/{}") + var/time = 100 * length(linked_server.decryptkey) + addtimer(CALLBACK(src, PROC_REF(unemag_console)), time) + error_message = "%$&(£: Critical %$$@ Error // !RestArting! - ?pLeaSe wAit!" + linked_server.toggled = FALSE + return TRUE /// Remove the emag effect from the console /obj/machinery/computer/message_monitor/proc/unemag_console() diff --git a/code/game/objects/effects/decals/cleanable/robots.dm b/code/game/objects/effects/decals/cleanable/robots.dm index 85bce021f47..c3c6f9119ef 100644 --- a/code/game/objects/effects/decals/cleanable/robots.dm +++ b/code/game/objects/effects/decals/cleanable/robots.dm @@ -20,9 +20,7 @@ if (prob(40)) new /obj/effect/decal/cleanable/blood/splatter(loc, null, GET_ATOM_BLOOD_DNA(src)) else if (prob(10)) - var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread - s.set_up(3, 1, src) - s.start() + do_sparks(3, TRUE, src) // Doesn't have overlay support as of now /obj/effect/decal/cleanable/blood/gibs/robot_debris/update_blood_color() diff --git a/code/game/objects/effects/decals/remains.dm b/code/game/objects/effects/decals/remains.dm index 16254e9610c..c3bf2d97aa3 100644 --- a/code/game/objects/effects/decals/remains.dm +++ b/code/game/objects/effects/decals/remains.dm @@ -49,11 +49,7 @@ ///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!")) - var/datum/effect_system/fluid_spread/smoke/chem/cigarette_puff = new() - cigarette_puff.chemholder.add_reagent(that_shit_that_killed_saddam, 15) - cigarette_puff.attach(get_turf(src)) - cigarette_puff.set_up(range = 2, amount = DIAMOND_AREA(2), holder = src, location = get_turf(src), silent = TRUE) - cigarette_puff.start() + 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 diff --git a/code/game/objects/effects/effect_system/effect_system.dm b/code/game/objects/effects/effect_system/effect_system.dm index 73ffc52a2bd..cbaa286f068 100644 --- a/code/game/objects/effects/effect_system/effect_system.dm +++ b/code/game/objects/effects/effect_system/effect_system.dm @@ -1,10 +1,12 @@ -/* This is an attempt to make some easily reusable "particle" type effect, to stop the code -constantly having to be rewritten. An item like the jetpack that uses the ion_trail_follow system, just has one -defined, then set up when it is created with New(). Then this same system can just be reused each time -it needs to create more trails.A beaker could have a steam_trail_follow system set up, then the steam -would spawn and follow the beaker, even if it is carried or thrown. +/* + * This is an attempt to make some easily reusable "particle" type effect, to stop the code + * constantly having to be rewritten. An item like the jetpack that uses the ion_trail_follow system, just has one + * defined, then set up when it is created with New(). Then this same system can just be reused each time + * it needs to create more trails.A beaker could have a steam_trail_follow system set up, then the steam + * would spawn and follow the beaker, even if it is carried or thrown. */ +#define PER_SYSTEM_PARTICLE_CAP 20 /obj/effect/particle_effect name = "particle effect" @@ -17,36 +19,61 @@ would spawn and follow the beaker, even if it is carried or thrown. return TRUE /datum/effect_system - var/number = 3 - var/cardinals_only = FALSE - var/turf/location - var/atom/holder - var/effect_type - var/total_effects = 0 - var/autocleanup = FALSE //will delete itself after use + // Does not contain any behaviors and should not be used by itself + abstract_type = /datum/effect_system + /// Turf on which to spawn the effects + var/turf/location = null + /// Atom that is spawning the particles whose location we're following + var/atom/holder = null + +/datum/effect_system/New(turf/location) + . = ..() + src.location = get_turf(location) /datum/effect_system/Destroy() holder = null location = null return ..() -/datum/effect_system/proc/set_up(number = 3, cardinals_only = FALSE, location) - src.number = min(number, 10) - src.cardinals_only = cardinals_only - src.location = get_turf(location) - -/datum/effect_system/proc/attach(atom/atom) - holder = atom +/// Instruct the effect system to start following an atom. Can be chained into .start() +/datum/effect_system/proc/attach(atom/new_holder) + RETURN_TYPE(/datum/effect_system) + holder = new_holder + return src +/// Start the effect system /datum/effect_system/proc/start() + return + +/// Basic effect system which spawns a certain number of moving effects +/datum/effect_system/basic + /// Total number of particles to spawn + var/amount = 3 + /// Should we pick among cardinals or all directions when deciding where the particle should move + var/cardinals_only = FALSE + /// Typepath of the effect to spawn + var/effect_type = null + /// Total amount of effects we currently have active + var/total_effects = 0 + /// Should the system delete itself after finishing? + var/autocleanup = FALSE + +/datum/effect_system/basic/New(turf/location, amount = null, cardinals_only = null) + . = ..() + if (!isnull(amount)) + src.amount = amount + if (!isnull(cardinals_only)) + src.cardinals_only = cardinals_only + +/datum/effect_system/basic/start() if(QDELETED(src)) return - for(var/i in 1 to number) - if(total_effects > 20) + for(var/i in 1 to amount) + if(total_effects > PER_SYSTEM_PARTICLE_CAP) return generate_effect() -/datum/effect_system/proc/generate_effect() +/datum/effect_system/basic/proc/generate_effect() if(holder) location = get_turf(holder) var/obj/effect/effect = new effect_type(location) @@ -56,15 +83,17 @@ would spawn and follow the beaker, even if it is carried or thrown. direction = pick(GLOB.cardinals) else direction = pick(GLOB.alldirs) - var/step_amt = pick(1,2,3) + + var/step_amt = rand(1, 3) var/step_delay = 5 - var/datum/move_loop/loop = GLOB.move_manager.move(effect, direction, step_delay, timeout = step_delay * step_amt, priority = MOVEMENT_ABOVE_SPACE_PRIORITY) - RegisterSignal(loop, COMSIG_QDELETING, PROC_REF(decrement_total_effect)) + if (autocleanup) + RegisterSignal(loop, COMSIG_QDELETING, PROC_REF(decrement_total_effect)) -/datum/effect_system/proc/decrement_total_effect(datum/source) +/datum/effect_system/basic/proc/decrement_total_effect(datum/source) SIGNAL_HANDLER total_effects-- - if(!autocleanup || total_effects > 0) - return - QDEL_IN(src, 2 SECONDS) + if(total_effects == 0) + QDEL_IN(src, 2 SECONDS) + +#undef PER_SYSTEM_PARTICLE_CAP diff --git a/code/game/objects/effects/effect_system/effects_explosion.dm b/code/game/objects/effects/effect_system/effects_explosion.dm index a8a3431ef9c..9f4db05d967 100644 --- a/code/game/objects/effects/effect_system/effects_explosion.dm +++ b/code/game/objects/effects/effect_system/effects_explosion.dm @@ -9,23 +9,20 @@ return INITIALIZE_HINT_LATELOAD /obj/effect/particle_effect/expl_particles/LateInitialize() - var/step_amt = pick(25;1,50;2,100;3,200;4) - + var/step_amt = pick(25;1, 50;2, 100;3, 200;4) var/datum/move_loop/loop = GLOB.move_manager.move(src, pick(GLOB.alldirs), 1, timeout = step_amt, priority = MOVEMENT_ABOVE_SPACE_PRIORITY) RegisterSignal(loop, COMSIG_QDELETING, PROC_REF(end_particle)) /obj/effect/particle_effect/expl_particles/proc/end_particle(datum/source) SIGNAL_HANDLER - if(QDELETED(src)) - return - qdel(src) + if (!QDELETED(src)) + qdel(src) -/datum/effect_system/expl_particles - number = 10 +/datum/effect_system/basic/expl_particles + amount = 10 -/datum/effect_system/expl_particles/start() - for(var/i in 1 to number) - new /obj/effect/particle_effect/expl_particles(location) +/datum/effect_system/basic/expl_particles/generate_effect() + new /obj/effect/particle_effect/expl_particles(location) /obj/effect/explosion name = "fire" @@ -45,21 +42,16 @@ /datum/effect_system/explosion -/datum/effect_system/explosion/set_up(location) - src.location = get_turf(location) - /datum/effect_system/explosion/start() - new/obj/effect/explosion( location ) - var/datum/effect_system/expl_particles/P = new/datum/effect_system/expl_particles() - P.set_up(10, 0, location) - P.start() + new /obj/effect/explosion(location) + var/datum/effect_system/basic/expl_particles/boom_particles = new(location) + boom_particles.start() /datum/effect_system/explosion/smoke /datum/effect_system/explosion/smoke/proc/create_smoke() - var/datum/effect_system/fluid_spread/smoke/S = new - S.set_up(2, holder = holder, location = location) - S.start() + var/datum/effect_system/fluid_spread/smoke/smoke_system = new(location, range = 2) + smoke_system.attach(holder).start() /datum/effect_system/explosion/smoke/start() ..() diff --git a/code/game/objects/effects/effect_system/effects_other.dm b/code/game/objects/effects/effect_system/effects_other.dm deleted file mode 100644 index c47f4684283..00000000000 --- a/code/game/objects/effects/effect_system/effects_other.dm +++ /dev/null @@ -1,113 +0,0 @@ - -///////////////////////////////////////////// -//////// Attach a trail to any object, that spawns when it moves (like for the jetpack) -/// just pass in the object to attach it to in set_up -/// Then do start() to start it and stop() to stop it, obviously -/// and don't call start() in a loop that will be repeated otherwise it'll get spammed! -///////////////////////////////////////////// - -/datum/effect_system/trail_follow - var/turf/oldposition - var/active = FALSE - var/allow_overlap = FALSE - var/auto_process = TRUE - var/qdel_in_time = 10 - var/fadetype = "ion_fade" - var/fade = TRUE - var/nograv_required = FALSE - -/datum/effect_system/trail_follow/set_up(atom/atom) - attach(atom) - oldposition = get_turf(atom) - -/datum/effect_system/trail_follow/Destroy() - oldposition = null - stop() - return ..() - -/datum/effect_system/trail_follow/proc/stop() - oldposition = null - STOP_PROCESSING(SSfastprocess, src) - active = FALSE - return TRUE - -/datum/effect_system/trail_follow/start() - oldposition = get_turf(holder) - if(!check_conditions()) - return FALSE - if(auto_process) - START_PROCESSING(SSfastprocess, src) - active = TRUE - return TRUE - -/datum/effect_system/trail_follow/process() - generate_effect() - -/datum/effect_system/trail_follow/generate_effect() - if(!check_conditions()) - return stop() - if(oldposition && !(oldposition == get_turf(holder))) - if(!oldposition.has_gravity() || !nograv_required) - var/obj/effect/E = new effect_type(oldposition) - set_dir(E) - if(fade) - flick(fadetype, E) - E.icon_state = "" - if(qdel_in_time) - QDEL_IN(E, qdel_in_time) - oldposition = get_turf(holder) - -/datum/effect_system/trail_follow/proc/check_conditions() - if(!get_turf(holder)) - return FALSE - return TRUE - -/datum/effect_system/trail_follow/steam - effect_type = /obj/effect/particle_effect/steam - -/obj/effect/particle_effect/ion_trails - name = "ion trails" - icon_state = "ion_trails" - anchored = TRUE - -/obj/effect/particle_effect/ion_trails/flight - icon_state = "ion_trails_flight" - -/datum/effect_system/trail_follow/ion - effect_type = /obj/effect/particle_effect/ion_trails - nograv_required = TRUE - qdel_in_time = 20 - -/datum/effect_system/trail_follow/proc/set_dir(obj/effect/particle_effect/ion_trails/I) - I.setDir(holder.dir) - -/datum/effect_system/trail_follow/ion/grav_allowed - nograv_required = FALSE - -//Reagent-based explosion effect - -/datum/effect_system/reagents_explosion - var/amount // TNT equivalent - var/flashing_factor = null // factor of how powerful the flash effect relatively to the explosion - var/flaming_factor = null // factor of how powerful the flame effect is relatively to explosion - var/explosion_message = 1 //whether we show a message to mobs. - -/datum/effect_system/reagents_explosion/set_up(amt, loca, flash_fact = null, flame_fact = null, message = TRUE) - amount = amt - explosion_message = message - if(isturf(loca)) - location = loca - else - location = get_turf(loca) - flashing_factor = flash_fact - flaming_factor = flame_fact - -/// Starts the explosion. The explosion_source is as part of logging and identifying the source of the explosion for logs. -/datum/effect_system/reagents_explosion/start(atom/explosion_source = null) - if(!explosion_source) - stack_trace("Reagent explosion triggered without a source atom. This explosion may have incomplete logging.") - - if(explosion_message) - location.visible_message(span_danger("The solution violently explodes!"), span_hear("You hear an explosion!")) - - dyn_explosion(location, amount, flash_range = flashing_factor, flame_range = flaming_factor, explosion_cause = explosion_source) diff --git a/code/game/objects/effects/effect_system/effects_reagents_explosion.dm b/code/game/objects/effects/effect_system/effects_reagents_explosion.dm new file mode 100644 index 00000000000..41a0292d8b1 --- /dev/null +++ b/code/game/objects/effects/effect_system/effects_reagents_explosion.dm @@ -0,0 +1,30 @@ + + +//Reagent-based explosion effect + +/datum/effect_system/reagents_explosion + /// Explosive power + var/amount + /// Factor of how powerful the flash effect relatively to the explosion + var/flashing_factor = null + /// Factor of how powerful the flame effect is relatively to explosion + var/flaming_factor = null + /// Whether we show a message to mobs. + var/explosion_message = 1 + +/datum/effect_system/reagents_explosion/New(turf/location, amount, flash_fact = null, flame_fact = null, message = TRUE) + . = ..() + src.amount = amount + explosion_message = message + if (!isturf(location)) + location = get_turf(location) + flashing_factor = flash_fact + flaming_factor = flame_fact + +/// Starts the explosion. The explosion_source is as part of logging and identifying the source of the explosion for logs. +/datum/effect_system/reagents_explosion/start(atom/explosion_source = null) + if(!explosion_source) + stack_trace("Reagent explosion triggered without a source atom. This explosion may have incomplete logging.") + if(explosion_message) + location.visible_message(span_danger("The solution violently explodes!"), span_hear("You hear an explosion!")) + dyn_explosion(location, amount, flash_range = flashing_factor, flame_range = flaming_factor, explosion_cause = explosion_source) diff --git a/code/game/objects/effects/effect_system/effects_sparks.dm b/code/game/objects/effects/effect_system/effects_sparks.dm index feab1149c48..8a40659a003 100644 --- a/code/game/objects/effects/effect_system/effects_sparks.dm +++ b/code/game/objects/effects/effect_system/effects_sparks.dm @@ -5,13 +5,13 @@ // will always spawn at the items location. ///////////////////////////////////////////// -/proc/do_sparks(number, cardinal_only, datum/source) - var/datum/effect_system/spark_spread/sparks = new - sparks.set_up(number, cardinal_only, source) +/proc/do_sparks(number, cardinal_only, atom/source, atom/holder = null, spark_type = /datum/effect_system/basic/spark_spread) + var/datum/effect_system/basic/spark_spread/sparks = new spark_type(get_turf(source), number, cardinal_only) + if (holder) + sparks.attach(holder) sparks.autocleanup = TRUE sparks.start() - /obj/effect/particle_effect/sparks name = "sparks" icon_state = "sparks" @@ -32,7 +32,7 @@ var/turf/location = loc if(isturf(location)) affect_location(location, just_initialized = TRUE) - QDEL_IN(src, 20) + QDEL_IN(src, 2 SECONDS) /obj/effect/particle_effect/sparks/Destroy() var/turf/location = loc @@ -41,11 +41,15 @@ return ..() /obj/effect/particle_effect/sparks/Move() - ..() + . = ..() var/turf/location = loc if(isturf(location)) affect_location(location) +/obj/effect/particle_effect/sparks/quantum + name = "quantum sparks" + icon_state = "quantum_sparks" + /* * Apply the effects of this spark to its location. * @@ -56,7 +60,7 @@ * just_initialized - If the spark is just being created, and we need to manually affect everything in the location */ /obj/effect/particle_effect/sparks/proc/affect_location(turf/location, just_initialized = FALSE) - location.hotspot_expose(1000,100) + location.hotspot_expose(1000, 100) SEND_SIGNAL(location, COMSIG_ATOM_TOUCHED_SPARKS, src) // for plasma floors; other floor types only have to worry about the mysterious HAZARDOUS sparks if(just_initialized) for(var/atom/movable/singed in location) @@ -79,27 +83,23 @@ if(reagents && !(reagents.flags & SEALED_CONTAINER)) reagents.expose_temperature(1000) // we set this at 1000 because that's the max reagent temp for a chem heater, higher temps require more than sparks return + if(ishuman(singed)) var/mob/living/carbon/human/singed_human = singed for(var/obj/item/anything in singed_human.get_visible_items()) sparks_touched(src, anything) -/datum/effect_system/spark_spread +/datum/effect_system/basic/spark_spread effect_type = /obj/effect/particle_effect/sparks -/datum/effect_system/spark_spread/quantum +/datum/effect_system/basic/spark_spread/quantum effect_type = /obj/effect/particle_effect/sparks/quantum - //electricity /obj/effect/particle_effect/sparks/electricity name = "lightning" icon_state = "electricity" -/obj/effect/particle_effect/sparks/quantum - name = "quantum sparks" - icon_state = "quantum_sparks" - -/datum/effect_system/lightning_spread +/datum/effect_system/basic/lightning_spread effect_type = /obj/effect/particle_effect/sparks/electricity diff --git a/code/game/objects/effects/effect_system/effects_trail.dm b/code/game/objects/effects/effect_system/effects_trail.dm new file mode 100644 index 00000000000..fa0e688fe92 --- /dev/null +++ b/code/game/objects/effects/effect_system/effects_trail.dm @@ -0,0 +1,103 @@ + +///////////////////////////////////////////// +//////// Attach a trail to any object, that spawns when it moves (like for the jetpack) +/// just pass in the object to attach it to in set_up +/// Then do start() to start it and stop() to stop it, obviously +/// and don't call start() in a loop that will be repeated otherwise it'll get spammed! +///////////////////////////////////////////// + +/datum/effect_system/trail_follow + /// Previous position of the atom we're tracking + var/turf/oldposition + /// Are we currently spawning particles? + var/active = FALSE + /// Can the particles be spawned ontop of eachother? + var/allow_overlap = FALSE + /// Should we automatically start processing ourselves? + var/auto_process = TRUE + /// Delay before we delete the particles + var/qdel_in_time = 1 SECONDS + /// Typepath we should spawn + var/effect_type = null + /// Should we flick an icon state and blank out the particles afterwards? + var/fade = TRUE + /// icon_state to flick on our particles + var/fadetype = "ion_fade" + /// Are we restricted to zero-g only? + var/nograv_required = FALSE + +/datum/effect_system/trail_follow/New(turf/location) + . = ..() + attach(location) + oldposition = location + +/datum/effect_system/trail_follow/Destroy() + oldposition = null + stop() + return ..() + +/datum/effect_system/trail_follow/proc/stop() + oldposition = null + STOP_PROCESSING(SSfastprocess, src) + active = FALSE + return TRUE + +/datum/effect_system/trail_follow/start() + oldposition = get_turf(holder) + if(!check_conditions()) + return FALSE + if(auto_process) + START_PROCESSING(SSfastprocess, src) + active = TRUE + return TRUE + +/datum/effect_system/trail_follow/process() + generate_effect() + +/datum/effect_system/trail_follow/proc/generate_effect() + if(!check_conditions()) + return stop() + + if(!oldposition || oldposition == get_turf(holder)) + oldposition = get_turf(holder) + return + + if(nograv_required && oldposition.has_gravity()) + oldposition = get_turf(holder) + return + + var/obj/effect/particle = new effect_type(oldposition) + set_dir(particle) + if(fade) + flick(fadetype, particle) + particle.icon_state = "" + + if(qdel_in_time) + QDEL_IN(particle, qdel_in_time) + +/datum/effect_system/trail_follow/proc/check_conditions() + if(!get_turf(holder)) + return FALSE + return TRUE + +/datum/effect_system/trail_follow/proc/set_dir(obj/effect/effect) + effect.setDir(holder.dir) + +/datum/effect_system/trail_follow/steam + effect_type = /obj/effect/particle_effect/steam + +/obj/effect/particle_effect/ion_trails + name = "ion trails" + icon_state = "ion_trails" + anchored = TRUE + +/obj/effect/particle_effect/ion_trails/flight + icon_state = "ion_trails_flight" + +/datum/effect_system/trail_follow/ion + effect_type = /obj/effect/particle_effect/ion_trails + nograv_required = TRUE + qdel_in_time = 2 SECONDS + +/datum/effect_system/trail_follow/ion/grav_allowed + nograv_required = FALSE diff --git a/code/game/objects/effects/effect_system/effects_water.dm b/code/game/objects/effects/effect_system/effects_water.dm index f94e5d0e31c..f8f62c13b1b 100644 --- a/code/game/objects/effects/effect_system/effects_water.dm +++ b/code/game/objects/effects/effect_system/effects_water.dm @@ -4,15 +4,17 @@ name = "water" icon_state = "extinguish" pass_flags = PASSTABLE | PASSMACHINE | PASSSTRUCTURE | PASSGRILLE | PASSBLOB | PASSVEHICLE - var/life = 15 mouse_opacity = MOUSE_OPACITY_TRANSPARENT + /// Amount of turfs we pass before deleting ourselves + var/life = 15 /obj/effect/particle_effect/water/Initialize(mapload) . = ..() - QDEL_IN(src, 70) + QDEL_IN(src, 7 SECONDS) /obj/effect/particle_effect/water/Move(turf/newloc) - if (--src.life < 1) + life -= 1 + if (life <= 0) qdel(src) return FALSE return ..() @@ -20,8 +22,7 @@ /obj/effect/particle_effect/water/Bump(atom/A) if(reagents) reagents.expose(A) - if(A.reagents) - A.reagents.expose_temperature(-25) + A.reagents?.expose_temperature(reagents.chem_temp) return ..() ///Extinguisher snowflake @@ -71,17 +72,11 @@ ///////////////////////////////////////////// // GENERIC STEAM SPREAD SYSTEM -//Usage: set_up(number of bits of steam, use North/South/East/West only, spawn location) +// Usage: set_up(number of bits of steam, use North/South/East/West only, spawn location) // The attach(atom/atom) proc is optional, and can be called to attach the effect // to something, like a smoking beaker, so then you can just call start() and the steam // will always spawn at the items location, even if it's moved. -/* Example: - *var/datum/effect_system/steam_spread/steam = new /datum/effect_system/steam_spread() -- creates new system - *steam.set_up(5, 0, mob.loc) -- sets up variables - *OPTIONAL: steam.attach(mob) - *steam.start() -- spawns the effect -*/ ///////////////////////////////////////////// /obj/effect/particle_effect/steam name = "steam" @@ -90,11 +85,7 @@ /obj/effect/particle_effect/steam/Initialize(mapload) . = ..() - QDEL_IN(src, 20) + QDEL_IN(src, 2 SECONDS) -/datum/effect_system/steam_spread +/datum/effect_system/basic/steam_spread effect_type = /obj/effect/particle_effect/steam - -/obj/effect/particle_effect/water/Bump(atom/A) - if(A.reagents && reagents) - A.reagents.expose_temperature(reagents.chem_temp) diff --git a/code/game/objects/effects/effect_system/fluid_spread/_fluid_spread.dm b/code/game/objects/effects/effect_system/fluid_spread/_fluid_spread.dm index a55f7caf5ac..9a4fb9f1f78 100644 --- a/code/game/objects/effects/effect_system/fluid_spread/_fluid_spread.dm +++ b/code/game/objects/effects/effect_system/fluid_spread/_fluid_spread.dm @@ -115,13 +115,16 @@ * A factory which produces fluid groups. */ /datum/effect_system/fluid_spread - effect_type = /obj/effect/particle_effect/fluid - /// The amount of smoke to produce. + /// The amount of fluid to produce. var/amount = 10 + /// Type of the effect we're spawning + var/effect_type = /obj/effect/particle_effect/fluid -/datum/effect_system/fluid_spread/set_up(range = 1, amount = DIAMOND_AREA(range), atom/holder, atom/location, ...) - src.holder = holder - src.location = location +/datum/effect_system/fluid_spread/New(turf/location, range = 1, amount = null, atom/holder = null) + . = ..() + attach(holder) + if (isnull(amount)) + amount = DIAMOND_AREA(range) src.amount = amount /datum/effect_system/fluid_spread/start(log = FALSE) @@ -144,7 +147,6 @@ var/blame_msg if (holder) holder.transfer_fingerprints_to(flood) // This is important. If this doesn't exist thermobarics are annoying to adjudicate. - source_msg = "from inside of [ismob(holder) ? ADMIN_LOOKUPFLW(holder) : ADMIN_VERBOSEJMP(holder)]" var/lastkey = holder.fingerprintslast if (lastkey) diff --git a/code/game/objects/effects/effect_system/fluid_spread/effects_foam.dm b/code/game/objects/effects/effect_system/fluid_spread/effects_foam.dm index 0f96caf617e..736be058ee4 100644 --- a/code/game/objects/effects/effect_system/fluid_spread/effects_foam.dm +++ b/code/game/objects/effects/effect_system/fluid_spread/effects_foam.dm @@ -178,31 +178,59 @@ if(prob(max(0, exposed_temperature - 475))) //foam dissolves when heated kill_foam() +/// Proc to quickly spawn foam +/// reagent_type can accept a list of reagents, optionally as a key-value pair with values overriding reagent_volume if not null +/proc/do_foam(range = 1, atom/holder = null, turf/location = null, datum/reagent/reagent_type = null, reagent_volume = 10, datum/reagents/carry = null, amount = null, log = FALSE, datum/effect_system/fluid_spread/foam/foam_type = /datum/effect_system/fluid_spread/foam, result_type = null, stop_reactions = FALSE, reagent_scale = FOAM_REAGENT_SCALE) + if (carry || isnull(reagent_type)) + var/datum/effect_system/fluid_spread/foam/foam = new foam_type(location, range, amount, holder || location, carry, result_type, stop_reactions, reagent_scale) + foam.start(log = log) + return + + if (ispath(reagent_type, /datum/reagent)) + var/datum/reagents/foam_reagents = new /datum/reagents(reagent_volume) + foam_reagents.add_reagent(reagent_type, reagent_volume) + var/datum/effect_system/fluid_spread/foam/foam = new foam_type(location, range, amount, holder || location, foam_reagents, result_type, stop_reactions, reagent_scale) + foam.start(log = log) + return + + + if (!islist(reagent_type)) + CRASH("do_foam passed a non-reagent path, non-list reagent_type [reagent_type]!") + + var/list/reagent_list = reagent_type + var/chem_volume = 0 + for (var/chem_type in reagent_list) + chem_volume += reagent_list[chem_type] || reagent_volume + + var/datum/reagents/foam_reagents = new /datum/reagents(chem_volume) + for (var/chem_type in reagent_list) + foam_reagents.add_reagent(chem_type, reagent_list[chem_type] || reagent_volume) + + var/datum/effect_system/fluid_spread/foam/foam = new foam_type(location, range, amount, holder || location, foam_reagents, result_type, stop_reactions, reagent_scale) + foam.start(log = log) + /// A factory for foam fluid floods. /datum/effect_system/fluid_spread/foam effect_type = /obj/effect/particle_effect/fluid/foam /// A container for all of the chemicals we distribute through the foam. - var/datum/reagents/chemholder - /// The amount that + var/datum/reagents/chemholder = null + /// The amount that we multiply the payload by var/reagent_scale = FOAM_REAGENT_SCALE /// What type of thing the foam should leave behind when it dissipates. var/atom/movable/result_type = null - -/datum/effect_system/fluid_spread/foam/New() - ..() +/datum/effect_system/fluid_spread/foam/New(turf/location, range = 1, amount = null, atom/holder = null, datum/reagents/carry = null, result_type = null, stop_reactions = FALSE, reagent_scale = FOAM_REAGENT_SCALE) + . = ..() chemholder = new(1000, NO_REACT) + carry?.trans_to(chemholder, carry.total_volume, no_react = stop_reactions, copy_only = TRUE) + if(!isnull(result_type)) + src.result_type = result_type + src.reagent_scale = reagent_scale /datum/effect_system/fluid_spread/foam/Destroy() QDEL_NULL(chemholder) return ..() -/datum/effect_system/fluid_spread/foam/set_up(range = 1, amount = DIAMOND_AREA(range), atom/holder, atom/location = null, datum/reagents/carry = null, result_type = null, stop_reactions = FALSE) - . = ..() - carry?.trans_to(chemholder, carry.total_volume, no_react = stop_reactions, copy_only = TRUE) - if(!isnull(result_type)) - src.result_type = result_type - /datum/effect_system/fluid_spread/foam/start(log = FALSE) var/obj/effect/particle_effect/fluid/foam/foam = new effect_type(location, new /datum/fluid_group(amount)) var/foamcolor = mix_color_from_reagents(chemholder.reagent_list) @@ -235,7 +263,6 @@ effect_type = /obj/effect/particle_effect/fluid/foam/long_life reagent_scale = FOAM_REAGENT_SCALE * (30 / 8) - // Firefighting foam /// A variant of foam which absorbs plasma in the air if there is a fire. /obj/effect/particle_effect/fluid/foam/firefighting @@ -468,9 +495,7 @@ /obj/effect/spawner/foam_starter/Initialize(mapload) . = ..() - - var/datum/effect_system/fluid_spread/foam/foam = new foam_type() - foam.set_up(foam_size, holder = src, location = loc) + var/datum/effect_system/fluid_spread/foam/foam = new foam_type(loc, foam_size, holder = src) foam.start() /obj/effect/spawner/foam_starter/small diff --git a/code/game/objects/effects/effect_system/fluid_spread/effects_smoke.dm b/code/game/objects/effects/effect_system/fluid_spread/effects_smoke.dm index 83ef6e55293..be62c9a97f8 100644 --- a/code/game/objects/effects/effect_system/fluid_spread/effects_smoke.dm +++ b/code/game/objects/effects/effect_system/fluid_spread/effects_smoke.dm @@ -165,12 +165,13 @@ * - range: The amount of smoke to produce as number of steps from origin covered. * - amount: The amount of smoke to produce as the total desired coverage area. Autofilled from the range arg if not set. * - location: Where to produce the smoke cloud. - * - smoke_type: The smoke typepath to spawn. + * - smoke_type - Typepath for the effect system to use + * - effect_type: The smoke typepath to spawn. + * - log: Should the system log the smoke spawned? */ -/proc/do_smoke(range = 0, amount = DIAMOND_AREA(range), atom/holder = null, location = null, smoke_type = /obj/effect/particle_effect/fluid/smoke, log = FALSE) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.effect_type = smoke_type - smoke.set_up(amount = amount, holder = holder, location = location) +/proc/do_smoke(range = 0, atom/holder = null, location = null, amount = null, smoke_type = /datum/effect_system/fluid_spread/smoke, effect_type = /obj/effect/particle_effect/fluid/smoke, log = FALSE) + var/datum/effect_system/fluid_spread/smoke/smoke = new smoke_type(location, range, amount, holder) + smoke.effect_type = effect_type smoke.start(log = log) ///////////////////////////////////////////// @@ -205,7 +206,6 @@ . = ..() if(!.) return - smoker.drop_all_held_items() smoker.adjust_oxy_loss(1) smoker.emote("cough") @@ -275,6 +275,10 @@ /// Whether to make sure each affected turf is actually within range before cooling it. var/distcheck = TRUE +/datum/effect_system/fluid_spread/smoke/freezing/New(turf/location, range = 1, amount = null, atom/holder = null, blast_radius = 0) + . = ..() + blast = blast_radius + /** * Chills an open turf. * @@ -286,7 +290,7 @@ * Arguments: * - [chilly][/turf/open]: The open turf to chill */ -/datum/effect_system/fluid_spread/smoke/freezing/proc/Chilled(turf/open/chilly) +/datum/effect_system/fluid_spread/smoke/freezing/proc/chill_turf(turf/open/chilly) if(!istype(chilly)) return @@ -319,14 +323,10 @@ for(var/obj/item/potential_tinder in chilly) potential_tinder.extinguish() -/datum/effect_system/fluid_spread/smoke/freezing/set_up(range = 5, amount = DIAMOND_AREA(range), atom/holder, atom/location, blast_radius = 0) - . = ..() - blast = blast_radius - /datum/effect_system/fluid_spread/smoke/freezing/start(log = FALSE) if(blast) for(var/turf/T in RANGE_TURFS(blast, location)) - Chilled(T) + chill_turf(T) return ..() /// A variant of the base freezing smoke formerly used by the vent decontamination event. @@ -398,13 +398,33 @@ return TRUE /// Helper to quickly create a cloud of reagent smoke -/proc/do_chem_smoke(range = 0, amount = DIAMOND_AREA(range), atom/holder = null, location = null, reagent_type = /datum/reagent/water, reagent_volume = 10, log = FALSE, datum/effect_system/fluid_spread/smoke/chem/smoke_type = /datum/effect_system/fluid_spread/smoke/chem) - var/datum/reagents/smoke_reagents = new/datum/reagents(reagent_volume) - smoke_reagents.add_reagent(reagent_type, reagent_volume) +/// reagent_type can accept a list of reagents, optionally as a key-value pair with values overriding reagent_volume if not null +/proc/do_chem_smoke(range = 0, atom/holder = null, location = null, reagent_type = /datum/reagent/water, reagent_volume = 10, datum/reagents/carry = null, carry_limit = null, log = FALSE, amount = null, datum/effect_system/fluid_spread/smoke/chem/smoke_type = /datum/effect_system/fluid_spread/smoke/chem, silent = TRUE) + if (carry) + var/datum/effect_system/fluid_spread/smoke/chem/smoke = new smoke_type(location, range, amount, holder || location, carry, carry_limit, silent) + smoke.start(log = log) + return - var/datum/effect_system/fluid_spread/smoke/chem/smoke = new smoke_type - smoke.attach(location) - smoke.set_up(amount = amount, holder = holder, location = location, carry = smoke_reagents, silent = TRUE) + if (ispath(reagent_type, /datum/reagent)) + var/datum/reagents/smoke_reagents = new /datum/reagents(reagent_volume) + smoke_reagents.add_reagent(reagent_type, reagent_volume) + var/datum/effect_system/fluid_spread/smoke/chem/smoke = new smoke_type(location, range, amount, holder || location, smoke_reagents, carry_limit, silent) + smoke.start(log = log) + return + + if (!islist(reagent_type)) + CRASH("do_chem_smoke passed a non-reagent path, non-list reagent_type [reagent_type]!") + + var/list/reagent_list = reagent_type + var/chem_volume = 0 + for (var/chem_type in reagent_list) + chem_volume += reagent_list[chem_type] || reagent_volume + + var/datum/reagents/smoke_reagents = new /datum/reagents(chem_volume) + for (var/chem_type in reagent_list) + smoke_reagents.add_reagent(chem_type, reagent_list[chem_type] || reagent_volume) + + var/datum/effect_system/fluid_spread/smoke/chem/smoke = new smoke_type(location, range, amount, holder || location, smoke_reagents, carry_limit, silent) smoke.start(log = log) /// A factory which produces clouds of chemical bearing smoke. @@ -413,18 +433,10 @@ var/datum/reagents/chemholder effect_type = /obj/effect/particle_effect/fluid/smoke/chem -/datum/effect_system/fluid_spread/smoke/chem/New() - ..() - chemholder = new(1000, NO_REACT) - -/datum/effect_system/fluid_spread/smoke/chem/Destroy() - QDEL_NULL(chemholder) - return ..() - - -/datum/effect_system/fluid_spread/smoke/chem/set_up(range = 1, amount = DIAMOND_AREA(range), atom/holder, atom/location = null, datum/reagents/carry = null, silent = FALSE) +/datum/effect_system/fluid_spread/smoke/chem/New(turf/location, range = 1, amount = null, atom/holder = null, datum/reagents/carry = null, carry_limit = null, silent = FALSE) . = ..() - carry?.trans_to(chemholder, carry.total_volume, copy_only = TRUE) + chemholder = new(1000, NO_REACT) + carry?.trans_to(chemholder, isnull(carry_limit) ? carry.total_volume : carry_limit, copy_only = TRUE) if(silent) return @@ -436,18 +448,22 @@ var/where = "[AREACOORD(location)]" var/contained = length(contained_reagents) ? "\[[contained_reagents.Join(", ")]\] @ [chemholder.chem_temp]K" : null var/area/fluid_area = get_area(location) - if(carry.my_atom?.fingerprintslast) //Some reagents don't have a my_atom in some cases - var/mob/M = get_mob_by_key(carry.my_atom.fingerprintslast) - var/more = "" - if(M) - more = "[ADMIN_LOOKUPFLW(M)] " - if(!istype(carry.my_atom, /obj/machinery/plumbing) && !(fluid_area.area_flags & QUIET_LOGS)) // I like to be able to see my logs thank you - message_admins("Smoke: ([ADMIN_VERBOSEJMP(location)])[contained]. Key: [more ? more : carry.my_atom.fingerprintslast].") - log_game("A chemical smoke reaction has taken place in ([where])[contained]. Last touched by [carry.my_atom.fingerprintslast].") - else - if(!istype(carry.my_atom, /obj/machinery/plumbing) && !(fluid_area.area_flags & QUIET_LOGS)) // Deathmatch has way too much smoke to log + // Some reagents don't have a my_atom in some cases + if(!carry.my_atom?.fingerprintslast) + // Deathmatch has way too much smoke to log + if(!istype(carry.my_atom, /obj/machinery/plumbing) && !(fluid_area.area_flags & QUIET_LOGS)) message_admins("Smoke: ([ADMIN_VERBOSEJMP(location)])[contained]. No associated key.") log_game("A chemical smoke reaction has taken place in ([where])[contained]. No associated key.") + return + + var/mob/bomber = get_mob_by_key(carry.my_atom.fingerprintslast) + if(!istype(carry.my_atom, /obj/machinery/plumbing) && !(fluid_area.area_flags & QUIET_LOGS)) // I like to be able to see my logs thank you + message_admins("Smoke: ([ADMIN_VERBOSEJMP(location)])[contained]. Key: [bomber ? "[ADMIN_LOOKUPFLW(bomber)] " : carry.my_atom.fingerprintslast].") + log_game("A chemical smoke reaction has taken place in ([where])[contained]. Last touched by [carry.my_atom.fingerprintslast].") + +/datum/effect_system/fluid_spread/smoke/chem/Destroy() + QDEL_NULL(chemholder) + return ..() /datum/effect_system/fluid_spread/smoke/chem/start(log = FALSE) var/start_loc = holder ? get_turf(holder) : src.location diff --git a/code/game/objects/effects/mines.dm b/code/game/objects/effects/mines.dm index 28ebbd5cf3e..2e022e3aba9 100644 --- a/code/game/objects/effects/mines.dm +++ b/code/game/objects/effects/mines.dm @@ -138,9 +138,7 @@ else visible_message(span_danger("[icon2html(src, viewers(src))] [src] detonates!")) - var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread - s.set_up(3, 1, src) - s.start() + do_sparks(3, TRUE, src) mineEffect(triggerer) triggered = TRUE SEND_SIGNAL(src, COMSIG_MINE_TRIGGERED, triggerer) diff --git a/code/game/objects/effects/effect_system/effect_shield.dm b/code/game/objects/effects/shield.dm similarity index 80% rename from code/game/objects/effects/effect_system/effect_shield.dm rename to code/game/objects/effects/shield.dm index d76712626b8..7776c7bceb4 100644 --- a/code/game/objects/effects/effect_system/effect_shield.dm +++ b/code/game/objects/effects/shield.dm @@ -5,17 +5,18 @@ layer = ABOVE_NORMAL_TURF_LAYER flags_1 = PREVENT_CLICK_UNDER_1 anchored = TRUE + /// Our turf's previous heat capacity var/old_heat_capacity /obj/effect/shield/Initialize(mapload) . = ..() var/turf/location = get_turf(src) - old_heat_capacity=location.heat_capacity + old_heat_capacity = location.heat_capacity location.heat_capacity = INFINITY /obj/effect/shield/Destroy() var/turf/location = get_turf(src) - location.heat_capacity=old_heat_capacity + location.heat_capacity = old_heat_capacity return ..() /obj/effect/shield/singularity_act() diff --git a/code/game/objects/effects/spawners/gibspawner.dm b/code/game/objects/effects/spawners/gibspawner.dm index 8a76d885b47..88c186f5d9a 100644 --- a/code/game/objects/effects/spawners/gibspawner.dm +++ b/code/game/objects/effects/spawners/gibspawner.dm @@ -129,6 +129,4 @@ gibdirections = list(list(NORTH, NORTHEAST, NORTHWEST), list(SOUTH, SOUTHEAST, SOUTHWEST), list(WEST, NORTHWEST, SOUTHWEST), list(EAST, NORTHEAST, SOUTHEAST), GLOB.alldirs, GLOB.alldirs) gibtypes[/obj/effect/decal/cleanable/blood/gibs/robot_debris/limb] = pick(0, 1, 2) . = ..() - var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread - sparks.set_up(2, 1, drop_location()) - sparks.start() + do_sparks(2, TRUE, drop_location()) diff --git a/code/game/objects/effects/step_triggers.dm b/code/game/objects/effects/step_triggers.dm index b1574d1f8b9..f6107d37c4d 100644 --- a/code/game/objects/effects/step_triggers.dm +++ b/code/game/objects/effects/step_triggers.dm @@ -174,22 +174,16 @@ M.Move(dest) if(entersparks) - var/datum/effect_system/spark_spread/s = new - s.set_up(4, 1, src) - s.start() + do_sparks(4, TRUE, src) + if(exitsparks) - var/datum/effect_system/spark_spread/s = new - s.set_up(4, 1, dest) - s.start() + do_sparks(4, TRUE, dest) if(entersmoke) - var/datum/effect_system/fluid_spread/smoke/s = new - s.set_up(4, holder = src, location = src) - s.start() + do_smoke(4, src, src) + if(exitsmoke) - var/datum/effect_system/fluid_spread/smoke/s = new - s.set_up(4, holder = src, location = dest) - s.start() + do_smoke(4, dest, dest) uses-- if(uses == 0) diff --git a/code/game/objects/items/cigarettes.dm b/code/game/objects/items/cigarettes.dm index 03033b0f1d2..a3366601f1e 100644 --- a/code/game/objects/items/cigarettes.dm +++ b/code/game/objects/items/cigarettes.dm @@ -1122,9 +1122,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM balloon_alert(user, "voltage maximized") icon_state = "vapeopen_high" set_greyscale(new_config = /datum/greyscale_config/vape/open_high) - var/datum/effect_system/spark_spread/sp = new /datum/effect_system/spark_spread //for effect - sp.set_up(5, 1, src) - sp.start() + do_sparks(5, TRUE, src) return TRUE /obj/item/vape/attack_self(mob/user) @@ -1170,11 +1168,10 @@ CIGARETTE PACKETS ARE IN FANCY.DM vaper.adjust_fire_stacks(2) vaper.ignite_mob() - if(reagents.get_reagent_amount(/datum/reagent/toxin/plasma)) // the plasma explodes when exposed to fire - var/datum/effect_system/reagents_explosion/e = new() - e.set_up(round(reagents.get_reagent_amount(/datum/reagent/toxin/plasma) / 2.5, 1), get_turf(src), 0) - e.start(src) + // Preserve old welding fuel behavior + if(reagents.spark_act(0, TRUE, banned_reagents = /datum/reagent/fuel) & SPARK_ACT_DESTRUCTIVE) qdel(src) + return if(!reagents.trans_to(vaper, REAGENTS_METABOLISM, methods = INHALE, ignore_stomach = TRUE)) reagents.remove_all(REAGENTS_METABOLISM) @@ -1198,23 +1195,21 @@ CIGARETTE PACKETS ARE IN FANCY.DM //Time to start puffing those fat vapes, yo. COOLDOWN_START(src, drag_cooldown, dragtime) if(obj_flags & EMAGGED) - var/datum/effect_system/fluid_spread/smoke/chem/smoke_machine/puff = new - puff.set_up(4, holder = src, location = loc, carry = reagents, efficiency = 24) - puff.start() + var/smoke_amount = DIAMOND_AREA(4) + do_chem_smoke(amount = smoke_amount, holder = src, location = loc, carry = reagents, carry_limit = 20, smoke_type = /datum/effect_system/fluid_spread/smoke/chem/smoke_machine) + reagents.remove_all(smoke_amount / 24) if(prob(5)) //small chance for the vape to break and deal damage if it's emagged playsound(get_turf(src), 'sound/effects/pop_expl.ogg', 50, FALSE) M.apply_damage(20, BURN, BODY_ZONE_HEAD) M.Paralyze(300) - var/datum/effect_system/spark_spread/sp = new /datum/effect_system/spark_spread - sp.set_up(5, 1, src) - sp.start() + do_sparks(5, TRUE, src) to_chat(M, span_userdanger("[src] suddenly explodes in your mouth!")) qdel(src) return else if(super) - var/datum/effect_system/fluid_spread/smoke/chem/smoke_machine/puff = new - puff.set_up(1, holder = src, location = loc, carry = reagents, efficiency = 24) - puff.start() + var/smoke_amount = DIAMOND_AREA(1) + do_chem_smoke(amount = smoke_amount, holder = src, location = loc, carry = reagents, carry_limit = 20, smoke_type = /datum/effect_system/fluid_spread/smoke/chem/smoke_machine) + reagents.remove_all(smoke_amount / 24) handle_reagents() diff --git a/code/game/objects/items/clown_items.dm b/code/game/objects/items/clown_items.dm index c0e35ee303a..c08b1c3fcd2 100644 --- a/code/game/objects/items/clown_items.dm +++ b/code/game/objects/items/clown_items.dm @@ -141,9 +141,7 @@ /obj/item/soap/suicide_act(mob/living/user) user.say(";FFFFFFFFFFFFFFFFUUUUUUUDGE!!", forced="soap suicide") user.visible_message(span_suicide("[user] lifts [src] to [user.p_their()] mouth and gnaws on it furiously, producing a thick froth! [user.p_They()]'ll never get that BB gun now!")) - var/datum/effect_system/fluid_spread/foam/foam = new - foam.set_up(1, holder = src, location = get_turf(user)) - foam.start() + do_foam(1, src, get_turf(user)) return TOXLOSS /obj/item/soap/proc/should_clean(datum/cleaning_source, atom/atom_to_clean, mob/living/cleaner) diff --git a/code/game/objects/items/devices/chameleonproj.dm b/code/game/objects/items/devices/chameleonproj.dm index 5783b3c867f..7b854d26bfe 100644 --- a/code/game/objects/items/devices/chameleonproj.dm +++ b/code/game/objects/items/devices/chameleonproj.dm @@ -101,10 +101,7 @@ if(active_dummy) for(var/mob/M in active_dummy) to_chat(M, span_danger("Your chameleon projector deactivates.")) - var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread - spark_system.set_up(5, 0, src) - spark_system.attach(src) - spark_system.start() + do_sparks(5, FALSE, src, src) eject_all() if(delete_dummy) qdel(active_dummy) diff --git a/code/game/objects/items/devices/radio/electropack.dm b/code/game/objects/items/devices/radio/electropack.dm index c7507b31bd0..7b3d48a69dd 100644 --- a/code/game/objects/items/devices/radio/electropack.dm +++ b/code/game/objects/items/devices/radio/electropack.dm @@ -72,10 +72,7 @@ step(L, pick(GLOB.cardinals)) to_chat(L, span_danger("You feel a sharp shock!")) - var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread - s.set_up(3, 1, L) - s.start() - + do_sparks(3, TRUE, L) L.Paralyze(100) if(master) diff --git a/code/game/objects/items/dice.dm b/code/game/objects/items/dice.dm index 416abb3064e..e7cb7bac4f0 100644 --- a/code/game/objects/items/dice.dm +++ b/code/game/objects/items/dice.dm @@ -389,7 +389,7 @@ //Cookie selected_turf.visible_message(span_userdanger("A cookie appears out of thin air!")) var/obj/item/food/cookie/ooh_a_cookie = new(drop_location()) - do_smoke(0, holder = src, location = drop_location()) + do_smoke(0, src, drop_location()) ooh_a_cookie.name = "Cookie of Fate" if(12) //Healing @@ -410,12 +410,12 @@ if(14) //Free Gun selected_turf.visible_message(span_userdanger("An impressive gun appears!")) - do_smoke(0, holder = src, location = drop_location()) + do_smoke(0, src, drop_location()) new /obj/item/gun/ballistic/revolver/mateba(drop_location()) if(15) //Random One-use spellbook selected_turf.visible_message(span_userdanger("A magical looking book drops to the floor!")) - do_smoke(0, holder = src, location = drop_location()) + do_smoke(0, src, drop_location()) new /obj/item/book/granter/action/spell/random(drop_location()) if(16) //Servant & Servant Summon @@ -426,12 +426,12 @@ //Tator Kit selected_turf.visible_message(span_userdanger("A suspicious box appears!")) new /obj/item/storage/box/syndicate/bundle_a(drop_location()) - do_smoke(0, holder = src, location = drop_location()) + do_smoke(0, src, drop_location()) if(18) //Captain ID selected_turf.visible_message(span_userdanger("A golden identification card appears!")) new /obj/item/card/id/advanced/gold/captains_spare(drop_location()) - do_smoke(0, holder = src, location = drop_location()) + do_smoke(0, src, drop_location()) if(19) //Instrinct Resistance selected_turf.visible_message(span_userdanger("[user] looks very robust!")) diff --git a/code/game/objects/items/food/burgers.dm b/code/game/objects/items/food/burgers.dm index 05811a6dd9f..f2b444901eb 100644 --- a/code/game/objects/items/food/burgers.dm +++ b/code/game/objects/items/food/burgers.dm @@ -697,9 +697,7 @@ /obj/item/food/burger/crazy/process(seconds_per_tick) // DIT EES HORRIBLE if(SPT_PROB(2.5, seconds_per_tick)) - var/datum/effect_system/fluid_spread/smoke/bad/green/smoke = new - smoke.set_up(0, holder = src, location = src) - smoke.start() + do_smoke(0, src, loc, smoke_type = /datum/effect_system/fluid_spread/smoke/bad/green) // empty burger you can customize /obj/item/food/burger/empty diff --git a/code/game/objects/items/grenades/smokebomb.dm b/code/game/objects/items/grenades/smokebomb.dm index 371df2167c1..3ebdddb439c 100644 --- a/code/game/objects/items/grenades/smokebomb.dm +++ b/code/game/objects/items/grenades/smokebomb.dm @@ -43,10 +43,7 @@ update_mob() playsound(src, 'sound/effects/smoke.ogg', 50, TRUE, -3) - var/datum/effect_system/fluid_spread/smoke/bad/smoke = new - smoke.set_up(4, holder = src, location = src) - smoke.start() - qdel(smoke) //And deleted again. Sad really. + do_smoke(4, src, loc, smoke_type = /datum/effect_system/fluid_spread/smoke/bad) for(var/obj/structure/blob/blob in view(8, src)) var/damage = round(30/(get_dist(blob, src) + 1)) blob.take_damage(damage, BURN, MELEE, 0) diff --git a/code/game/objects/items/implants/implant_misc.dm b/code/game/objects/items/implants/implant_misc.dm index 393df069ffe..444cfa8ed60 100644 --- a/code/game/objects/items/implants/implant_misc.dm +++ b/code/game/objects/items/implants/implant_misc.dm @@ -56,9 +56,7 @@ /obj/item/implant/smoke/activate() . = ..() uses-- - var/datum/effect_system/fluid_spread/smoke/bad/smoke = new - smoke.set_up(6, holder = imp_in, location = imp_in) - smoke.start() + do_smoke(6, imp_in, imp_in.loc, smoke_type = /datum/effect_system/fluid_spread/smoke/bad) if(!uses) qdel(src) diff --git a/code/game/objects/items/implants/security/implant_noteleport.dm b/code/game/objects/items/implants/security/implant_noteleport.dm index 36fd56aa1d4..38efeb1a028 100644 --- a/code/game/objects/items/implants/security/implant_noteleport.dm +++ b/code/game/objects/items/implants/security/implant_noteleport.dm @@ -40,9 +40,7 @@ to_chat(teleportee, span_holoparasite("You feel yourself teleporting, but are suddenly flung back to where you just were!")) teleportee.apply_status_effect(/datum/status_effect/incapacitating/paralyzed, 5 SECONDS) - var/datum/effect_system/spark_spread/quantum/spark_system = new() - spark_system.set_up(5, TRUE, teleportee) - spark_system.start() + do_sparks(5, TRUE, teleportee, spark_type = /datum/effect_system/basic/spark_spread/quantum) return TRUE /// Signal for COMSIG_MOB_PRE_JAUNT that prevents a user from entering a jaunt. @@ -52,9 +50,7 @@ to_chat(jaunter, span_holoparasite("As you attempt to jaunt, you slam directly into the barrier between realities and are sent crashing back into corporeality!")) jaunter.apply_status_effect(/datum/status_effect/incapacitating/paralyzed, 5 SECONDS) - var/datum/effect_system/spark_spread/quantum/spark_system = new() - spark_system.set_up(5, TRUE, jaunter) - spark_system.start() + do_sparks(5, TRUE, jaunter, spark_type = /datum/effect_system/basic/spark_spread/quantum) return COMPONENT_BLOCK_JAUNT /obj/item/implantcase/teleport_blocker diff --git a/code/game/objects/items/rcd/RHD.dm b/code/game/objects/items/rcd/RHD.dm index 2b08fc42b72..202c8503558 100644 --- a/code/game/objects/items/rcd/RHD.dm +++ b/code/game/objects/items/rcd/RHD.dm @@ -21,7 +21,7 @@ armor_type = /datum/armor/item_construction resistance_flags = FIRE_PROOF /// the spark system which sparks whever the ui options are dited - var/datum/effect_system/spark_spread/spark_system + var/datum/effect_system/basic/spark_spread/spark_system /// current local matter inside the device, not used when silo link is on var/matter = 0 /// maximum local matter this device can hold, not used when silo link is on @@ -47,8 +47,7 @@ /obj/item/construction/Initialize(mapload) . = ..() - spark_system = new /datum/effect_system/spark_spread - spark_system.set_up(5, 0, src) + spark_system = new(5, FALSE, src) spark_system.attach(src) if(construction_upgrades & RCD_UPGRADE_SILO_LINK) silo_mats = new (src, mapload, FALSE) diff --git a/code/game/objects/items/rcd/RPD.dm b/code/game/objects/items/rcd/RPD.dm index 11f1a1fc2c3..9cbe5a9bd3e 100644 --- a/code/game/objects/items/rcd/RPD.dm +++ b/code/game/objects/items/rcd/RPD.dm @@ -40,7 +40,7 @@ pickup_sound = 'sound/items/handling/tools/rpd_pickup.ogg' sound_vary = TRUE ///Sparks system used when changing device in the UI - var/datum/effect_system/spark_spread/spark_system + var/datum/effect_system/basic/spark_spread/spark_system ///Direction of the device we are going to spawn, set up in the UI var/p_dir = NORTH ///Initial direction of the smart pipe we are going to spawn, set up in the UI @@ -80,8 +80,7 @@ /obj/item/pipe_dispenser/Initialize(mapload) . = ..() - spark_system = new - spark_system.set_up(5, 0, src) + spark_system = new(src, 5, FALSE) spark_system.attach(src) if(!first_atmos) first_atmos = GLOB.atmos_pipe_recipes[GLOB.atmos_pipe_recipes[1]][1] diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index 2ee732b274b..b8eff3ae304 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -605,9 +605,7 @@ var/prev_lockcharge = borg.lockcharge borg.SetLockdown(TRUE) borg.set_anchored(TRUE) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(1, holder = borg, location = borg.loc) - smoke.start() + do_smoke(1, borg, borg.loc) sleep(0.2 SECONDS) for(var/i in 1 to 4) playsound(borg, pick( diff --git a/code/game/objects/items/tanks/watertank.dm b/code/game/objects/items/tanks/watertank.dm index 3891f34bd09..47007dd3a63 100644 --- a/code/game/objects/items/tanks/watertank.dm +++ b/code/game/objects/items/tanks/watertank.dm @@ -358,9 +358,7 @@ anchored = TRUE /obj/effect/resin_container/proc/Smoke() - var/datum/effect_system/fluid_spread/foam/metal/resin/foaming = new - foaming.set_up(4, holder = src, location = loc) - foaming.start() + do_foam(4, src, loc, foam_type = /datum/effect_system/fluid_spread/foam/metal/resin) playsound(src,'sound/effects/bamf.ogg',100,TRUE) qdel(src) diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index 70b757369e3..ce765778cb6 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -829,10 +829,8 @@ w_class = WEIGHT_CLASS_TINY var/ash_type = /obj/effect/decal/cleanable/ash -/obj/item/toy/snappop/proc/pop_burst(n=3, c=1) - var/datum/effect_system/spark_spread/s = new() - s.set_up(n, c, src) - s.start() +/obj/item/toy/snappop/proc/pop_burst(n = 3, c = TRUE) + do_sparks(n, c, src) new ash_type(loc) visible_message(span_warning("[src] explodes!"), span_hear("You hear a snap!")) diff --git a/code/game/objects/items/weaponry/melee/energy.dm b/code/game/objects/items/weaponry/melee/energy.dm index 8c450549066..0c6ed38d674 100644 --- a/code/game/objects/items/weaponry/melee/energy.dm +++ b/code/game/objects/items/weaponry/melee/energy.dm @@ -358,7 +358,7 @@ heat = 3500 w_class = WEIGHT_CLASS_BULKY /// Our linked spark system that emits from our sword. - var/datum/effect_system/spark_spread/spark_system + var/datum/effect_system/basic/spark_spread/spark_system var/list/alt_continuous = list("stabs", "pierces", "impales") var/list/alt_simple = list("stab", "pierce", "impale") @@ -368,8 +368,7 @@ alt_continuous = string_list(alt_continuous) alt_simple = string_list(alt_simple) AddComponent(/datum/component/alternative_sharpness, SHARP_POINTY, alt_continuous, alt_simple, -10) - spark_system = new /datum/effect_system/spark_spread() - spark_system.set_up(5, 0, src) + spark_system = new(5, FALSE, src) spark_system.attach(src) START_PROCESSING(SSobj, src) ADD_TRAIT(src, TRAIT_TRANSFORM_ACTIVE, INNATE_TRAIT) // Functions as an extended esword diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index ed3aa733d66..f4a31fbe713 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -343,10 +343,7 @@ return FALSE if(prob(50)) // Shocking hurts the grille (to weaken monkey powersinks) take_damage(1, BURN, FIRE, sound_effect = FALSE) - var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread - sparks.set_up(3, 1, src) - sparks.start() - + do_sparks(3, TRUE, src) return TRUE /obj/structure/grille/should_atmos_process(datum/gas_mixture/air, exposed_temperature) diff --git a/code/game/objects/structures/hivebot.dm b/code/game/objects/structures/hivebot.dm index 19e35d30a5e..99c4ca02a60 100644 --- a/code/game/objects/structures/hivebot.dm +++ b/code/game/objects/structures/hivebot.dm @@ -10,9 +10,7 @@ /obj/structure/hivebot_beacon/Initialize(mapload) . = ..() - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(2, holder = src, location = loc) - smoke.start() + do_smoke(2, src, loc) visible_message(span_bolddanger("[src] warps in!")) playsound(src.loc, 'sound/effects/empulse.ogg', 25, TRUE) addtimer(CALLBACK(src, PROC_REF(warpbots)), rand(1 SECONDS, 1 MINUTES)) diff --git a/code/game/objects/structures/maintenance.dm b/code/game/objects/structures/maintenance.dm index 3409c3a49c1..c6be3348e74 100644 --- a/code/game/objects/structures/maintenance.dm +++ b/code/game/objects/structures/maintenance.dm @@ -325,9 +325,7 @@ at the cost of risking a vicious bite.**/ return if(!ismob(leaving)) return - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(range = 1, amount = 1, location = src) - smoke.start() + do_smoke(1, src, loc) playsound(src, 'sound/machines/steam_hiss.ogg', 75, TRUE, -2) COOLDOWN_START(src, steam_vent_interact, steam_speed) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 00a7dec2bf6..4db81bd526d 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -833,10 +833,7 @@ if(!electrocute_mob(user, cable_node, src, 1, TRUE)) return FALSE - var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread - sparks.set_up(3, TRUE, src) - sparks.start() - + do_sparks(3, TRUE, src) return TRUE /obj/structure/table/bronze diff --git a/code/game/objects/structures/toiletbong.dm b/code/game/objects/structures/toiletbong.dm index e4ff9776cea..47e9c64f99c 100644 --- a/code/game/objects/structures/toiletbong.dm +++ b/code/game/objects/structures/toiletbong.dm @@ -56,9 +56,10 @@ user.balloon_alert(user, "[item.name] is blocking the pipes!") continue playsound(src, 'sound/items/modsuit/flamethrower.ogg', 50) - var/datum/effect_system/fluid_spread/smoke/chem/smoke_machine/puff = new - puff.set_up(smokeradius, holder = src, location = user, carry = item.reagents, efficiency = 20) - puff.start() + + var/smoke_amount = DIAMOND_AREA(smokeradius) + do_chem_smoke(amount = smoke_amount, holder = src, location = loc, carry = reagents, carry_limit = 20, smoke_type = /datum/effect_system/fluid_spread/smoke/chem/smoke_machine) + reagents.remove_all(smoke_amount / 20) if (prob(5) && !(obj_flags & EMAGGED)) if(user.get_liked_foodtypes() & GORE) user.balloon_alert(user, "a hidden treat!") diff --git a/code/game/objects/structures/traps.dm b/code/game/objects/structures/traps.dm index a14a5137b02..a1dfbd5a830 100644 --- a/code/game/objects/structures/traps.dm +++ b/code/game/objects/structures/traps.dm @@ -16,14 +16,12 @@ var/list/mob/immune_minds = list() var/sparks = TRUE - var/datum/effect_system/spark_spread/spark_system + var/datum/effect_system/basic/spark_spread/spark_system /obj/structure/trap/Initialize(mapload) . = ..() flare_message = span_warning("[src] flares brightly!") - spark_system = new - spark_system.set_up(4,1,src) - spark_system.attach(src) + spark_system = new(src, 4, TRUE) var/static/list/loc_connections = list( COMSIG_ATOM_ENTERED = PROC_REF(on_entered) @@ -37,9 +35,8 @@ )) /obj/structure/trap/Destroy() - qdel(spark_system) - spark_system = null - . = ..() + QDEL_NULL(spark_system) + return ..() /obj/structure/trap/examine(mob/user) . = ..() @@ -147,7 +144,7 @@ icon_state = "bounty_trap_off" var/obj/structure/trap/stun/hunter/stored_trap var/obj/item/radio/radio - var/datum/effect_system/spark_spread/spark_system + var/datum/effect_system/basic/spark_spread/spark_system /obj/item/bountytrap/Initialize(mapload) . = ..() @@ -155,8 +152,7 @@ radio.subspace_transmission = TRUE radio.canhear_range = 0 radio.recalculateChannels() - spark_system = new - spark_system.set_up(4,1,src) + spark_system = new(src, 4, TRUE) spark_system.attach(src) name = "[name] #[rand(1, 999)]" stored_trap = new(src) diff --git a/code/modules/antagonists/abductor/equipment/gear/abductor_items.dm b/code/modules/antagonists/abductor/equipment/gear/abductor_items.dm index 3cdbda71f79..fd75708e57f 100644 --- a/code/modules/antagonists/abductor/equipment/gear/abductor_items.dm +++ b/code/modules/antagonists/abductor/equipment/gear/abductor_items.dm @@ -484,9 +484,7 @@ Return to step 11 of normal process."} /obj/item/restraints/handcuffs/energy/on_uncuffed(datum/source, mob/living/wearer) . = ..() wearer.visible_message(span_danger("[wearer]'s [name] breaks in a discharge of energy!"), span_userdanger("[wearer]'s [name] breaks in a discharge of energy!")) - var/datum/effect_system/spark_spread/sparks = new - sparks.set_up(4,0,wearer.loc) - sparks.start() + do_sparks(4, FALSE, wearer.loc) qdel(src) /obj/item/melee/baton/abductor/examine(mob/user) diff --git a/code/modules/antagonists/abductor/machinery/pad.dm b/code/modules/antagonists/abductor/machinery/pad.dm index 1610d9a6cff..391ac36789a 100644 --- a/code/modules/antagonists/abductor/machinery/pad.dm +++ b/code/modules/antagonists/abductor/machinery/pad.dm @@ -58,9 +58,7 @@ /obj/effect/temp_visual/teleport_abductor/Initialize(mapload) . = ..() - var/datum/effect_system/spark_spread/S = new - S.set_up(10,0,loc) - S.start() + do_sparks(10, FALSE, loc) /obj/effect/temp_visual/teleport_golem name = "bluespace silhouette" diff --git a/code/modules/antagonists/fugitive/hunters/hunter_gear.dm b/code/modules/antagonists/fugitive/hunters/hunter_gear.dm index 34d10b05789..dd829c4ce8a 100644 --- a/code/modules/antagonists/fugitive/hunters/hunter_gear.dm +++ b/code/modules/antagonists/fugitive/hunters/hunter_gear.dm @@ -106,9 +106,7 @@ color = "#d6ad8b" /obj/item/clothing/suit/armor/reactive/psykerboost/cooldown_activation(mob/living/carbon/human/owner) - var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread - sparks.set_up(1, 1, src) - sparks.start() + do_sparks(1, TRUE, src) return ..() /obj/item/clothing/suit/armor/reactive/psykerboost/reactive_activation(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) diff --git a/code/modules/antagonists/heretic/influences.dm b/code/modules/antagonists/heretic/influences.dm index 659ed72854b..71f79a51cbd 100644 --- a/code/modules/antagonists/heretic/influences.dm +++ b/code/modules/antagonists/heretic/influences.dm @@ -147,8 +147,7 @@ else human_user.gib(DROP_ALL_REMAINS) human_user.investigate_log("has died from using telekinesis on a heretic influence.", INVESTIGATE_DEATHS) - var/datum/effect_system/reagents_explosion/explosion = new() - explosion.set_up(1, get_turf(human_user), 1) + var/datum/effect_system/reagents_explosion/explosion = new(get_turf(human_user), 1, 1, 1) explosion.start(src) /obj/effect/visible_heretic_influence/examine(mob/living/user) diff --git a/code/modules/antagonists/heretic/knowledge/moon_lore.dm b/code/modules/antagonists/heretic/knowledge/moon_lore.dm index f099050ecfb..f3a9a9da712 100644 --- a/code/modules/antagonists/heretic/knowledge/moon_lore.dm +++ b/code/modules/antagonists/heretic/knowledge/moon_lore.dm @@ -303,8 +303,7 @@ var/obj/item/bodypart/head/head = locate() in carbon_view.bodyparts if(!head?.dismember()) carbon_view.gib(DROP_ALL_REMAINS) - var/datum/effect_system/reagents_explosion/explosion = new() - explosion.set_up(1, get_turf(carbon_view), 1) + var/datum/effect_system/reagents_explosion/explosion = new(get_turf(carbon_view), 1, 1, 1) explosion.start(src) else attempt_conversion(carbon_view, source) diff --git a/code/modules/antagonists/nukeop/equipment/nuclear_bomb/beer_nuke.dm b/code/modules/antagonists/nukeop/equipment/nuclear_bomb/beer_nuke.dm index f2cc848a8b3..5f873c463b2 100644 --- a/code/modules/antagonists/nukeop/equipment/nuclear_bomb/beer_nuke.dm +++ b/code/modules/antagonists/nukeop/equipment/nuclear_bomb/beer_nuke.dm @@ -57,13 +57,7 @@ return ..() /obj/machinery/nuclearbomb/beer/proc/local_foam() - var/datum/reagents/tmp_holder = new/datum/reagents(1000) - tmp_holder.my_atom = src - tmp_holder.add_reagent(flood_reagent, 100) - - var/datum/effect_system/fluid_spread/foam/foam = new - foam.set_up(200, holder = src, location = get_turf(src), carry = tmp_holder) - foam.start() + do_foam(200, src, get_turf(src), flood_reagent, 100) disarm_nuke() /obj/machinery/nuclearbomb/beer/really_actually_explode(detonation_status) diff --git a/code/modules/antagonists/space_ninja/equipment/energy_katana.dm b/code/modules/antagonists/space_ninja/equipment/energy_katana.dm index 7ae1929d6d3..f02df8b5926 100644 --- a/code/modules/antagonists/space_ninja/equipment/energy_katana.dm +++ b/code/modules/antagonists/space_ninja/equipment/energy_katana.dm @@ -36,14 +36,13 @@ max_integrity = 200 resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF item_flags = NEEDS_PERMIT - var/datum/effect_system/spark_spread/spark_system + var/datum/effect_system/basic/spark_spread/spark_system var/datum/action/innate/dash/ninja/jaunt /obj/item/energy_katana/Initialize(mapload) . = ..() jaunt = new(src) - spark_system = new /datum/effect_system/spark_spread() - spark_system.set_up(5, 0, src) + spark_system = new(src, 5, FALSE) spark_system.attach(src) /obj/item/energy_katana/ranged_interact_with_atom_secondary(atom/interacting_with, mob/living/user, list/modifiers) diff --git a/code/modules/antagonists/wizard/equipment/wizard_hammer.dm b/code/modules/antagonists/wizard/equipment/wizard_hammer.dm index 9c6f50392ef..4a4b945632b 100644 --- a/code/modules/antagonists/wizard/equipment/wizard_hammer.dm +++ b/code/modules/antagonists/wizard/equipment/wizard_hammer.dm @@ -105,9 +105,8 @@ /obj/item/mjollnir/proc/shock(mob/living/target) target.Stun(1.5 SECONDS) target.Knockdown(10 SECONDS) - var/datum/effect_system/lightning_spread/s = new /datum/effect_system/lightning_spread - s.set_up(5, 1, target.loc) - s.start() + var/datum/effect_system/basic/lightning_spread/lightning = new(target.loc, 5, TRUE) + lightning.start() target.visible_message(span_danger("[target.name] is shocked by [src]!"), \ span_userdanger("You feel a powerful shock course through your body sending you flying!"), \ span_hear("You hear a heavy electrical crack!")) diff --git a/code/modules/antagonists/wizard/grand_ritual/grand_side_effect.dm b/code/modules/antagonists/wizard/grand_ritual/grand_side_effect.dm index c86c6a84bf3..140b63cf92a 100644 --- a/code/modules/antagonists/wizard/grand_ritual/grand_side_effect.dm +++ b/code/modules/antagonists/wizard/grand_ritual/grand_side_effect.dm @@ -247,9 +247,7 @@ /datum/grand_side_effect/smoke/trigger(potency, turf/ritual_location, mob/invoker) playsound(src, 'sound/effects/magic/smoke.ogg', 50, TRUE) var/range = LERP(2, 4, potency/GRAND_RITUAL_FINALE_COUNT) - var/datum/effect_system/fluid_spread/smoke/colourful/smoke = new - smoke.set_up(range, holder = ritual_location, location = ritual_location) - smoke.start() + do_smoke(round(range), ritual_location, ritual_location, smoke_type = /datum/effect_system/fluid_spread/smoke/colourful) /// Spawns randomly coloured smoke /datum/effect_system/fluid_spread/smoke/colourful diff --git a/code/modules/assembly/igniter.dm b/code/modules/assembly/igniter.dm index 96404d02b22..adddd5dd1b3 100644 --- a/code/modules/assembly/igniter.dm +++ b/code/modules/assembly/igniter.dm @@ -8,7 +8,7 @@ desc = "A small electronic device able to ignite combustible substances." icon_state = "igniter" custom_materials = list(/datum/material/iron=SMALL_MATERIAL_AMOUNT*5, /datum/material/glass=SMALL_MATERIAL_AMOUNT*0.5) - var/datum/effect_system/spark_spread/sparks + var/datum/effect_system/basic/spark_spread/sparks heat = 1000 drop_sound = 'sound/items/handling/component_drop.ogg' pickup_sound = 'sound/items/handling/component_pickup.ogg' @@ -21,15 +21,12 @@ /obj/item/assembly/igniter/Initialize(mapload) . = ..() - sparks = new - sparks.set_up(2, 0, src) + sparks = new(src, 2, FALSE) sparks.attach(src) /obj/item/assembly/igniter/Destroy() - if(sparks) - qdel(sparks) - sparks = null - . = ..() + QDEL_NULL(sparks) + return ..() /obj/item/assembly/igniter/activate() if(!..()) diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm index 64cd36ca239..d215c1c6803 100644 --- a/code/modules/atmospherics/gasmixtures/reactions.dm +++ b/code/modules/atmospherics/gasmixtures/reactions.dm @@ -887,9 +887,7 @@ var/obj/effect/particle_effect/fluid/foam/foam = locate() in location var/obj/structure/foamedmetal/resin = locate() in location if(heat_efficiency > HALON_COMBUSTION_MINIMUM_RESIN_MOLES && isopenturf(location) && !foam && !resin) // Don't resin if there is aleady resin or we are not in an open turf. - var/datum/effect_system/fluid_spread/foam/metal/resin/halon/foaming = new - foaming.set_up(amount = HALON_COMBUSTION_RESIN_VOLUME, holder = holder, location = location) - foaming.start() + do_foam(amount = HALON_COMBUSTION_RESIN_VOLUME, holder = holder, location = location, foam_type = /datum/effect_system/fluid_spread/foam/metal/resin/halon) . |= VOLATILE_REACTION . |= REACTING diff --git a/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm b/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm index 943a10766bb..9e3b30f0825 100644 --- a/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm +++ b/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm @@ -167,13 +167,10 @@ return FALSE if(!prob(prb)) return FALSE //you lucked out, no shock for you - var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread - s.set_up(5, 1, src) - s.start() //sparks always. + do_sparks(5, TRUE, src) if (electrocute_mob(user, get_area(src), src, 1, TRUE)) return TRUE - else - return FALSE + return FALSE /obj/item/electronics/airalarm name = "air alarm electronics" diff --git a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer_items.dm b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer_items.dm index 69bf48fe2ae..440be922316 100644 --- a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer_items.dm +++ b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer_items.dm @@ -48,12 +48,5 @@ /obj/item/nitrium_crystal/attack_self(mob/user) . = ..() - var/datum/effect_system/fluid_spread/smoke/chem/smoke = new - var/turf/location = get_turf(src) - create_reagents(5) - reagents.add_reagent(/datum/reagent/nitrium_low_metabolization, 3) - reagents.add_reagent(/datum/reagent/nitrium_high_metabolization, 2) - smoke.attach(location) - smoke.set_up(cloud_size, holder = src, location = location, carry = reagents, silent = TRUE) - smoke.start() + do_chem_smoke(cloud_size, src, get_turf(src), list(/datum/reagent/nitrium_low_metabolization = 3, /datum/reagent/nitrium_high_metabolization = 2)) qdel(src) diff --git a/code/modules/awaymissions/super_secret_room.dm b/code/modules/awaymissions/super_secret_room.dm index 6d338e5ec26..2fa38219a1f 100644 --- a/code/modules/awaymissions/super_secret_room.dm +++ b/code/modules/awaymissions/super_secret_room.dm @@ -29,9 +29,7 @@ SpeakPeace(list("Welcome to the error handling room.","Something's goofed up bad to send you here.","You should probably tell an admin what you were doing, or make a bug report.")) for(var/obj/structure/signpost/salvation/sign in orange(7)) sign.SetInvisibility(INVISIBILITY_NONE) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(1, holder = src, location = sign.loc) - smoke.start() + do_smoke(1, src, sign.loc) break if(1) SpeakPeace(list("Take that ladder up.","It'll send you back to the station.","Hopefully you'll never need to see this place again.")) diff --git a/code/modules/bitrunning/components/bitrunning_points.dm b/code/modules/bitrunning/components/bitrunning_points.dm index b800d586e94..039f3a9d338 100644 --- a/code/modules/bitrunning/components/bitrunning_points.dm +++ b/code/modules/bitrunning/components/bitrunning_points.dm @@ -32,9 +32,5 @@ var/turf/tile = parent var/obj/structure/closet/crate/secure/bitrunning/encrypted/crate = new() crate.forceMove(tile) // Triggers any on-move effects on that turf - - var/datum/effect_system/spark_spread/quantum/sparks = new(tile) - sparks.set_up(number = 5, location = tile) - sparks.start() - + do_sparks(5, FALSE, tile, spark_type = /datum/effect_system/basic/spark_spread/quantum) qdel(src) diff --git a/code/modules/bitrunning/objects/byteforge.dm b/code/modules/bitrunning/objects/byteforge.dm index a4ceb6fb534..5fccb167a5c 100644 --- a/code/modules/bitrunning/objects/byteforge.dm +++ b/code/modules/bitrunning/objects/byteforge.dm @@ -60,10 +60,7 @@ /obj/machinery/byteforge/proc/flash(atom/movable/thing) playsound(src, 'sound/effects/magic/blink.ogg', 50, TRUE) - var/datum/effect_system/spark_spread/quantum/sparks = new() - sparks.set_up(5, 1, loc) - sparks.start() - + do_sparks(5, TRUE, loc, spark_type = /datum/effect_system/basic/spark_spread/quantum) set_light(l_on = FALSE) /// Forge begins to process diff --git a/code/modules/bitrunning/server/util.dm b/code/modules/bitrunning/server/util.dm index ce79ee7aa5b..ae15698f09d 100644 --- a/code/modules/bitrunning/server/util.dm +++ b/code/modules/bitrunning/server/util.dm @@ -135,9 +135,7 @@ /// Do some magic teleport sparks /obj/machinery/quantum_server/proc/spark_at_location(obj/cache) playsound(cache, 'sound/effects/magic/blink.ogg', 50, vary = TRUE) - var/datum/effect_system/spark_spread/quantum/sparks = new() - sparks.set_up(5, location = get_turf(cache)) - sparks.start() + do_sparks(5, FALSE, get_turf(cache), spark_type = /datum/effect_system/basic/spark_spread/quantum) /// Starts building a new avatar for the player. diff --git a/code/modules/cargo/markets/market_telepad.dm b/code/modules/cargo/markets/market_telepad.dm index 445cd329603..6383be5e95c 100644 --- a/code/modules/cargo/markets/market_telepad.dm +++ b/code/modules/cargo/markets/market_telepad.dm @@ -366,11 +366,7 @@ receiving.post_purchase_effects(receiving.item) use_energy(energy_usage_per_teleport / power_efficiency) - var/datum/effect_system/spark_spread/sparks = new - sparks.set_up(5, 1, get_turf(src)) - sparks.attach(receiving.item) - sparks.start() - + do_sparks(5, TRUE, src, receiving.item) transmitting = receiving receiving = null diff --git a/code/modules/clothing/head/perceptomatrix.dm b/code/modules/clothing/head/perceptomatrix.dm index b2cdb061bdf..f3753224138 100644 --- a/code/modules/clothing/head/perceptomatrix.dm +++ b/code/modules/clothing/head/perceptomatrix.dm @@ -164,17 +164,6 @@ var/stagger_duration = 3 SECONDS /// The amount of hallucination to apply var/hallucination_duration = 25 SECONDS - /// Spark system - var/datum/effect_system/spark_spread/quantum/spark_sys - -/datum/action/cooldown/spell/pointed/percept_hallucination/New(Target) - . = ..() - - spark_sys = new /datum/effect_system/spark_spread/quantum - -/datum/action/cooldown/spell/pointed/percept_hallucination/Destroy() - QDEL_NULL(spark_sys) - return ..() /datum/action/cooldown/spell/pointed/percept_hallucination/is_valid_target(atom/cast_on) . = ..() @@ -216,11 +205,8 @@ /datum/action/cooldown/spell/pointed/percept_hallucination/proc/cast_fx(atom/cast_on) owner.Beam(cast_on, icon_state = "greyscale_lightning", beam_color = COLOR_FADED_PINK, time = 0.5 SECONDS) - - spark_sys.set_up(2, 1, get_turf(owner)) - spark_sys.start() - spark_sys.set_up(4, 1, get_turf(cast_on)) - spark_sys.start() + do_sparks(2, TRUE, get_turf(owner), spark_type = /datum/effect_system/basic/spark_spread/quantum) + do_sparks(4, TRUE, get_turf(owner), spark_type = /datum/effect_system/basic/spark_spread/quantum) /datum/action/cooldown/spell/pointed/percept_hallucination/cast(mob/living/carbon/human/cast_on) . = ..() diff --git a/code/modules/clothing/head/tophat.dm b/code/modules/clothing/head/tophat.dm index 1efa8210db7..add97bc164a 100644 --- a/code/modules/clothing/head/tophat.dm +++ b/code/modules/clothing/head/tophat.dm @@ -22,7 +22,7 @@ COOLDOWN_START(src, rabbit_cooldown, RABBIT_CD_TIME) playsound(get_turf(src), 'sound/items/weapons/emitter.ogg', 70) - do_smoke(amount = DIAMOND_AREA(1), holder = src, location = src, smoke_type=/obj/effect/particle_effect/fluid/smoke/quick) + do_smoke(1, src, src, effect_type = /obj/effect/particle_effect/fluid/smoke/quick) if(prob(10)) magician.visible_message(span_danger("[magician] taps [src] with [hitby_wand], then reaches in and pulls out a bu- wait, those are bees!"), span_danger("You tap [src] with your [hitby_wand.name] and pull out... BEES!")) diff --git a/code/modules/clothing/suits/reactive_armour.dm b/code/modules/clothing/suits/reactive_armour.dm index e74144abedc..2f524915820 100644 --- a/code/modules/clothing/suits/reactive_armour.dm +++ b/code/modules/clothing/suits/reactive_armour.dm @@ -240,9 +240,7 @@ var/zap_flags = ZAP_MOB_DAMAGE | ZAP_OBJ_DAMAGE /obj/item/clothing/suit/armor/reactive/tesla/cooldown_activation(mob/living/carbon/human/owner) - var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread - sparks.set_up(1, 1, src) - sparks.start() + do_sparks(1, TRUE, src) ..() /obj/item/clothing/suit/armor/reactive/tesla/reactive_activation(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) @@ -337,9 +335,7 @@ clothing_traits = list(TRAIT_MADNESS_IMMUNE) /obj/item/clothing/suit/armor/reactive/hallucinating/cooldown_activation(mob/living/carbon/human/owner) - var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread - sparks.set_up(1, 1, src) - sparks.start() + do_sparks(1, TRUE, src) return ..() /obj/item/clothing/suit/armor/reactive/hallucinating/reactive_activation(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) @@ -392,9 +388,7 @@ r_legs = typesof(/obj/item/bodypart/leg/right) /obj/item/clothing/suit/armor/reactive/bioscrambling/cooldown_activation(mob/living/carbon/human/owner) - var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread - sparks.set_up(1, 1, src) - sparks.start() + do_sparks(1, TRUE, src) ..() /obj/item/clothing/suit/armor/reactive/bioscrambling/reactive_activation(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) @@ -508,8 +502,7 @@ owner.visible_message(span_danger("The reactive armor alters the weather around [owner], shielding [owner.p_them()] from [attack_text]!")) playsound(src, 'sound/effects/magic/lightningshock.ogg', 33, TRUE, extrarange = SHORT_RANGE_SOUND_EXTRARANGE) - var/datum/effect_system/steam_spread/steam = new() - steam.set_up(10, FALSE, owner.loc) + var/datum/effect_system/basic/steam_spread/steam = new(owner.loc, 10, FALSE) steam.start() var/list/affected_turfs = list() @@ -531,8 +524,7 @@ owner.visible_message(span_danger("The reactive armor malfunctions, calling down a storm upon [owner.p_them()]!")) playsound(src, 'sound/effects/magic/lightningshock.ogg', 33, TRUE, extrarange = SHORT_RANGE_SOUND_EXTRARANGE) - var/datum/effect_system/steam_spread/steam = new() - steam.set_up(2, FALSE, owner.loc) + var/datum/effect_system/basic/steam_spread/steam = new(owner.loc, 2, FALSE) steam.start() owner.adjust_wet_stacks(10) diff --git a/code/modules/clothing/under/jobs/Plasmaman/civilian_service.dm b/code/modules/clothing/under/jobs/Plasmaman/civilian_service.dm index 96254bba8fd..9f64535e13b 100644 --- a/code/modules/clothing/under/jobs/Plasmaman/civilian_service.dm +++ b/code/modules/clothing/under/jobs/Plasmaman/civilian_service.dm @@ -176,8 +176,4 @@ addtimer(CALLBACK(src, PROC_REF(check_fire_state)), extinguish_cooldown) owner.visible_message(span_warning("[owner]'s suit spews space lube everywhere!"), span_warning("Your suit spews space lube everywhere!")) owner.extinguish_mob() - var/datum/effect_system/fluid_spread/foam/foam = new - var/datum/reagents/foamreagent = new /datum/reagents(15) - foamreagent.add_reagent(/datum/reagent/lube, 15) - foam.set_up(4, holder = src, location = get_turf(owner), carry = foamreagent) - foam.start() //Truly terrifying. + do_foam(4, src, get_turf(owner), /datum/reagent/lube, 15) diff --git a/code/modules/events/immovable_rod/immovable_rod.dm b/code/modules/events/immovable_rod/immovable_rod.dm index 3a52689c8c1..e2404bbc090 100644 --- a/code/modules/events/immovable_rod/immovable_rod.dm +++ b/code/modules/events/immovable_rod/immovable_rod.dm @@ -164,9 +164,7 @@ // they ALSO collapse into a singulo. if(istype(clong, /obj/effect/immovablerod)) visible_message(span_danger("[src] collides with [clong]! This cannot end well.")) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(2, holder = src, location = get_turf(src)) - smoke.start() + do_smoke(2, src, get_turf(src)) var/obj/singularity/bad_luck = new(get_turf(src)) bad_luck.energy = 800 qdel(clong) diff --git a/code/modules/events/radiation_leak.dm b/code/modules/events/radiation_leak.dm index a5aee22a8b2..56e6e87b9a9 100644 --- a/code/modules/events/radiation_leak.dm +++ b/code/modules/events/radiation_leak.dm @@ -135,13 +135,9 @@ /// Helper to shoot some smoke into the air around the passed atom /datum/round_event/radiation_leak/proc/puff_some_smoke(atom/where) + // Causes radioation and mutations var/turf/below_where = get_turf(where) - var/datum/effect_system/fluid_spread/smoke/chem/gross_smoke = new() - gross_smoke.chemholder.add_reagent(/datum/reagent/toxin/polonium, 10) // Polonium (it causes radiation) - gross_smoke.chemholder.add_reagent(/datum/reagent/toxin/mutagen, 10) // Mutagen (it causes mutations. Also it's green... Primarily because it's green.) - gross_smoke.attach(below_where) - gross_smoke.set_up(2, holder = where, location = below_where, silent = TRUE) - gross_smoke.start() + do_chem_smoke(2, where, below_where, list(/datum/reagent/toxin/polonium = 10, /datum/reagent/toxin/mutagen = 10)) playsound(below_where, 'sound/effects/smoke.ogg', 50, vary = TRUE) /** diff --git a/code/modules/events/wisdomcow.dm b/code/modules/events/wisdomcow.dm index fbe824c06e6..18f0213c5d7 100644 --- a/code/modules/events/wisdomcow.dm +++ b/code/modules/events/wisdomcow.dm @@ -32,7 +32,7 @@ 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, holder = wise, location = targetloc) + do_smoke(1, wise, targetloc) announce_to_ghosts(wise) /datum/event_admin_setup/set_location/wisdom_cow diff --git a/code/modules/events/wizard/curseditems.dm b/code/modules/events/wizard/curseditems.dm index ab305bbff99..e05bd86b681 100644 --- a/code/modules/events/wizard/curseditems.dm +++ b/code/modules/events/wizard/curseditems.dm @@ -83,9 +83,7 @@ victims += target for(var/mob/living/carbon/human/victim as anything in victims) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(0, holder = victim, location = victim.loc) - smoke.start() + do_smoke(0, victim, victim.loc) #undef BIG_FAT_DOOBIE #undef BOXING diff --git a/code/modules/events/wizard/shuffle.dm b/code/modules/events/wizard/shuffle.dm index 460fe7b8a2f..b7961fa4cfa 100644 --- a/code/modules/events/wizard/shuffle.dm +++ b/code/modules/events/wizard/shuffle.dm @@ -34,9 +34,7 @@ moblocs.len -= 1 for(var/mob/living/carbon/human/victim in GLOB.alive_mob_list) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(0, holder = victim, location = victim.loc) - smoke.start() + do_smoke(0, victim, victim.loc) //---// @@ -69,9 +67,7 @@ mobnames.len -= 1 for(var/mob/living/carbon/human/victim in GLOB.alive_mob_list) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(0, holder = victim, location = victim.loc) - smoke.start() + do_smoke(0, victim, victim.loc) //---// @@ -107,6 +103,4 @@ qdel(swapper) for(var/mob/living/carbon/human/alive_human in GLOB.alive_mob_list) - var/datum/effect_system/fluid_spread/smoke/smoke = new() - smoke.set_up(0, holder = alive_human, location = alive_human.loc) - smoke.start() + do_smoke(0, alive_human, alive_human.loc) diff --git a/code/modules/explorer_drone/exodrone.dm b/code/modules/explorer_drone/exodrone.dm index 08fc0ae9142..ad2a55592e5 100644 --- a/code/modules/explorer_drone/exodrone.dm +++ b/code/modules/explorer_drone/exodrone.dm @@ -437,7 +437,7 @@ GLOBAL_LIST_EMPTY(exodrone_launchers) */ /obj/machinery/exodrone_launcher/proc/launch_effect() playsound(src,'sound/effects/podwoosh.ogg',50, FALSE) - do_smoke(1, holder = src, location = get_turf(src)) + do_smoke(1, src, get_turf(src)) /obj/machinery/exodrone_launcher/Exited(atom/movable/gone, direction) . = ..() diff --git a/code/modules/food_and_drinks/machinery/grill.dm b/code/modules/food_and_drinks/machinery/grill.dm index 75c8a06359d..e6e664eb346 100644 --- a/code/modules/food_and_drinks/machinery/grill.dm +++ b/code/modules/food_and_drinks/machinery/grill.dm @@ -43,9 +43,7 @@ new /obj/item/stack/rods(loc, 5) if(grill_fuel > 0) - var/datum/effect_system/fluid_spread/smoke/bad/smoke = new - smoke.set_up(1, holder = src, location = loc) - smoke.start() + do_smoke(1, src, loc, smoke_type = /datum/effect_system/fluid_spread/smoke/bad) /obj/machinery/grill/add_context(atom/source, list/context, obj/item/held_item, mob/user) . = NONE @@ -273,9 +271,7 @@ //use fuel, create smoke puffs for immersion grill_fuel -= fuel_usage if(SPT_PROB(0.5, seconds_per_tick)) - var/datum/effect_system/fluid_spread/smoke/bad/smoke = new - smoke.set_up(1, holder = src, location = loc) - smoke.start() + do_smoke(1, src, loc, smoke_type = /datum/effect_system/fluid_spread/smoke/bad) fuel_usage = GRILL_FUELUSAGE_ACTIVE * seconds_per_tick if(!QDELETED(grilled_item)) diff --git a/code/modules/food_and_drinks/machinery/microwave.dm b/code/modules/food_and_drinks/machinery/microwave.dm index 2235b5b243b..fce07350527 100644 --- a/code/modules/food_and_drinks/machinery/microwave.dm +++ b/code/modules/food_and_drinks/machinery/microwave.dm @@ -643,9 +643,7 @@ /obj/machinery/microwave/proc/spark() visible_message(span_warning("Sparks fly around [src]!")) - var/datum/effect_system/spark_spread/sparks = new - sparks.set_up(2, 1, src) - sparks.start() + do_sparks(2, TRUE, src) /** * The start of the cook loop diff --git a/code/modules/food_and_drinks/recipes/soup_mixtures.dm b/code/modules/food_and_drinks/recipes/soup_mixtures.dm index ff9e49dbffc..f046278142d 100644 --- a/code/modules/food_and_drinks/recipes/soup_mixtures.dm +++ b/code/modules/food_and_drinks/recipes/soup_mixtures.dm @@ -205,10 +205,7 @@ if(holder.total_volume >= holder.maximum_volume * 0.95) below_pot.visible_message(span_warning("[pot] starts to boil over!")) // Create a spread of dirty foam - var/datum/effect_system/fluid_spread/foam/dirty/soup_mess = new() - soup_mess.reagent_scale = 0.1 // (Just a little) - soup_mess.set_up(range = 1, holder = pot, location = below_pot, carry = holder, stop_reactions = TRUE) - soup_mess.start() + do_foam(1, pot, below_pot, carry = holder, foam_type = /datum/effect_system/fluid_spread/foam/dirty, stop_reactions = TRUE, reagent_scale = 0.1) // Loses a bit from the foam for(var/datum/reagent/reagent as anything in holder.reagent_list) reagent.volume *= 0.5 diff --git a/code/modules/holodeck/holo_effect.dm b/code/modules/holodeck/holo_effect.dm index 2f61f9e832e..55535d4b570 100644 --- a/code/modules/holodeck/holo_effect.dm +++ b/code/modules/holodeck/holo_effect.dm @@ -36,9 +36,7 @@ /obj/effect/holodeck_effect/sparks/activate(obj/machinery/computer/holodeck/HC) var/turf/T = get_turf(src) if(T) - var/datum/effect_system/spark_spread/s = new - s.set_up(3, 1, T) - s.start() + do_sparks(3, TRUE, T) T.temperature = 5000 //Why? not quite sure to be honest with you T.hotspot_expose(50000,50000,1) diff --git a/code/modules/hydroponics/grown/onion.dm b/code/modules/hydroponics/grown/onion.dm index 45f4d1251de..326c4ac761a 100644 --- a/code/modules/hydroponics/grown/onion.dm +++ b/code/modules/hydroponics/grown/onion.dm @@ -50,12 +50,8 @@ AddElement(/datum/element/processable, TOOL_KNIFE, /obj/item/food/onion_slice/red, 2, 15, screentip_verb = "Cut") /obj/item/food/grown/onion/UsedforProcessing(mob/living/user, obj/item/I, list/chosen_option, list/created_atoms) - var/datum/effect_system/fluid_spread/smoke/chem/cry_about_it = new //Since the onion is destroyed when it's sliced, var/splat_location = get_turf(src) //we need to set up the smoke beforehand - cry_about_it.attach(splat_location) - cry_about_it.set_up(0, holder = src, location = splat_location, carry = reagents, silent = FALSE) - cry_about_it.start() - qdel(cry_about_it) + do_chem_smoke(0, src, splat_location, carry = reagents, silent = FALSE) return ..() /obj/item/food/onion_slice diff --git a/code/modules/hydroponics/plant_genes.dm b/code/modules/hydroponics/plant_genes.dm index 0844708b3ff..2835d49908f 100644 --- a/code/modules/hydroponics/plant_genes.dm +++ b/code/modules/hydroponics/plant_genes.dm @@ -691,13 +691,10 @@ SIGNAL_HANDLER our_plant.investigate_log("made smoke at [AREACOORD(target)]. Last touched by: [our_plant.fingerprintslast].", INVESTIGATE_BOTANY) - var/datum/effect_system/fluid_spread/smoke/chem/smoke = new () var/obj/item/seeds/our_seed = our_plant.get_plant_seed() var/splat_location = get_turf(target) var/range = sqrt(our_seed.potency * 0.1) - smoke.attach(splat_location) - smoke.set_up(round(range), holder = our_plant, location = splat_location, carry = our_plant.reagents, silent = FALSE) - smoke.start(log = TRUE) + do_chem_smoke(round(range), our_plant, splat_location, carry = our_plant.reagents, silent = FALSE, log = TRUE) our_plant.reagents.clear_reagents() /// Makes the plant and its seeds fireproof. From lavaland plants. diff --git a/code/modules/library/skill_learning/generic_skillchips/acrobatics.dm b/code/modules/library/skill_learning/generic_skillchips/acrobatics.dm index dee9f5d53c5..c025b21069a 100644 --- a/code/modules/library/skill_learning/generic_skillchips/acrobatics.dm +++ b/code/modules/library/skill_learning/generic_skillchips/acrobatics.dm @@ -12,7 +12,7 @@ max_integrity = 100 /// list of emotes whose cd is overridden by this skillchip. can be edited in mapping or ingame var/list/affected_emotes = list("spin", "flip", "backflip") - var/datum/effect_system/spark_spread/sparks + var/datum/effect_system/basic/spark_spread/sparks /// you can use this without lowering integrity! let's be honest. nobody's doing that var/allowed_usage = 5 /// How many seconds does it take for it to recover one allowed usage @@ -49,7 +49,8 @@ take_damage(1, sound_effect = FALSE) if(!sparks) - sparks = new(src) + sparks = new(src, 5, FALSE) + sparks.attach(src) // minimum roll is by default capped at 50, with the min value lowering as integrity is reduced. var/mintegrity = clamp(50 - (100 - get_integrity()), 1, 100) @@ -84,8 +85,7 @@ // does not necessarily kill you directly. instead it causes cranial fissure + something to drop from your head. could be eyes, tongue, ears, brain, even implants new /obj/effect/gibspawner/generic(get_turf(bozo), bozo) - - sparks.set_up(15, cardinals_only = FALSE, location = get_turf(src)) + sparks.amount = 15 sparks.start() qdel(src) @@ -101,8 +101,7 @@ bozo.set_eye_blur_if_lower(10 SECONDS) // but the rest of the effects will happen either way bozo.adjust_organ_loss(ORGAN_SLOT_BRAIN, 20 - get_integrity()) - - sparks.set_up(5, cardinals_only = FALSE, location = get_turf(src)) + sparks.amount = 5 sparks.start() // brain Smoking. you should probably stop now @@ -142,8 +141,7 @@ particle_effect.set_particle_position(-2, 12, 0) bozo.apply_status_effect(/datum/status_effect/temperature_over_time/chip_overheat, 15 SECONDS) QDEL_IN(particle_effect, 15 SECONDS) - - sparks.set_up(10, cardinals_only = FALSE, location = get_turf(src)) + sparks.amount = 10 sparks.start() // hey, something isn't right... @@ -152,7 +150,7 @@ span_warning("[bozo]'s head sparks."), ) - sparks.set_up(rand(1,2), cardinals_only = TRUE, location = get_turf(src)) + sparks.amount = rand(1, 2) sparks.start() return COMPONENT_EMOTE_COOLDOWN_BYPASS diff --git a/code/modules/meteors/meteor_dark_matteor.dm b/code/modules/meteors/meteor_dark_matteor.dm index acf21a3c434..051f53c412d 100644 --- a/code/modules/meteors/meteor_dark_matteor.dm +++ b/code/modules/meteors/meteor_dark_matteor.dm @@ -14,7 +14,7 @@ /// distortion to really give you that sense of oh shit var/atom/movable/warp_effect/warp /// and another oh shit in the form of quantum sparks - var/datum/effect_system/spark_spread/quantum/spark_system + var/datum/effect_system/basic/spark_spread/quantum/spark_system /// in case we miss, we can go back to the previous security level var/previous_security_level @@ -26,8 +26,7 @@ SSsecurity_level.set_level(SEC_LEVEL_RED) warp = new(src) vis_contents += warp - spark_system = new /datum/effect_system/spark_spread/quantum() - spark_system.set_up(4, TRUE, src) + spark_system = new /datum/effect_system/basic/spark_spread/quantum(src, 4, TRUE) spark_system.attach(src) START_PROCESSING(SSobj, src) diff --git a/code/modules/mining/equipment/monster_organs/brimdust_sac.dm b/code/modules/mining/equipment/monster_organs/brimdust_sac.dm index 27729c24031..b76bcaba2eb 100644 --- a/code/modules/mining/equipment/monster_organs/brimdust_sac.dm +++ b/code/modules/mining/equipment/monster_organs/brimdust_sac.dm @@ -47,7 +47,7 @@ /// Make a cloud which applies brimdust to everyone nearby /obj/item/organ/monster_core/brimdust_sac/on_triggered_internal() var/turf/origin_turf = get_turf(owner) - do_smoke(range = 2, holder = owner, location = origin_turf, smoke_type = /obj/effect/particle_effect/fluid/smoke/bad/brimdust) + do_smoke(2, owner, origin_turf, effect_type = /obj/effect/particle_effect/fluid/smoke/bad/brimdust) /// Smoke which applies brimdust to you, and is also bad for your lungs /obj/effect/particle_effect/fluid/smoke/bad/brimdust diff --git a/code/modules/mob/living/basic/bots/cleanbot/cleanbot_abilities.dm b/code/modules/mob/living/basic/bots/cleanbot/cleanbot_abilities.dm index 9c334b41338..0073f472e5d 100644 --- a/code/modules/mob/living/basic/bots/cleanbot/cleanbot_abilities.dm +++ b/code/modules/mob/living/basic/bots/cleanbot/cleanbot_abilities.dm @@ -29,8 +29,6 @@ /datum/action/cooldown/mob_cooldown/bot/foam/Activate(mob/living/firer, atom/target) owner.visible_message(span_danger("[owner] whirs and bubbles violently, before releasing a plume of froth!")) - var/datum/effect_system/fluid_spread/foam/foam = new - foam.set_up(foam_range, holder = owner, location = owner.loc) - foam.start() + do_foam(foam_range, owner, owner.loc) StartCooldown() return TRUE diff --git a/code/modules/mob/living/basic/bots/firebot/firebot.dm b/code/modules/mob/living/basic/bots/firebot/firebot.dm index b6ef076c629..b49aa011bbb 100644 --- a/code/modules/mob/living/basic/bots/firebot/firebot.dm +++ b/code/modules/mob/living/basic/bots/firebot/firebot.dm @@ -134,9 +134,7 @@ /mob/living/basic/bot/firebot/atmos_expose(datum/gas_mixture/air, exposed_temperature) if(!COOLDOWN_FINISHED(src, foam_cooldown)) return - var/datum/effect_system/fluid_spread/foam/firefighting/foam = new - foam.set_up(3, holder = src, location = loc) - foam.start() + do_foam(3, src, loc, foam_type = /datum/effect_system/fluid_spread/foam/firefighting) COOLDOWN_START(src, foam_cooldown, FOAM_INTERVAL) /mob/living/basic/bot/firebot/proc/spray_water(atom/attacked_atom, list/modifiers) diff --git a/code/modules/mob/living/basic/bots/hygienebot/hygienebot.dm b/code/modules/mob/living/basic/bots/hygienebot/hygienebot.dm index eb4dd4565fd..4c8d04c6391 100644 --- a/code/modules/mob/living/basic/bots/hygienebot/hygienebot.dm +++ b/code/modules/mob/living/basic/bots/hygienebot/hygienebot.dm @@ -68,9 +68,7 @@ RegisterSignal(src, COMSIG_HOSTILE_PRE_ATTACKINGTARGET, PROC_REF(on_attack)) /mob/living/basic/bot/hygienebot/explode() - var/datum/effect_system/fluid_spread/foam/foam = new - foam.set_up(2, holder = src, location = loc) - foam.start() + do_foam(2, src, loc) return ..() /mob/living/basic/bot/hygienebot/generate_speak_list() diff --git a/code/modules/mob/living/basic/farm_animals/cow/cow_wisdom.dm b/code/modules/mob/living/basic/farm_animals/cow/cow_wisdom.dm index 674077dbc28..4452ae3100f 100644 --- a/code/modules/mob/living/basic/farm_animals/cow/cow_wisdom.dm +++ b/code/modules/mob/living/basic/farm_animals/cow/cow_wisdom.dm @@ -44,7 +44,7 @@ if(!stat && !user.combat_mode) to_chat(user, span_nicegreen("[src] whispers you some intense wisdoms and then disappears!")) user.mind?.adjust_experience(granted_wisdom, granted_experience) - do_smoke(1, holder = src, location = get_turf(src)) + do_smoke(1, src, get_turf(src)) qdel(src) return return ..() diff --git a/code/modules/mob/living/basic/minebots/minebot_abilities.dm b/code/modules/mob/living/basic/minebots/minebot_abilities.dm index 95948b328f7..58ee70181c7 100644 --- a/code/modules/mob/living/basic/minebots/minebot_abilities.dm +++ b/code/modules/mob/living/basic/minebots/minebot_abilities.dm @@ -153,9 +153,7 @@ /obj/effect/temp_visual/falling_rocket/proc/create_explosion() playsound(src, 'sound/items/weapons/minebot_rocket.ogg', 100, FALSE) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(1, holder = src) - smoke.start() + do_smoke(1, src, loc) for(var/mob/living/living_target in oview(explosion_radius, src)) if(living_target.incorporeal_move) continue @@ -171,9 +169,7 @@ /obj/effect/mine/minebot/mineEffect(mob/living/victim) if(!istype(victim)) return - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(0, holder = src) - smoke.start() + do_smoke(0, src, loc) playsound(src, 'sound/effects/explosion/explosion3.ogg', 100) victim.apply_damage(damage_to_apply) diff --git a/code/modules/mob/living/basic/space_fauna/revenant/revenant_abilities.dm b/code/modules/mob/living/basic/space_fauna/revenant/revenant_abilities.dm index c484a8b977c..e04649353ff 100644 --- a/code/modules/mob/living/basic/space_fauna/revenant/revenant_abilities.dm +++ b/code/modules/mob/living/basic/space_fauna/revenant/revenant_abilities.dm @@ -119,9 +119,7 @@ continue light.visible_message(span_boldwarning("[light] suddenly flares brightly and begins to spark!")) - var/datum/effect_system/spark_spread/light_sparks = new /datum/effect_system/spark_spread() - light_sparks.set_up(4, 0, light) - light_sparks.start() + do_sparks(4, FALSE, light) new /obj/effect/temp_visual/revenant(get_turf(light)) addtimer(CALLBACK(src, PROC_REF(overload_shock), light, caster), 2 SECONDS) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 60cfb34eebb..1075ee898ff 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -57,8 +57,7 @@ INVOKE_ASYNC(src, PROC_REF(set_core_display_icon), null, client) - spark_system = new /datum/effect_system/spark_spread() - spark_system.set_up(5, 0, src) + spark_system = new /datum/effect_system/basic/spark_spread(src, 5, FALSE) spark_system.attach(src) add_verb(src, /mob/living/silicon/ai/proc/show_laws_verb) diff --git a/code/modules/mob/living/silicon/ai/ai_defines.dm b/code/modules/mob/living/silicon/ai/ai_defines.dm index 1dbf35d3342..6ffcd8bc66c 100644 --- a/code/modules/mob/living/silicon/ai/ai_defines.dm +++ b/code/modules/mob/living/silicon/ai/ai_defines.dm @@ -172,4 +172,4 @@ /// Used as a fake multitool in tcomms machinery VAR_FINAL/obj/item/multitool/aiMulti /// Helper effect that creates sparks when the AI is damaged - VAR_FINAL/datum/effect_system/spark_spread/spark_system + VAR_FINAL/datum/effect_system/basic/spark_spread/spark_system diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 75cbaaa97aa..176caf3f346 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -1,6 +1,5 @@ /mob/living/silicon/robot/Initialize(mapload) - spark_system = new /datum/effect_system/spark_spread() - spark_system.set_up(5, 0, src) + spark_system = new /datum/effect_system/basic/spark_spread(src, 5, FALSE) spark_system.attach(src) add_traits(list(TRAIT_CAN_STRIP, TRAIT_FORCED_STANDING, TRAIT_KNOW_ENGI_WIRES, TRAIT_IGNORE_SURGERY_MODIFIERS), INNATE_TRAIT) @@ -250,8 +249,7 @@ return if(!ion_trail) - ion_trail = new - ion_trail.set_up(src) + ion_trail = new(src) ionpulse_on = !ionpulse_on to_chat(src, span_notice("You [ionpulse_on ? null :"de"]activate your ion thrusters.")) diff --git a/code/modules/mob/living/silicon/robot/robot_defines.dm b/code/modules/mob/living/silicon/robot/robot_defines.dm index 8ae9d1cf0c6..2cf30e5a5d9 100644 --- a/code/modules/mob/living/silicon/robot/robot_defines.dm +++ b/code/modules/mob/living/silicon/robot/robot_defines.dm @@ -116,7 +116,7 @@ ///Whether the robot has no charge left. var/low_power_mode = FALSE ///So they can initialize sparks whenever/N - var/datum/effect_system/spark_spread/spark_system + var/datum/effect_system/basic/spark_spread/spark_system ///Smoke particle type for brute damage var/smoke_particles ///Spark particle type for burn damage diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/legionnaire.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/legionnaire.dm index 1210cb357ad..5b5178ac5a8 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/legionnaire.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/legionnaire.dm @@ -231,9 +231,7 @@ visible_message(span_boldwarning("[src] spews smoke from the tip of their spine!")) else visible_message(span_boldwarning("[src] spews smoke from its maw!")) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(2, holder = src, location = smoke_location) - smoke.start() + do_smoke(2, src, smoke_location) //The legionnaire's head. Basically the same as any legion head, but we have to tell our creator when we die so they can generate another head. /mob/living/simple_animal/hostile/asteroid/elite/legionnairehead diff --git a/code/modules/mod/modules/modules_general.dm b/code/modules/mod/modules/modules_general.dm index e45e59c5f2a..092bdd654b9 100644 --- a/code/modules/mod/modules/modules_general.dm +++ b/code/modules/mod/modules/modules_general.dm @@ -1026,6 +1026,4 @@ /obj/item/mod/module/shock_absorber/proc/mob_batoned(datum/source) SIGNAL_HANDLER drain_power(use_energy_cost) - var/datum/effect_system/lightning_spread/sparks = new /datum/effect_system/lightning_spread - sparks.set_up(number = 5, cardinals_only = TRUE, location = mod.wearer.loc) - sparks.start() + do_sparks(5, TRUE, mod.wearer.loc) diff --git a/code/modules/mod/modules/modules_ninja.dm b/code/modules/mod/modules/modules_ninja.dm index d4723b04ca6..ae72a93df3a 100644 --- a/code/modules/mod/modules/modules_ninja.dm +++ b/code/modules/mod/modules/modules_ninja.dm @@ -265,30 +265,31 @@ var/maxcapacity = FALSE //Safety check for batteries var/drain = 0 //Drain amount from batteries var/drain_total = 0 - if(cell?.charge) - var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread() - spark_system.set_up(5, 0, loc) - while(cell.charge> 0 && !maxcapacity) - drain = rand(NINJA_MIN_DRAIN, NINJA_MAX_DRAIN) - if(cell.charge < drain) - drain = cell.charge - if(hacking_module.mod.get_charge() + drain > hacking_module.mod.get_max_charge()) - drain = hacking_module.mod.get_max_charge() - hacking_module.mod.get_charge() - maxcapacity = TRUE//Reached maximum battery capacity. - if (do_after(ninja, 1 SECONDS, target = src, hidden = TRUE)) - spark_system.start() - playsound(loc, SFX_SPARKS, 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) - cell.use(drain) - hacking_module.mod.add_charge(drain) - drain_total += drain - else - break - if(!(obj_flags & EMAGGED)) - flick("apc-spark", hacking_module) + if(!cell?.charge) + hacking_module.charge_message(src, drain_total) + return + var/datum/effect_system/basic/spark_spread/spark_system = new(loc, 5, FALSE) + while(cell.charge> 0 && !maxcapacity) + drain = rand(NINJA_MIN_DRAIN, NINJA_MAX_DRAIN) + if(cell.charge < drain) + drain = cell.charge + if(hacking_module.mod.get_charge() + drain > hacking_module.mod.get_max_charge()) + drain = hacking_module.mod.get_max_charge() - hacking_module.mod.get_charge() + maxcapacity = TRUE//Reached maximum battery capacity. + if (do_after(ninja, 1 SECONDS, target = src, hidden = TRUE)) + spark_system.start() playsound(loc, SFX_SPARKS, 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) - obj_flags |= EMAGGED - locked = FALSE - update_appearance() + cell.use(drain) + hacking_module.mod.add_charge(drain) + drain_total += drain + else + break + if(!(obj_flags & EMAGGED)) + flick("apc-spark", hacking_module) + playsound(loc, SFX_SPARKS, 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) + obj_flags |= EMAGGED + locked = FALSE + update_appearance() hacking_module.charge_message(src, drain_total) //SMES, Drains power to supply your modsuit @@ -302,8 +303,7 @@ var/maxcapacity = FALSE //Safety check for batteries var/drain = 0 //Drain amount from batteries var/drain_total = 0 - var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread() - spark_system.set_up(5, 0, loc) + var/datum/effect_system/basic/spark_spread/spark_system = new(loc, 5, FALSE) while(charge > 0 && !maxcapacity) drain = rand(NINJA_MIN_DRAIN, NINJA_MAX_DRAIN) if(charge < drain) @@ -525,9 +525,7 @@ //20 uses for a standard cell. 200 for high capacity cells. if(hacking_module.mod.subtract_charge(DEFAULT_CHARGE_DRAIN*10)) //Got that electric touch - var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread() - spark_system.set_up(5, 0, loc) - spark_system.start() + do_sparks(5, FALSE, loc) visible_message(span_danger("[ninja] electrocutes [src] with [ninja.p_their()] touch!"), span_userdanger("[ninja] electrocutes you with [ninja.p_their()] touch!")) addtimer(CALLBACK(src, PROC_REF(ninja_knockdown)), 0.3 SECONDS) return NONE diff --git a/code/modules/mod/modules/modules_security.dm b/code/modules/mod/modules/modules_security.dm index a519651ce81..9f5f1a257b9 100644 --- a/code/modules/mod/modules/modules_security.dm +++ b/code/modules/mod/modules/modules_security.dm @@ -91,12 +91,7 @@ /obj/item/mod/module/pepper_shoulders/on_use(mob/activator) playsound(src, 'sound/effects/spray.ogg', 30, TRUE, -6) - var/datum/reagents/capsaicin_holder = new(10) - capsaicin_holder.add_reagent(/datum/reagent/consumable/condensedcapsaicin, 10) - var/datum/effect_system/fluid_spread/smoke/chem/quick/smoke = new - smoke.set_up(1, holder = src, location = get_turf(src), carry = capsaicin_holder) - smoke.start(log = TRUE) - QDEL_NULL(capsaicin_holder) // Reagents have a ref to their holder which has a ref to them. No leaks please. + do_chem_smoke(1, src, get_turf(src), /datum/reagent/consumable/condensedcapsaicin, 10, log = TRUE, smoke_type = /datum/effect_system/fluid_spread/smoke/chem/quick) /obj/item/mod/module/pepper_shoulders/proc/on_check_block() SIGNAL_HANDLER diff --git a/code/modules/mod/modules/modules_service.dm b/code/modules/mod/modules/modules_service.dm index c40e3552bce..1ef5a55b5c5 100644 --- a/code/modules/mod/modules/modules_service.dm +++ b/code/modules/mod/modules/modules_service.dm @@ -49,17 +49,13 @@ balloon_alert(mod.wearer, "not in storage!") return var/obj/item/microwave_target = target - var/datum/effect_system/spark_spread/spark_effect = new() - spark_effect.set_up(2, 1, mod.wearer) - spark_effect.start() + do_sparks(2, TRUE, mod.wearer) mod.wearer.Beam(target,icon_state="lightning[rand(1,12)]", time = 5) if(microwave_target.microwave_act(microwaver = mod.wearer) & COMPONENT_MICROWAVE_SUCCESS) playsound(src, 'sound/machines/microwave/microwave-end.ogg', 50, FALSE) else balloon_alert(mod.wearer, "can't be microwaved!") - var/datum/effect_system/spark_spread/spark_effect_two = new() - spark_effect_two.set_up(2, 1, microwave_target) - spark_effect_two.start() + do_sparks(2, TRUE, microwave_target) drain_power(use_energy_cost) //Waddle - Makes you waddle and squeak. diff --git a/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm b/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm index 5163557eb04..d1c035d1452 100644 --- a/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm +++ b/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm @@ -34,8 +34,7 @@ if(computer.internal_cell && prob(25)) QDEL_NULL(computer.internal_cell) computer.visible_message(span_notice("\The [computer]'s battery explodes in rain of sparks.")) - var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread - spark_system.start() + do_sparks(3, FALSE, src) /datum/computer_file/program/revelation/ui_act(action, params, datum/tgui/ui, datum/ui_state/state) . = ..() diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index b2064b0acdf..7bde7c5e829 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -46,7 +46,7 @@ ///What's the projectile sound? var/projectile_sound = 'sound/items/weapons/emitter.ogg' ///Sparks emitted with every shot - var/datum/effect_system/spark_spread/sparks + var/datum/effect_system/basic/spark_spread/sparks ///Stores the type of gun we are using inside the emitter var/obj/item/gun/energy/gun ///List of all the properties of the inserted gun @@ -74,9 +74,8 @@ set_anchored(TRUE) connect_to_network() - sparks = new + sparks = new(src, 5, TRUE) sparks.attach(src) - sparks.set_up(5, TRUE, src) AddElement(/datum/element/simple_rotation) AddElement(/datum/element/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES) diff --git a/code/modules/projectiles/ammunition/ballistic/shotgun.dm b/code/modules/projectiles/ammunition/ballistic/shotgun.dm index 8df354201f9..4382be5fa8c 100644 --- a/code/modules/projectiles/ammunition/ballistic/shotgun.dm +++ b/code/modules/projectiles/ammunition/ballistic/shotgun.dm @@ -100,11 +100,8 @@ /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) - return - - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(0, holder = fired_from, location = fired_from) + if(fired_from) + do_smoke(0, fired_from, fired_from) /obj/item/ammo_casing/shotgun/buckshot/milspec name = "milspec buckshot shell" diff --git a/code/modules/projectiles/guns/magic/wand.dm b/code/modules/projectiles/guns/magic/wand.dm index f7ff0ddf2aa..53667d5e122 100644 --- a/code/modules/projectiles/guns/magic/wand.dm +++ b/code/modules/projectiles/guns/magic/wand.dm @@ -195,17 +195,13 @@ /obj/item/gun/magic/wand/teleport/zap_self(mob/living/user, suicide = FALSE) if(do_teleport(user, user, 10, channel = TELEPORT_CHANNEL_MAGIC)) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(3, holder = src, location = user.loc) - smoke.start() + do_smoke(3, src, user.loc) charges-- return ..() /obj/item/gun/magic/wand/teleport/do_suicide(mob/living/user) playsound(loc, fire_sound, 50, TRUE, -1) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(3, holder = src, location = user.loc) - smoke.start() + do_smoke(3, src, user.loc) if (!iscarbon(user)) return SHAME @@ -247,11 +243,11 @@ var/turf/origin = get_turf(user) var/turf/destination = find_safe_turf(extended_safety_checks = TRUE) - if(do_teleport(user, destination, channel=TELEPORT_CHANNEL_MAGIC)) - for(var/t in list(origin, destination)) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(0, holder = src, location = t) - smoke.start() + if(!do_teleport(user, destination, channel = TELEPORT_CHANNEL_MAGIC)) + return ..() + + for(var/turf/smoke_turf as anything in list(origin, destination)) + do_smoke(0, src, smoke_turf) return ..() /obj/item/gun/magic/wand/safety/do_suicide(mob/living/user) diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index 33d8e98b373..b5890679eae 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -95,13 +95,13 @@ if(!isturf(target)) teleloc = target.loc for(var/atom/movable/stuff in teleloc) - if(!stuff.anchored && stuff.loc && !isobserver(stuff)) - if(do_teleport(stuff, stuff, 10, channel = TELEPORT_CHANNEL_MAGIC)) - teleammount++ - var/smoke_range = max(round(4 - teleammount), 0) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(smoke_range, holder = src, location = stuff.loc) //Smoke drops off if a lot of stuff is moved for the sake of sanity - smoke.start() + if(stuff.anchored || isobserver(stuff)) + continue + if(!do_teleport(stuff, stuff, 10, channel = TELEPORT_CHANNEL_MAGIC)) + continue + teleammount++ + var/smoke_range = max(round(4 - teleammount), 0) + do_smoke(smoke_range, src, stuff.loc) /// Teleports you somewhere on the station where the local conditions won't kill you /obj/projectile/magic/safety @@ -116,11 +116,11 @@ var/turf/origin_turf = get_turf(target) var/turf/destination_turf = find_safe_turf(extended_safety_checks = TRUE) - if(do_teleport(target, destination_turf, channel=TELEPORT_CHANNEL_MAGIC)) - for(var/t in list(origin_turf, destination_turf)) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(0, holder = src, location = t) - smoke.start() + if(!do_teleport(target, destination_turf, channel = TELEPORT_CHANNEL_MAGIC)) + return + + for(var/turf/smoke_turf as anything in list(origin_turf, destination_turf)) + do_smoke(0, src, smoke_turf) /// Turns walls into doors, or opens doors /obj/projectile/magic/door diff --git a/code/modules/reagents/chem_splash.dm b/code/modules/reagents/chem_splash.dm index 2efa0963556..b13010cca42 100644 --- a/code/modules/reagents/chem_splash.dm +++ b/code/modules/reagents/chem_splash.dm @@ -79,11 +79,8 @@ */ /proc/spread_reagents(datum/reagents/source, atom/epicenter, spread_range) spread_range = min(spread_range, 20) // Fuck off with trying to do more then this - var/datum/effect_system/steam_spread/steam = new /datum/effect_system/steam_spread() - steam.set_up(10, 0, epicenter) - steam.attach(epicenter) - steam.start() - + var/datum/effect_system/basic/steam_spread/steam = new /datum/effect_system/basic/steam_spread(epicenter, 10, FALSE) + steam.attach(epicenter).start() // This is a basic floodfill algorithm of atmos connected tiles // Turfs will be stored in the form turf -> TRUE var/chem_temp = source.chem_temp diff --git a/code/modules/reagents/chemistry/machinery/smoke_machine.dm b/code/modules/reagents/chemistry/machinery/smoke_machine.dm index e41296a589a..d1c33fc4a29 100644 --- a/code/modules/reagents/chemistry/machinery/smoke_machine.dm +++ b/code/modules/reagents/chemistry/machinery/smoke_machine.dm @@ -30,14 +30,6 @@ opacity = FALSE alpha = 100 -/datum/effect_system/fluid_spread/smoke/chem/smoke_machine/set_up(range = 1, amount = DIAMOND_AREA(range), atom/holder, atom/location, datum/reagents/carry, efficiency = 10, silent = FALSE) - src.holder = holder - src.location = get_turf(location) - src.amount = amount - if(carry) - carry.trans_to(chemholder, 20, copy_only = TRUE) - carry.remove_all(amount / efficiency) - /obj/machinery/smoke_machine/Initialize(mapload) create_reagents(REAGENTS_BASE_VOLUME, INJECTABLE) @@ -163,12 +155,14 @@ return PROCESS_KILL var/turf/location = get_turf(src) - if(!(locate(/obj/effect/particle_effect/fluid/smoke) in location)) - var/datum/effect_system/fluid_spread/smoke/chem/smoke_machine/smoke = new() - smoke.set_up(setting * 3, holder = src, location = location, carry = reagents, efficiency = efficiency) - smoke.start() - use_energy(active_power_usage * (setting / max_range)) - update_appearance(UPDATE_ICON_STATE) + if(locate(/obj/effect/particle_effect/fluid/smoke) in location) + return + + var/smoke_amount = DIAMOND_AREA(setting * 3) + do_chem_smoke(amount = smoke_amount, holder = src, location = location, carry = reagents, carry_limit = 20, smoke_type = /datum/effect_system/fluid_spread/smoke/chem/smoke_machine) + reagents.remove_all(smoke_amount / efficiency) + use_energy(active_power_usage * (setting / max_range)) + update_appearance(UPDATE_ICON_STATE) /obj/machinery/smoke_machine/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) diff --git a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm index 6d52d85b529..d5a7e2f84f0 100644 --- a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm @@ -129,9 +129,8 @@ if(source.flags_1 & PREVENT_CONTENTS_EXPLOSION_1) return var/location = get_turf(holder.my_atom) - var/datum/effect_system/reagents_explosion/e = new() - e.set_up(1 + round(volume / 6, 1), location, message = FALSE) - e.start(holder.my_atom) + var/datum/effect_system/reagents_explosion/expl = new(location, 1 + round(volume / 6, 1), message = FALSE) + expl.start(holder.my_atom) holder.clear_reagents() /datum/reagent/gunpowder/on_spark_act(power_charge, spark_flags) @@ -225,15 +224,13 @@ if ((spark_flags & SPARK_ACT_ENCLOSED) && !ismob(holder.my_atom)) return var/location = get_turf(holder.my_atom) - var/datum/effect_system/fluid_spread/smoke/chem/smoke_system = new() playsound(location, 'sound/effects/smoke.ogg', 50, TRUE, -3) if (iscarbon(holder.my_atom)) var/mob/living/carbon/victim = holder.my_atom if (victim.stat != DEAD) victim.visible_message(span_warning("[victim] starts violently coughing up smoke!")) victim.adjust_organ_loss(ORGAN_SLOT_LUNGS, volume / 15) - smoke_system.set_up(amount = volume / 1.5, holder = holder.my_atom, location = location, carry = holder, silent = FALSE) - smoke_system.start(log = TRUE) + do_chem_smoke(amount = volume / 1.5, holder = holder.my_atom, location = location, carry = holder, silent = FALSE, log = TRUE) return SPARK_ACT_NON_DESTRUCTIVE | SPARK_ACT_CLEAR_ALL /datum/reagent/sonic_powder diff --git a/code/modules/reagents/chemistry/recipes.dm b/code/modules/reagents/chemistry/recipes.dm index e07c14d0484..ff4438037a0 100644 --- a/code/modules/reagents/chemistry/recipes.dm +++ b/code/modules/reagents/chemistry/recipes.dm @@ -305,8 +305,7 @@ if (!istype(holder.my_atom, /obj/machinery/plumbing)) //excludes standard plumbing equipment from spamming admins with this shit message_admins("Reagent explosion reaction occurred at [ADMIN_VERBOSEJMP(our_turf)][inside_msg]. Last Fingerprint: [touch_msg].") log_game("Reagent explosion reaction occurred at [AREACOORD(our_turf)]. Last Fingerprint: [lastkey ? lastkey : "N/A"]." ) - var/datum/effect_system/reagents_explosion/explosion_system = new() - explosion_system.set_up(power, our_turf, flash_fact = flash_factor, flame_fact = flame_factor) + var/datum/effect_system/reagents_explosion/explosion_system = new(our_turf, power, flash_fact = flash_factor, flame_fact = flame_factor) explosion_system.start(holder.my_atom) if (istype(holder.my_atom, /obj/item/organ/stomach)) @@ -370,7 +369,6 @@ //Spews out the inverse of the chems in the beaker of the products/reactants only /datum/chemical_reaction/proc/explode_invert_smoke(datum/reagents/holder, datum/equilibrium/equilibrium, force_range = 0, clear_products = TRUE, clear_reactants = TRUE, accept_impure = TRUE) var/datum/reagents/invert_reagents = new (2100, NO_REACT)//I think the biggest size we can get is 2100? - var/datum/effect_system/fluid_spread/smoke/chem/smoke = new() var/sum_volume = 0 invert_reagents.my_atom = holder.my_atom //Give the gas a fingerprint for(var/datum/reagent/reagent as anything in holder.reagent_list) //make gas for reagents, has to be done this way, otherwise it never stops Exploding @@ -386,8 +384,7 @@ if(!force_range) force_range = (sum_volume/6) + 3 if(invert_reagents.reagent_list) - smoke.set_up(force_range, holder = holder.my_atom, location = holder.my_atom, carry = invert_reagents) - smoke.start(log = TRUE) + do_chem_smoke(force_range, holder.my_atom, holder.my_atom, carry = invert_reagents, log = TRUE) holder.my_atom.audible_message("The [holder.my_atom] suddenly explodes, launching the aerosolized reagents into the air!") if(clear_reactants) clear_reactants(holder) @@ -397,7 +394,6 @@ //Spews out the corrisponding reactions reagents (products/required) of the beaker in a smokecloud. Doesn't spew catalysts /datum/chemical_reaction/proc/explode_smoke(datum/reagents/holder, datum/equilibrium/equilibrium, force_range = 0, clear_products = TRUE, clear_reactants = TRUE) var/datum/reagents/reagents = new/datum/reagents(2100, NO_REACT)//Lets be safe first - var/datum/effect_system/fluid_spread/smoke/chem/smoke = new() reagents.my_atom = holder.my_atom //fingerprint var/sum_volume = 0 for (var/datum/reagent/reagent as anything in holder.reagent_list) @@ -407,8 +403,7 @@ if(!force_range) force_range = (sum_volume/6) + 3 if(reagents.reagent_list) - smoke.set_up(force_range, holder = holder.my_atom, location = holder.my_atom, carry = reagents) - smoke.start(log = TRUE) + do_chem_smoke(force_range, holder = holder.my_atom, location = holder.my_atom, carry = reagents, log = TRUE) holder.my_atom.audible_message("The [holder.my_atom] suddenly explodes, launching the aerosolized reagents into the air!") if(clear_reactants) clear_reactants(holder) diff --git a/code/modules/reagents/chemistry/recipes/drugs.dm b/code/modules/reagents/chemistry/recipes/drugs.dm index f4f89f6af36..8b563bb9b1a 100644 --- a/code/modules/reagents/chemistry/recipes/drugs.dm +++ b/code/modules/reagents/chemistry/recipes/drugs.dm @@ -72,9 +72,8 @@ if(!istype(holder.my_atom, /obj/machinery/plumbing)) //excludes standard plumbing equipment from spamming admins with this shit message_admins("Reagent explosion reaction occurred at [ADMIN_VERBOSEJMP(T)][inside_msg]. Last Fingerprint: [touch_msg].") log_game("Reagent explosion reaction occurred at [AREACOORD(T)]. Last Fingerprint: [lastkey ? lastkey : "N/A"]." ) - var/datum/effect_system/reagents_explosion/e = new() - e.set_up(power, T) - e.start(holder.my_atom) + var/datum/effect_system/reagents_explosion/expl = new(T, power) + expl.start(holder.my_atom) holder.clear_reagents() ///Amount of meth required to make a crystal diff --git a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm index 876bfc6d78e..d627f119cd9 100644 --- a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm +++ b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm @@ -393,12 +393,8 @@ return holder.remove_reagent(/datum/reagent/smoke_powder, created_volume * 3) var/location = get_turf(holder.my_atom) - var/datum/effect_system/fluid_spread/smoke/chem/S = new - S.attach(location) + do_chem_smoke(amount = created_volume * 3, holder = holder.my_atom, location = location, carry = holder, silent = FALSE, log = TRUE) playsound(location, 'sound/effects/smoke.ogg', 50, TRUE, -3) - if(S) - S.set_up(amount = created_volume * 3, holder = holder.my_atom, location = location, carry = holder, silent = FALSE) - S.start(log = TRUE) if(holder?.my_atom) holder.clear_reagents() if (!iscarbon(holder?.my_atom)) @@ -417,12 +413,8 @@ /datum/chemical_reaction/smoke_powder_smoke/on_reaction(datum/reagents/holder, datum/equilibrium/reaction, created_volume) var/location = get_turf(holder.my_atom) - var/datum/effect_system/fluid_spread/smoke/chem/S = new - S.attach(location) + do_chem_smoke(amount = created_volume, holder = holder.my_atom, location = location, carry = holder, log = TRUE, silent = FALSE) playsound(location, 'sound/effects/smoke.ogg', 50, TRUE, -3) - if(S) - S.set_up(amount = created_volume, holder = holder.my_atom, location = location, carry = holder, silent = FALSE) - S.start(log = TRUE) if(holder?.my_atom) holder.clear_reagents() if(holder?.my_atom) diff --git a/code/modules/reagents/reagent_containers/inhaler.dm b/code/modules/reagents/reagent_containers/inhaler.dm index 181a7e1d6e1..8a8faa72bae 100644 --- a/code/modules/reagents/reagent_containers/inhaler.dm +++ b/code/modules/reagents/reagent_containers/inhaler.dm @@ -260,21 +260,11 @@ /obj/item/reagent_containers/inhaler_canister/handle_deconstruct(disassembled) if (!reagents?.total_volume) + visible_message(span_warning("[src] breaks open - but is empty!")) return ..() - var/datum/reagents/smoke_reagents = new/datum/reagents() // Lets be safe first, our own reagents may be qdelled if we get deleted - var/datum/effect_system/fluid_spread/smoke/chem/smoke_machine/smoke = new() - smoke_reagents.my_atom = src - for (var/datum/reagent/reagent as anything in reagents.reagent_list) - smoke_reagents.add_reagent(reagent.type, reagent.volume, added_purity = reagent.purity) - reagents.remove_reagent(reagent.type, reagent.volume) - if (smoke_reagents.reagent_list) - smoke.set_up(1, holder = src, location = get_turf(src), carry = smoke_reagents) - smoke.start(log = TRUE) - visible_message(span_warning("[src] breaks open and sprays its aerosilized contents everywhere!")) - else - visible_message(span_warning("[src] breaks open - but is empty!")) - + do_chem_smoke(1, src, get_turf(src), carry = reagents, log = TRUE) + visible_message(span_warning("[src] breaks open and sprays its aerosilized contents everywhere!")) return ..() /obj/item/inhaler/medical diff --git a/code/modules/reagents/reagent_dispenser.dm b/code/modules/reagents/reagent_dispenser.dm index 60af82540d2..b052473d55f 100644 --- a/code/modules/reagents/reagent_dispenser.dm +++ b/code/modules/reagents/reagent_dispenser.dm @@ -211,11 +211,8 @@ return FALSE /obj/structure/reagent_dispensers/proc/knock_down() - var/datum/effect_system/fluid_spread/smoke/chem/smoke = new () var/range = reagents.total_volume / REAGENT_SPILL_DIVISOR - smoke.attach(drop_location()) - smoke.set_up(round(range), holder = drop_location(), location = drop_location(), carry = reagents, silent = FALSE) - smoke.start(log = TRUE) + do_chem_smoke(round(range), drop_location(), drop_location(), carry = reagents, silent = FALSE, log = TRUE) reagents.clear_reagents() qdel(src) diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm index 6f7e8fc0d4e..457b4cca52a 100644 --- a/code/modules/research/experimentor.dm +++ b/code/modules/research/experimentor.dm @@ -233,9 +233,7 @@ use_energy(750 JOULES) /obj/machinery/rnd/experimentor/proc/throwSmoke(turf/where) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(0, holder = src, location = where) - smoke.start() + do_smoke(0, src, where) /obj/machinery/rnd/experimentor/proc/experiment(exp,obj/item/exp_on) recentlyExperimented = 1 @@ -307,27 +305,15 @@ else if(prob(EFFECT_PROB_VERYLOW * (100 - malfunction_probability_coeff) * 0.01)) visible_message(span_danger("[src] destroys [exp_on], leaking dangerous gas!")) chosenchem = pick(/datum/reagent/carbon,/datum/reagent/uranium/radium,/datum/reagent/toxin,/datum/reagent/consumable/condensedcapsaicin,/datum/reagent/drug/mushroomhallucinogen,/datum/reagent/drug/space_drugs,/datum/reagent/consumable/ethanol,/datum/reagent/consumable/ethanol/beepsky_smash) - var/datum/reagents/tmp_holder = new/datum/reagents(50) - tmp_holder.my_atom = src - tmp_holder.add_reagent(chosenchem , 50) + do_chem_smoke(0, src, loc, chosenchem, 50) investigate_log("Experimentor has released [chosenchem] smoke.", INVESTIGATE_EXPERIMENTOR) - var/datum/effect_system/fluid_spread/smoke/chem/smoke = new - smoke.set_up(0, holder = src, location = src, carry = tmp_holder, silent = TRUE) playsound(src, 'sound/effects/smoke.ogg', 50, TRUE, -3) - smoke.start() - qdel(tmp_holder) ejectItem(TRUE) else if(prob(EFFECT_PROB_VERYLOW * (100 - malfunction_probability_coeff) * 0.01)) visible_message(span_danger("[src]'s chemical chamber has sprung a leak!")) chosenchem = pick(/datum/reagent/mutationtoxin/classic,/datum/reagent/cyborg_mutation_nanomachines,/datum/reagent/toxin/acid) - var/datum/reagents/tmp_holder = new/datum/reagents(50) - tmp_holder.my_atom = src - tmp_holder.add_reagent(chosenchem , 50) - var/datum/effect_system/fluid_spread/smoke/chem/smoke = new - smoke.set_up(0, holder = src, location = src, carry = tmp_holder, silent = TRUE) + do_chem_smoke(0, src, loc, chosenchem, 50) playsound(src, 'sound/effects/smoke.ogg', 50, TRUE, -3) - smoke.start() - qdel(tmp_holder) ejectItem(TRUE) warn_admins(usr, "[chosenchem] smoke") investigate_log("Experimentor has released [chosenchem] smoke!", INVESTIGATE_EXPERIMENTOR) @@ -398,15 +384,9 @@ investigate_log("Experimentor has made a cup of [chosenchem] coffee.", INVESTIGATE_EXPERIMENTOR) else if(prob(EFFECT_PROB_VERYLOW * (100 - malfunction_probability_coeff) * 0.01)) visible_message(span_danger("[src] malfunctions, shattering [exp_on] and releasing a dangerous cloud of coolant!")) - var/datum/reagents/tmp_holder = new/datum/reagents(50) - tmp_holder.my_atom = src - tmp_holder.add_reagent(/datum/reagent/consumable/frostoil, 50) + do_chem_smoke(0, src, loc, /datum/reagent/consumable/frostoil, 50) investigate_log("Experimentor has released frostoil gas.", INVESTIGATE_EXPERIMENTOR) - var/datum/effect_system/fluid_spread/smoke/chem/smoke = new - smoke.set_up(0, holder = src, location = src, carry = tmp_holder, silent = TRUE) playsound(src, 'sound/effects/smoke.ogg', 50, TRUE, -3) - smoke.start() - qdel(tmp_holder) ejectItem(TRUE) else if(prob(EFFECT_PROB_LOW * (100 - malfunction_probability_coeff) * 0.01)) visible_message(span_warning("[src] malfunctions, shattering [exp_on] and leaking cold air!")) @@ -419,9 +399,7 @@ ejectItem(TRUE) else if(prob(EFFECT_PROB_MEDIUM * (100 - malfunction_probability_coeff) * 0.01)) visible_message(span_warning("[src] malfunctions, releasing a flurry of chilly air as [exp_on] pops out!")) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(0, holder = src, location = loc) - smoke.start() + do_smoke(0, src, loc) ejectItem() //////////////////////////////////////////////////////////////////////////////////////////////// if(exp == SCANTYPE_OBLITERATE) @@ -571,19 +549,11 @@ COOLDOWN_DECLARE(cooldown) //What visual theme this artefact has. Current possible choices: "prototype", "necrotech" var/artifact_theme = "prototype" - var/datum/effect_system/spark_spread/sparks /obj/item/relic/Initialize(mapload) . = ..() - sparks = new() - sparks.set_up(5, 1, src) - sparks.attach(src) random_themed_appearance() -/obj/item/relic/Destroy(force) - QDEL_NULL(sparks) - . = ..() - /obj/item/relic/proc/random_themed_appearance() var/themed_name_prefix var/themed_name_suffix @@ -642,9 +612,7 @@ call(src, hidden_power)(user) /obj/item/relic/proc/throw_smoke(turf/where) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(0, holder = src, location = get_turf(where)) - smoke.start() + do_smoke(0, src, get_turf(where)) // Artefact Powers \\ @@ -740,7 +708,7 @@ /obj/item/relic/proc/drink_dispenser(mob/user) var/obj/item/reagent_containers/cup/glass/drinkingglass/freebie = new(get_step_rand(user)) playsound(freebie, SFX_SPARKS, rand(25,50), TRUE, SHORT_RANGE_SOUND_EXTRARANGE) - sparks.start() + do_sparks(5, TRUE, src, src) addtimer(CALLBACK(src, PROC_REF(dispense_drink), freebie), 0.5 SECONDS) /obj/item/relic/proc/dispense_drink(obj/item/reagent_containers/cup/glass/glasser) diff --git a/code/modules/research/xenobiology/crossbreeding/burning.dm b/code/modules/research/xenobiology/crossbreeding/burning.dm index 8ccfc9c97bb..a8a686d7a18 100644 --- a/code/modules/research/xenobiology/crossbreeding/burning.dm +++ b/code/modules/research/xenobiology/crossbreeding/burning.dm @@ -45,12 +45,7 @@ Burning extracts: /obj/item/slimecross/burning/orange/do_effect(mob/user) user.visible_message(span_danger("[src] boils over with a caustic gas!")) - var/datum/reagents/tmp_holder = new/datum/reagents(100) - tmp_holder.add_reagent(/datum/reagent/consumable/condensedcapsaicin, 100) - - var/datum/effect_system/fluid_spread/smoke/chem/smoke = new - smoke.set_up(7, holder = src, location = get_turf(user), carry = tmp_holder) - smoke.start(log = TRUE) + do_chem_smoke(7, user, get_turf(user), /datum/reagent/consumable/condensedcapsaicin, 100, log = TRUE) ..() /obj/item/slimecross/burning/purple @@ -120,12 +115,8 @@ Burning extracts: /obj/item/slimecross/burning/darkblue/do_effect(mob/user) user.visible_message(span_danger("[src] releases a burst of chilling smoke!")) - var/datum/reagents/tmp_holder = new/datum/reagents(100) - tmp_holder.add_reagent(/datum/reagent/consumable/frostoil, 40) user.reagents.add_reagent(/datum/reagent/medicine/regen_jelly, 10) - var/datum/effect_system/fluid_spread/smoke/chem/smoke = new - smoke.set_up(7, holder = src, location = get_turf(user), carry = tmp_holder) - smoke.start(log = TRUE) + do_chem_smoke(7, user, get_turf(user), /datum/reagent/consumable/frostoil, 40, log = TRUE) ..() /obj/item/slimecross/burning/silver diff --git a/code/modules/research/xenobiology/vatgrowing/samples/_micro_organism.dm b/code/modules/research/xenobiology/vatgrowing/samples/_micro_organism.dm index 4a564b58b13..0b73e235140 100644 --- a/code/modules/research/xenobiology/vatgrowing/samples/_micro_organism.dm +++ b/code/modules/research/xenobiology/vatgrowing/samples/_micro_organism.dm @@ -97,9 +97,7 @@ new /obj/effect/gibspawner/generic(get_turf(vat)) //Spawn some gibs. /datum/micro_organism/cell_line/proc/succeed_growing(obj/machinery/vatgrower/vat) - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(0, holder = vat, location = vat.loc) - smoke.start() + do_smoke(0, vat, vat.loc) for(var/x in 1 to resulting_atom_count) var/atom/thing = new resulting_atom(get_turf(vat)) ADD_TRAIT(thing, TRAIT_VATGROWN, "vatgrowing") diff --git a/code/modules/spells/spell.dm b/code/modules/spells/spell.dm index 90e30ea03f8..1f5413a09ed 100644 --- a/code/modules/spells/spell.dm +++ b/code/modules/spells/spell.dm @@ -363,9 +363,7 @@ if(sparks_amt) do_sparks(sparks_amt, FALSE, get_turf(owner)) if(ispath(smoke_type, /datum/effect_system/fluid_spread/smoke)) - var/datum/effect_system/fluid_spread/smoke/smoke = new smoke_type() - smoke.set_up(smoke_amt, holder = owner, location = get_turf(owner)) - smoke.start() + do_smoke(smoke_amt, owner, get_turf(owner)) // Send signals last in case they delete the spell SEND_SIGNAL(owner, COMSIG_MOB_AFTER_SPELL_CAST, src, cast_on) diff --git a/code/modules/spells/spell_types/jaunt/ethereal_jaunt.dm b/code/modules/spells/spell_types/jaunt/ethereal_jaunt.dm index 58fcbb6ff50..96cf2a46cdf 100644 --- a/code/modules/spells/spell_types/jaunt/ethereal_jaunt.dm +++ b/code/modules/spells/spell_types/jaunt/ethereal_jaunt.dm @@ -165,8 +165,7 @@ /// Does some steam effects from the jaunt at passed loc. /datum/action/cooldown/spell/jaunt/ethereal_jaunt/proc/do_steam_effects(turf/loc) - var/datum/effect_system/steam_spread/steam = new() - steam.set_up(10, FALSE, loc) + var/datum/effect_system/basic/steam_spread/steam = new(loc, 10, FALSE) steam.start() diff --git a/code/modules/spells/spell_types/pointed/swap.dm b/code/modules/spells/spell_types/pointed/swap.dm index 57b74fba056..d8690754a62 100644 --- a/code/modules/spells/spell_types/pointed/swap.dm +++ b/code/modules/spells/spell_types/pointed/swap.dm @@ -38,7 +38,7 @@ /datum/action/cooldown/spell/pointed/swap/InterceptClickOn(mob/living/clicker, params, atom/target) if(!LAZYACCESS(params2list(params), RIGHT_CLICK)) return ..() - + if(!IsAvailable(feedback = TRUE)) return FALSE if(!target) @@ -69,16 +69,13 @@ to_chat(cast_on, span_userdanger("You feel space bending.")) if(ispath(smoke_type, /datum/effect_system/fluid_spread/smoke)) - var/datum/effect_system/fluid_spread/smoke/smoke = new smoke_type() - smoke.set_up(smoke_amt, holder = owner, location = get_turf(owner)) - smoke.start() + do_smoke(smoke_amt, owner, get_turf(owner), smoke_type = smoke_type) + var/turf/target_location = get_turf(cast_on) if(!isnull(second_target) && get_dist(owner, second_target) <= cast_range && !(cast_on == second_target)) to_chat(second_target, span_userdanger("You feel space bending.")) if(ispath(smoke_type, /datum/effect_system/fluid_spread/smoke)) - var/datum/effect_system/fluid_spread/smoke/smoke = new smoke_type() - smoke.set_up(smoke_amt, holder = owner, location = get_turf(second_target)) - smoke.start() + do_smoke(smoke_amt, owner, get_turf(second_target)) var/turf/second_location = get_turf(second_target) do_teleport(second_target, owner.loc, no_effects = TRUE, channel = TELEPORT_CHANNEL_MAGIC) do_teleport(cast_on, second_location, no_effects = TRUE, channel = TELEPORT_CHANNEL_MAGIC) diff --git a/code/modules/spells/spell_types/summon/servant.dm b/code/modules/spells/spell_types/summon/servant.dm index 63f30e913a2..12ad4de5775 100644 --- a/code/modules/spells/spell_types/summon/servant.dm +++ b/code/modules/spells/spell_types/summon/servant.dm @@ -79,7 +79,7 @@ spawn_location.visible_message(span_userdanger("A Magical [servant_title] appears in a cloud of smoke!")) var/mob/living/carbon/human/human_servant = new(spawn_location) human_servant.equipOutfit(/datum/outfit/butler) - do_smoke(0, holder = src, location = spawn_location) + do_smoke(0, src, spawn_location) human_servant.PossessByPlayer(chosen_one.key) summon_weakref = WEAKREF(human_servant) diff --git a/code/modules/station_goals/bsa.dm b/code/modules/station_goals/bsa.dm index 7e9b94ec724..857db82f335 100644 --- a/code/modules/station_goals/bsa.dm +++ b/code/modules/station_goals/bsa.dm @@ -368,9 +368,7 @@ GLOBAL_VAR_INIT(bsa_unlock, FALSE) if(notice) return null //Totally nanite construction system not an immersion breaking spawning - var/datum/effect_system/fluid_spread/smoke/fourth_wall_guard = new - fourth_wall_guard.set_up(4, holder = src, location = get_turf(centerpiece)) - fourth_wall_guard.start() + do_smoke(4, get_turf(centerpiece), get_turf(centerpiece)) var/obj/machinery/bsa/full/cannon = new(get_turf(centerpiece),centerpiece.get_cannon_direction()) QDEL_NULL(centerpiece.front_ref) QDEL_NULL(centerpiece.back_ref) diff --git a/code/modules/surgery/organs/internal/cyberimp/augments_internal.dm b/code/modules/surgery/organs/internal/cyberimp/augments_internal.dm index 510468ffa0f..8765b0dc373 100644 --- a/code/modules/surgery/organs/internal/cyberimp/augments_internal.dm +++ b/code/modules/surgery/organs/internal/cyberimp/augments_internal.dm @@ -210,9 +210,7 @@ owner.set_stamina_loss(0) addtimer(CALLBACK(owner, TYPE_PROC_REF(/mob/living, set_stamina_loss), 0), stun_resistance_time) - var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread - sparks.set_up(5, 1, src) - sparks.start() + do_sparks(5, TRUE, src) give_stun_buffs(owner) addtimer(CALLBACK(src, PROC_REF(remove_stun_buffs), owner), stun_resistance_time) diff --git a/code/modules/vehicles/atv.dm b/code/modules/vehicles/atv.dm index 1567eed0f97..8137bca7509 100644 --- a/code/modules/vehicles/atv.dm +++ b/code/modules/vehicles/atv.dm @@ -108,9 +108,7 @@ return PROCESS_KILL if(SPT_PROB(10, seconds_per_tick)) return - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(0, holder = src, location = src) - smoke.start() + do_smoke(0, src, src) /obj/vehicle/ridden/atv/projectile_hit(obj/projectile/hitting_projectile, def_zone, piercing_hit, blocked) if(prob(50) || !LAZYLEN(buckled_mobs)) diff --git a/code/modules/vehicles/cars/clowncar.dm b/code/modules/vehicles/cars/clowncar.dm index 67424be210d..0672586220c 100644 --- a/code/modules/vehicles/cars/clowncar.dm +++ b/code/modules/vehicles/cars/clowncar.dm @@ -97,11 +97,7 @@ . = ..() if(prob(33)) visible_message(span_danger("[src] spews out a ton of space lube!")) - var/datum/effect_system/fluid_spread/foam/foam = new - var/datum/reagents/foamreagent = new /datum/reagents(25) - foamreagent.add_reagent(/datum/reagent/lube, 25) - foam.set_up(4, holder = src, location = loc, carry = foamreagent) - foam.start() + do_foam(4, src, loc, /datum/reagent/lube, 25) /obj/vehicle/sealed/car/clowncar/item_interaction(mob/living/user, obj/item/tool, list/modifiers) if(!istype(tool, /obj/item/food/grown/banana)) @@ -218,12 +214,7 @@ new /obj/item/grown/bananapeel/specialpeel(loc) if(2) visible_message(span_danger("[user] presses one of the colorful buttons on [src], and unknown chemicals flood out of it.")) - var/datum/reagents/randomchems = new/datum/reagents(300) - randomchems.my_atom = src - randomchems.add_reagent(get_random_reagent_id(), 100) - var/datum/effect_system/fluid_spread/foam/foam = new - foam.set_up(200, holder = src, location = loc, carry = randomchems) - foam.start(log = TRUE) + do_foam(200, src, loc, get_random_reagent_id(), 100, log = TRUE) if(3) visible_message(span_danger("[user] presses one of the colorful buttons on [src], and the clown car turns on its singularity disguise system.")) icon = 'icons/obj/machines/engine/singularity.dmi' @@ -231,13 +222,8 @@ addtimer(CALLBACK(src, PROC_REF(reset_icon)), 10 SECONDS) if(4) visible_message(span_danger("[user] presses one of the colorful buttons on [src], and the clown car spews out a cloud of laughing gas.")) - var/datum/reagents/funnychems = new/datum/reagents(300) - funnychems.my_atom = src - funnychems.add_reagent(/datum/reagent/consumable/superlaughter, 50) - var/datum/effect_system/fluid_spread/smoke/chem/smoke = new() - smoke.set_up(4, holder = src, location = src, carry = funnychems) - smoke.attach(src) - smoke.start(log = TRUE) + do_chem_smoke(4, src, src, /datum/reagent/consumable/superlaughter, 50, log = TRUE) + if(5) visible_message(span_danger("[user] presses one of the colorful buttons on [src], and the clown car starts dropping an oil trail.")) RegisterSignal(src, COMSIG_MOVABLE_MOVED, PROC_REF(cover_in_oil)) diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm index 44690288175..7bd4ffd709a 100644 --- a/code/modules/vehicles/mecha/_mecha.dm +++ b/code/modules/vehicles/mecha/_mecha.dm @@ -59,7 +59,7 @@ var/mecha_flags = CAN_STRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE | BEACON_TRACKABLE | AI_COMPATIBLE | BEACON_CONTROLLABLE ///Spark effects are handled by this datum - var/datum/effect_system/spark_spread/spark_system + var/datum/effect_system/basic/spark_spread/spark_system ///How powerful our lights are var/lights_power = 6 ///Just stop the mech from doing anything @@ -230,13 +230,9 @@ RegisterSignal(src, COMSIG_MOVABLE_MOVED, PROC_REF(on_move)) RegisterSignal(src, COMSIG_LIGHT_EATER_ACT, PROC_REF(on_light_eater)) - spark_system = new - spark_system.set_up(2, 0, src) + spark_system = new(src, 2, FALSE) spark_system.attach(src) - - smoke_system = new - smoke_system.set_up(3, holder = src, location = src) - smoke_system.attach(src) + smoke_system = new(src, 3, holder = src) cabin_air = new(cabin_volume) diff --git a/code/modules/vehicles/scooter.dm b/code/modules/vehicles/scooter.dm index d3f1ff5ba10..3e1b6cf86cb 100644 --- a/code/modules/vehicles/scooter.dm +++ b/code/modules/vehicles/scooter.dm @@ -42,7 +42,7 @@ density = FALSE custom_materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT * 10) ///Sparks datum for when we grind on tables - var/datum/effect_system/spark_spread/sparks + var/datum/effect_system/basic/spark_spread/sparks ///Whether the board is currently grinding var/grinding = FALSE ///Stores the time of the last crash plus a short cooldown, affects availability and outcome of certain actions @@ -56,16 +56,14 @@ /obj/vehicle/ridden/scooter/skateboard/Initialize(mapload) . = ..() - sparks = new - sparks.set_up(1, 0, src) + sparks = new(src, 1, FALSE) sparks.attach(src) /obj/vehicle/ridden/scooter/skateboard/make_ridable() AddElement(/datum/element/ridable, /datum/component/riding/vehicle/scooter/skateboard) /obj/vehicle/ridden/scooter/skateboard/Destroy() - if(sparks) - QDEL_NULL(sparks) + QDEL_NULL(sparks) return ..() /obj/vehicle/ridden/scooter/skateboard/relaymove(mob/living/user, direction) diff --git a/code/modules/vehicles/secway.dm b/code/modules/vehicles/secway.dm index cf784e77ca4..86e26b735d3 100644 --- a/code/modules/vehicles/secway.dm +++ b/code/modules/vehicles/secway.dm @@ -30,9 +30,7 @@ return PROCESS_KILL if(SPT_PROB(10, seconds_per_tick)) return - var/datum/effect_system/fluid_spread/smoke/smoke = new - smoke.set_up(0, holder = src, location = src) - smoke.start() + do_smoke(0, src, src) /obj/vehicle/ridden/secway/welder_act(mob/living/user, obj/item/W) if(user.combat_mode) diff --git a/tgstation.dme b/tgstation.dme index 6114fda8931..fa648bd841c 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -2432,6 +2432,7 @@ #include "code\game\objects\effects\powerup.dm" #include "code\game\objects\effects\rcd.dm" #include "code\game\objects\effects\shared_particle_holder.dm" +#include "code\game\objects\effects\shield.dm" #include "code\game\objects\effects\spiderwebs.dm" #include "code\game\objects\effects\step_triggers.dm" #include "code\game\objects\effects\wanted_poster.dm" @@ -2464,11 +2465,11 @@ #include "code\game\objects\effects\decals\turfdecal\markings.dm" #include "code\game\objects\effects\decals\turfdecal\tilecoloring.dm" #include "code\game\objects\effects\decals\turfdecal\weather.dm" -#include "code\game\objects\effects\effect_system\effect_shield.dm" #include "code\game\objects\effects\effect_system\effect_system.dm" #include "code\game\objects\effects\effect_system\effects_explosion.dm" -#include "code\game\objects\effects\effect_system\effects_other.dm" +#include "code\game\objects\effects\effect_system\effects_reagents_explosion.dm" #include "code\game\objects\effects\effect_system\effects_sparks.dm" +#include "code\game\objects\effects\effect_system\effects_trail.dm" #include "code\game\objects\effects\effect_system\effects_water.dm" #include "code\game\objects\effects\effect_system\fluid_spread\_fluid_spread.dm" #include "code\game\objects\effects\effect_system\fluid_spread\effects_foam.dm"