From 20fdcea5c8373d68c8d1dea53ed435c06f4d1138 Mon Sep 17 00:00:00 2001 From: Jacquerel Date: Mon, 24 Feb 2025 12:12:31 +0000 Subject: [PATCH] Foam can pass through tables and computers and grilles (#89636) --- code/__DEFINES/traits/declarations.dm | 4 ++++ code/_globalvars/traits/_traits.dm | 2 ++ code/datums/elements/elevation.dm | 5 +++++ .../effects/effect_system/fluid_spread/effects_foam.dm | 9 +++++++++ 4 files changed, 20 insertions(+) diff --git a/code/__DEFINES/traits/declarations.dm b/code/__DEFINES/traits/declarations.dm index 1c081f14c54..2601a0e81d1 100644 --- a/code/__DEFINES/traits/declarations.dm +++ b/code/__DEFINES/traits/declarations.dm @@ -582,6 +582,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai /// Does the mob ignore elevation? (e.g. xeno larvas on hiding) #define TRAIT_IGNORE_ELEVATION "ignore_elevation" +/// Is the mob currently elevated? (eg standing on a table) +#define TRAIT_MOB_ELEVATED "mob_elevated" /// Prevents you from twohanding weapons. #define TRAIT_NO_TWOHANDING "no_twohanding" @@ -1096,6 +1098,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_NO_MIRROR_REFLECTION "no_mirror_reflection" /// If this movable is currently treading in a turf with the immerse element. #define TRAIT_IMMERSED "immersed" +/// From [/datum/element/elevation] for purpose of checking if the object causes things in its turf to become elevated +#define TRAIT_ELEVATING_OBJECT "elevating_object" /// From [/datum/element/elevation_core] for purpose of checking if the turf has the trait from an instance of the element #define TRAIT_ELEVATED_TURF "elevated_turf" /** diff --git a/code/_globalvars/traits/_traits.dm b/code/_globalvars/traits/_traits.dm index 9151dcb5bc7..864312446cb 100644 --- a/code/_globalvars/traits/_traits.dm +++ b/code/_globalvars/traits/_traits.dm @@ -19,6 +19,7 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_DO_NOT_SPLASH" = TRAIT_DO_NOT_SPLASH, "TRAIT_DRIED" = TRAIT_DRIED, "TRAIT_DRYABLE" = TRAIT_DRYABLE, + "TRAIT_ELEVATING_OBJECT" = TRAIT_ELEVATING_OBJECT, "TRAIT_FISHING_SPOT" = TRAIT_FISHING_SPOT, "TRAIT_FOOD_CHEF_MADE" = TRAIT_FOOD_CHEF_MADE, "TRAIT_FOOD_FRIED" = TRAIT_FOOD_FRIED, @@ -355,6 +356,7 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_MOB_BREEDER" = TRAIT_MOB_BREEDER, "TRAIT_MOB_CAN_DIG" = TRAIT_MOB_CAN_DIG, "TRAIT_MOB_EATER" = TRAIT_MOB_EATER, + "TRAIT_MOB_ELEVATED" = TRAIT_MOB_ELEVATED, "TRAIT_MOB_HATCHED" = TRAIT_MOB_HATCHED, "TRAIT_MOB_HIDE_HAPPINESS" = TRAIT_MOB_HIDE_HAPPINESS, "TRAIT_MOB_MERGE_STACKS" = TRAIT_MOB_MERGE_STACKS, diff --git a/code/datums/elements/elevation.dm b/code/datums/elements/elevation.dm index bba8a4b1605..ad19d52ab18 100644 --- a/code/datums/elements/elevation.dm +++ b/code/datums/elements/elevation.dm @@ -13,6 +13,8 @@ if(!isatom(target) || isarea(target)) return ELEMENT_INCOMPATIBLE + ADD_TRAIT(target, TRAIT_ELEVATING_OBJECT, ref(src)) + src.pixel_shift = pixel_shift if(ismovable(target)) @@ -29,6 +31,7 @@ /datum/element/elevation/Detach(atom/movable/source) unregister_turf(source, source.loc) + REMOVE_TRAIT(source, TRAIT_ELEVATING_OBJECT, ref(src)) return ..() /datum/element/elevation/proc/reset_elevation(turf/target) @@ -175,6 +178,7 @@ // we want to avoid accidentally double-elevating anything they're buckled to (namely vehicles) if(target.has_offset(source = ELEVATION_SOURCE(src))) return + ADD_TRAIT(target, TRAIT_MOB_ELEVATED, ELEVATION_SOURCE(src)) // We are buckled to something if(target.buckled) // We are buckled to a vehicle, so it also must be elevated @@ -190,6 +194,7 @@ /// Reverts elevation of the mob. /datum/element/elevation_core/proc/deelevate_mob(mob/living/target, elevate_time = ELEVATE_TIME) + REMOVE_TRAIT(target, TRAIT_MOB_ELEVATED, ELEVATION_SOURCE(src)) target.remove_offsets(ELEVATION_SOURCE(src), animate = elevate_time > 0) if(isvehicle(target.buckled)) animate(target.buckled, pixel_z = -pixel_shift, time = elevate_time, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL) 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 07383a0aa6f..3dcb5880459 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 @@ -39,6 +39,8 @@ . = ..() if(slippery_foam) AddComponent(/datum/component/slippery, 100) + if(HAS_TRAIT(loc, TRAIT_ELEVATED_TURF)) + layer = WATER_LEVEL_LAYER create_reagents(1000, REAGENT_HOLDER_INSTANT_REACT) playsound(src, 'sound/effects/bubbles/bubbles2.ogg', 80, TRUE, -3) AddElement(/datum/element/atmos_sensitive, mapload) @@ -96,10 +98,14 @@ continue if(turf_location.underfloor_accessibility < UNDERFLOOR_INTERACTABLE && HAS_TRAIT(object, TRAIT_T_RAY_VISIBLE)) continue + if (HAS_TRAIT(loc, TRAIT_ELEVATED_TURF) && !HAS_TRAIT(object, TRAIT_ELEVATING_OBJECT)) + continue // Do expose tables, don't expose items on tables reagents.expose(object, VAPOR, fraction) var/hit = 0 for(var/mob/living/foamer in loc) + if (HAS_TRAIT(foamer, TRAIT_MOB_ELEVATED)) + continue hit += foam_mob(foamer, seconds_per_tick) if(hit) lifetime += ds_seconds_per_tick //this is so the decrease from mobs hit and the natural decrease don't cumulate. @@ -137,6 +143,7 @@ return FALSE var/datum/can_pass_info/info = new(no_id = TRUE) + info.pass_flags = PASSTABLE | PASSGRILLE | PASSMACHINE | PASSSTRUCTURE for(var/iter_dir in GLOB.cardinals) var/turf/spread_turf = get_step(src, iter_dir) if(spread_turf?.density || spread_turf.LinkBlockedWithAccess(spread_turf, info)) @@ -149,6 +156,8 @@ continue for(var/mob/living/foaming in spread_turf) + if (HAS_TRAIT(foaming, TRAIT_MOB_ELEVATED)) + continue foam_mob(foaming, seconds_per_tick) var/obj/effect/particle_effect/fluid/foam/spread_foam = new type(spread_turf, group, src)