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