From a85369b66a0684fdf0f718b7787fb6243d5a0a7d Mon Sep 17 00:00:00 2001 From: soulware <81992759+soulware1@users.noreply.github.com> Date: Sun, 24 May 2026 04:07:09 -0500 Subject: [PATCH] New foam reactions for water varients (#96095) ## About The Pull Request Adds slipless foam + one slipless foam for each life time + adjusted long foam's life time from 30 seconds to 24. Adds new foam reactions, list of what they produce below. salt water = lasts shorter + no slip soda water = lasts shorter ice = no slip holy water = lasts longer + no slip hollow water = lasts longer ## Why It's Good For The Game Sometimes, you want to flood medbay with a colorful reagent grenade WITHOUT it slipping everyone and blocking it for a stupid amount of time. ## Changelog :cl: add: New reactions for water variants that make foam code: New foam types that either slip or last longer or shorter /:cl: --------- Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com> --- code/__HELPERS/reagents.dm | 4 +-- .../fluid_spread/effects_foam.dm | 15 ++++++---- .../reagents/chemistry/recipes/others.dm | 28 ++++++++++++++++++- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/code/__HELPERS/reagents.dm b/code/__HELPERS/reagents.dm index 769ddb48979..0d45d6da061 100644 --- a/code/__HELPERS/reagents.dm +++ b/code/__HELPERS/reagents.dm @@ -76,11 +76,11 @@ return TRUE //Creates foam from the reagent. Metaltype is for metal foam, notification is what to show people in textbox -/datum/reagents/proc/create_foam(foamtype, foam_volume, result_type = null, notification = null, log = FALSE) +/datum/reagents/proc/create_foam(foamtype, foam_volume, result_type = null, notification = null, log = FALSE, lifetime, slippery) var/location = get_turf(my_atom) var/datum/effect_system/fluid_spread/foam/foam = new foamtype(location, null, foam_volume, my_atom, carry = src, result_type = result_type) - foam.start(log = log) + foam.start(log = log, lifetime = lifetime, slippery = slippery) clear_reagents() if(!notification) 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 468654f4d5a..cea1190aa66 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 @@ -31,12 +31,17 @@ var/allow_duplicate_results = TRUE /// The amount of time this foam stick around for before it dissipates. var/lifetime = 8 SECONDS + /// The orignal value of lifetime + var/original_lifetime = 8 SECONDS /// Whether or not this foam should be slippery. var/slippery_foam = TRUE -/obj/effect/particle_effect/fluid/foam/Initialize(mapload) +/obj/effect/particle_effect/fluid/foam/Initialize(mapload, fluid_group, source, lifetime, slippery) . = ..() + src.lifetime = lifetime ? lifetime : src.lifetime + src.original_lifetime = src.lifetime + src.slippery_foam = !isnull(slippery) ? slippery : slippery_foam if(slippery_foam) AddComponent(/datum/component/slippery, 100, can_slip_callback = CALLBACK(src, PROC_REF(try_slip))) if(HAS_TRAIT(loc, TRAIT_ELEVATED_TURF)) @@ -165,7 +170,7 @@ continue foam_mob(foaming, seconds_per_tick) - var/obj/effect/particle_effect/fluid/foam/spread_foam = new type(spread_turf, group, src) + var/obj/effect/particle_effect/fluid/foam/spread_foam = new type(spread_turf, group, src, src.original_lifetime, src.slippery_foam) reagents.trans_to(spread_foam, reagents.total_volume, copy_only = TRUE) spread_foam.add_atom_colour(color, FIXED_COLOUR_PRIORITY) spread_foam.result_type = result_type @@ -219,7 +224,7 @@ /// 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(turf/location, range = 1, amount = null, atom/holder = null, datum/reagents/carry = null, result_type = null, stop_reactions = FALSE, reagent_scale = FOAM_REAGENT_SCALE) +/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) @@ -231,8 +236,8 @@ QDEL_NULL(chemholder) return ..() -/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)) +/datum/effect_system/fluid_spread/foam/start(log = FALSE, lifetime, slippery) + var/obj/effect/particle_effect/fluid/foam/foam = new effect_type(location, new /datum/fluid_group(amount), null, lifetime, slippery) var/foamcolor = mix_color_from_reagents(chemholder.reagent_list) if(reagent_scale > 1) // Make room in case we were created by a particularly stuffed payload. foam.reagents.maximum_volume *= reagent_scale diff --git a/code/modules/reagents/chemistry/recipes/others.dm b/code/modules/reagents/chemistry/recipes/others.dm index 3d5574a90e8..d8c2c9671b4 100644 --- a/code/modules/reagents/chemistry/recipes/others.dm +++ b/code/modules/reagents/chemistry/recipes/others.dm @@ -344,11 +344,37 @@ /datum/chemical_reaction/foam required_reagents = list(/datum/reagent/fluorosurfactant = 1, /datum/reagent/water = 1) + // Does the foam slip you? + var/slippery = TRUE + // How long the foam lasts for + var/lifetime = 8 SECONDS mob_react = FALSE reaction_flags = REACTION_INSTANT +/datum/chemical_reaction/foam/hollow + required_reagents = list(/datum/reagent/fluorosurfactant = 1, /datum/reagent/water/hollowwater = 1) + lifetime = 24 SECONDS + +/datum/chemical_reaction/foam/salt + required_reagents = list(/datum/reagent/fluorosurfactant = 1, /datum/reagent/water/salt = 1) + lifetime = 1 SECONDS + slippery = FALSE + +/datum/chemical_reaction/foam/ice + required_reagents = list(/datum/reagent/fluorosurfactant = 1, /datum/reagent/consumable/ice = 1) + slippery = FALSE + +/datum/chemical_reaction/foam/soda + required_reagents = list(/datum/reagent/fluorosurfactant = 1, /datum/reagent/consumable/sodawater = 1) + lifetime = 1 SECONDS + +/datum/chemical_reaction/foam/holy + required_reagents = list(/datum/reagent/fluorosurfactant = 1, /datum/reagent/water/holywater = 1) + lifetime = 24 SECONDS + slippery = FALSE + /datum/chemical_reaction/foam/on_reaction(datum/reagents/holder, datum/equilibrium/reaction, created_volume) - holder.create_foam(/datum/effect_system/fluid_spread/foam, 2 * created_volume, notification = span_danger("The solution spews out foam!"), log = TRUE) + holder.create_foam(/datum/effect_system/fluid_spread/foam, 2 * created_volume, notification = span_danger("The solution spews out foam!"), log = TRUE, lifetime = src.lifetime, slippery = src.slippery) reaction_tags = REACTION_TAG_EASY | REACTION_TAG_UNIQUE /datum/chemical_reaction/metalfoam