Prevents something fucky with elevation and glass tables (#80187)

## About The Pull Request
Objects can be destroyed during a movement loop before the abstract
entered signal can be sent, so we need to make sure only mobs that have
been elevated are dropped down.

## Why It's Good For The Game
Fixes #80169

## Changelog

🆑
fix: climbing or being shoved into a glass table won't cause elevation
issues.
/🆑

---------

Co-authored-by: san7890 <the@san7890.com>
This commit is contained in:
Ghom
2023-12-11 20:03:36 -07:00
committed by GitHub
co-authored by san7890
parent 6e49e2e734
commit 87bd1cfcd1
3 changed files with 10 additions and 0 deletions
+3
View File
@@ -484,6 +484,9 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
/// Whether or not the user is in a MODlink call, prevents making more calls
#define TRAIT_IN_CALL "in_call"
/// 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"
// METABOLISMS
// Various jobs on the station have historically had better reactions
// to various drinks and foodstuffs. Security liking donuts is a classic
+1
View File
@@ -325,6 +325,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_NOSOFTCRIT" = TRAIT_NOSOFTCRIT,
"TRAIT_NUKEIMMUNE" = TRAIT_NUKEIMMUNE,
"TRAIT_OIL_FRIED" = TRAIT_OIL_FRIED,
"TRAIT_ON_ELEVATED_SURFACE" = TRAIT_ON_ELEVATED_SURFACE,
"TRAIT_ORBITING_FORBIDDEN" = TRAIT_ORBITING_FORBIDDEN,
"TRAIT_OVERDOSEIMMUNE" = TRAIT_OVERDOSEIMMUNE,
"TRAIT_OVERWATCH_IMMUNE" = TRAIT_OVERWATCH_IMMUNE,
+6
View File
@@ -110,6 +110,7 @@
ADD_TRAIT(target, TRAIT_ELEVATED_TURF, REF(src))
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))
elevate_mob(living)
@@ -127,6 +128,9 @@
))
REMOVE_TRAIT(source, TRAIT_ELEVATED_TURF, REF(src))
for(var/mob/living/living in source)
if(!HAS_TRAIT_FROM(living, TRAIT_ON_ELEVATED_SURFACE, REF(src)))
continue
REMOVE_TRAIT(living, TRAIT_ON_ELEVATED_SURFACE, REF(src))
elevate_mob(living, -pixel_shift)
UnregisterSignal(living, COMSIG_LIVING_SET_BUCKLED)
return ..()
@@ -134,6 +138,7 @@
/datum/element/elevation_core/proc/on_entered(turf/source, atom/movable/entered, atom/old_loc)
SIGNAL_HANDLER
if((isnull(old_loc) || !HAS_TRAIT_FROM(old_loc, TRAIT_ELEVATED_TURF, REF(src))) && isliving(entered))
ADD_TRAIT(entered, TRAIT_ON_ELEVATED_SURFACE, REF(src))
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))
@@ -146,6 +151,7 @@
/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))
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)
UnregisterSignal(gone, COMSIG_LIVING_SET_BUCKLED)