From 137a65a0667dc9ec79e2467add0e071128b5f61c Mon Sep 17 00:00:00 2001 From: ThePooba <81843097+ThePooba@users.noreply.github.com> Date: Wed, 12 Jun 2024 21:02:38 -0600 Subject: [PATCH] Re-addded all edited files to branch (#2250) --- code/__DEFINES/traits.dm | 2 ++ code/_globalvars/traits.dm | 1 + code/datums/elements/elevation.dm | 24 +++++++++++++++---- .../mob/living/carbon/alien/larva/powers.dm | 5 ++++ .../borers/code/abilities/toggle_stealth.dm | 8 +++++-- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index d1fa9ed66a32..beb6990756fc 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -555,6 +555,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai /// Is the mob standing on an elevated surface? This prevents them from dropping down if not elevated first. #define TRAIT_ON_ELEVATED_SURFACE "on_elevated_surface" +/// Does the mob ignore elevation? (e.g. xeno larvas & cortical borers on hiding) +#define TRAIT_IGNORE_ELEVATION "ignore_elevation" // METABOLISMS // Various jobs on the station have historically had better reactions diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index 7834d9547656..6e256879944d 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -205,6 +205,7 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_ANALGESIA" = TRAIT_ANALGESIA, "TRAIT_FAST_CLIMBER" = TRAIT_FAST_CLIMBER, "TRAIT_ON_ELEVATED_SURFACE" = TRAIT_ON_ELEVATED_SURFACE, + "TRAIT_IGNORE_ELEVATION" = TRAIT_IGNORE_ELEVATION, "TRAIT_NO_BLOODLOSS_DAMAGE" = TRAIT_NO_BLOODLOSS_DAMAGE, // Monkestation Addition "TRAIT_CANT_SIGN_SPELLS" = TRAIT_CANT_SIGN_SPELLS, // monke edit ), diff --git a/code/datums/elements/elevation.dm b/code/datums/elements/elevation.dm index 2fcacf37de93..f17198d84ec0 100644 --- a/code/datums/elements/elevation.dm +++ b/code/datums/elements/elevation.dm @@ -114,6 +114,8 @@ for(var/mob/living/living in target) ADD_TRAIT(living, TRAIT_ON_ELEVATED_SURFACE, REF(src)) RegisterSignal(living, COMSIG_LIVING_SET_BUCKLED, PROC_REF(on_set_buckled)) + RegisterSignal(living, SIGNAL_ADDTRAIT(TRAIT_IGNORE_ELEVATION), PROC_REF(on_ignore_elevation_add)) + RegisterSignal(living, SIGNAL_REMOVETRAIT(TRAIT_IGNORE_ELEVATION), PROC_REF(on_ignore_elevation_remove)) elevate_mob(living) /datum/element/elevation_core/Detach(datum/source) @@ -134,7 +136,7 @@ continue REMOVE_TRAIT(living, TRAIT_ON_ELEVATED_SURFACE, REF(src)) elevate_mob(living, -pixel_shift) - UnregisterSignal(living, COMSIG_LIVING_SET_BUCKLED) + UnregisterSignal(living, list(COMSIG_LIVING_SET_BUCKLED, SIGNAL_ADDTRAIT(TRAIT_IGNORE_ELEVATION), SIGNAL_REMOVETRAIT(TRAIT_IGNORE_ELEVATION))) return ..() /datum/element/elevation_core/proc/on_entered(turf/source, atom/movable/entered, atom/old_loc) @@ -144,6 +146,8 @@ var/elevate_time = isturf(old_loc) && source.Adjacent(old_loc) ? ELEVATE_TIME : 0 elevate_mob(entered, elevate_time = elevate_time) RegisterSignal(entered, COMSIG_LIVING_SET_BUCKLED, PROC_REF(on_set_buckled)) + RegisterSignal(entered, SIGNAL_ADDTRAIT(TRAIT_IGNORE_ELEVATION), PROC_REF(on_ignore_elevation_add)) + RegisterSignal(entered, SIGNAL_REMOVETRAIT(TRAIT_IGNORE_ELEVATION), PROC_REF(on_ignore_elevation_remove)) /datum/element/elevation_core/proc/on_initialized_on(turf/source, atom/movable/spawned) SIGNAL_HANDLER @@ -153,15 +157,17 @@ /datum/element/elevation_core/proc/on_exited(turf/source, atom/movable/gone) SIGNAL_HANDLER if((isnull(gone.loc) || !HAS_TRAIT_FROM(gone.loc, TRAIT_ELEVATED_TURF, REF(src))) && isliving(gone)) - // Always unregister the signal, we're still leaving even if already shifted down. - UnregisterSignal(gone, COMSIG_LIVING_SET_BUCKLED) + // Always unregister the signals, we're still leaving even if not effected by elevation. + UnregisterSignal(gone, list(COMSIG_LIVING_SET_BUCKLED, SIGNAL_ADDTRAIT(TRAIT_IGNORE_ELEVATION), SIGNAL_REMOVETRAIT(TRAIT_IGNORE_ELEVATION))) if(!HAS_TRAIT_FROM(gone, TRAIT_ON_ELEVATED_SURFACE, REF(src))) return REMOVE_TRAIT(gone, TRAIT_ON_ELEVATED_SURFACE, REF(src)) var/elevate_time = isturf(gone.loc) && source.Adjacent(gone.loc) ? ELEVATE_TIME : 0 elevate_mob(gone, -pixel_shift, elevate_time) -/datum/element/elevation_core/proc/elevate_mob(mob/living/target, z_shift = pixel_shift, elevate_time = ELEVATE_TIME) +/datum/element/elevation_core/proc/elevate_mob(mob/living/target, z_shift = pixel_shift, elevate_time = ELEVATE_TIME, force = FALSE) + if(HAS_TRAIT(target, TRAIT_IGNORE_ELEVATION) && !force) + return var/buckled_to_vehicle = FALSE if(target.buckled) if(isvehicle(target.buckled)) @@ -182,6 +188,8 @@ */ /datum/element/elevation_core/proc/on_set_buckled(mob/living/source, atom/movable/new_buckled) SIGNAL_HANDLER + if(HAS_TRAIT(source, TRAIT_IGNORE_ELEVATION)) + return if(source.buckled) if(isvehicle(source.buckled)) animate(source.buckled, pixel_z = -pixel_shift, time = ELEVATE_TIME, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL) @@ -194,6 +202,14 @@ else if(!isliving(new_buckled)) animate(source, pixel_z = -pixel_shift, time = ELEVATE_TIME, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL) +/datum/element/elevation_core/proc/on_ignore_elevation_add(mob/living/source, trait) + SIGNAL_HANDLER + elevate_mob(source, -pixel_shift, force = TRUE) + +/datum/element/elevation_core/proc/on_ignore_elevation_remove(mob/living/source, trait) + SIGNAL_HANDLER + elevate_mob(source, pixel_shift) + /datum/element/elevation_core/proc/on_reset_elevation(turf/source, list/current_values) SIGNAL_HANDLER current_values[ELEVATION_CURRENT_PIXEL_SHIFT] = pixel_shift diff --git a/code/modules/mob/living/carbon/alien/larva/powers.dm b/code/modules/mob/living/carbon/alien/larva/powers.dm index e8b3c0b2e8a5..bfb5e49e96e0 100644 --- a/code/modules/mob/living/carbon/alien/larva/powers.dm +++ b/code/modules/mob/living/carbon/alien/larva/powers.dm @@ -5,21 +5,26 @@ plasma_cost = 0 /// The layer we are on while hiding var/hide_layer = ABOVE_NORMAL_TURF_LAYER + var/hide_plane = WALL_PLANE /datum/action/cooldown/alien/hide/Activate(atom/target) if(owner.layer == hide_layer) owner.layer = initial(owner.layer) + owner.plane = initial(owner.plane) owner.visible_message( span_notice("[owner] slowly peeks up from the ground..."), span_noticealien("You stop hiding."), ) + REMOVE_TRAIT(owner, TRAIT_IGNORE_ELEVATION, ACTION_TRAIT) else owner.layer = hide_layer + owner.plane = hide_plane owner.visible_message( span_name("[owner] scurries to the ground!"), span_noticealien("You are now hiding."), ) + ADD_TRAIT(owner, TRAIT_IGNORE_ELEVATION, ACTION_TRAIT) return TRUE diff --git a/monkestation/code/modules/antagonists/borers/code/abilities/toggle_stealth.dm b/monkestation/code/modules/antagonists/borers/code/abilities/toggle_stealth.dm index 7cbef00ae148..3810ee6bbb7d 100644 --- a/monkestation/code/modules/antagonists/borers/code/abilities/toggle_stealth.dm +++ b/monkestation/code/modules/antagonists/borers/code/abilities/toggle_stealth.dm @@ -2,12 +2,13 @@ name = "Toggle Hiding" button_icon_state = "hide" var/hide_layer = ABOVE_NORMAL_TURF_LAYER + var/hide_plane = WALL_PLANE ability_explanation = "\ Turns your hiding abilities on/off\n\ Whilst on, you will hide under most objects, like tables.\n\ If you are a diveworm, you will bore into hosts twice as fast whilst not hidden\n\ " - + // WALL_PLANE lets the borer hide under tables /datum/action/cooldown/borer/toggle_hiding/Trigger(trigger_flags, atom/target) . = ..() if(!.) @@ -17,10 +18,13 @@ cortical_owner.upgrade_flags |= BORER_HIDING owner.balloon_alert(owner, "started hiding") owner.layer = hide_layer + owner.plane = WALL_PLANE + ADD_TRAIT(owner, TRAIT_IGNORE_ELEVATION, ACTION_TRAIT) else cortical_owner.upgrade_flags &= ~BORER_HIDING owner.balloon_alert(owner, "stopped hiding") owner.layer = BELOW_MOB_LAYER - + owner.plane = initial(owner.plane) + REMOVE_TRAIT(owner, TRAIT_IGNORE_ELEVATION, ACTION_TRAIT) StartCooldown()