Refactored CollidedWith (#19541)

Refactored CollidedWith()
This commit is contained in:
Fluffy
2024-06-29 12:01:18 +02:00
committed by GitHub
parent d63d63d78c
commit d8d67ebd3a
31 changed files with 317 additions and 183 deletions
+13 -6
View File
@@ -255,17 +255,24 @@
return ..()
/obj/structure/stairs/CollidedWith(atom/movable/moving_atom)
/obj/structure/stairs/CollidedWith(atom/bumped_atom)
. = ..()
if(!ismovable(bumped_atom))
return
var/atom/movable/AM = bumped_atom
// This is hackish but whatever.
var/turf/target = get_step(GetAbove(moving_atom), dir)
var/turf/target = get_step(GetAbove(AM), dir)
if(!target)
return
if(target.z > (z + 1)) //Prevents wheelchair fuckery. Basically, you teleport twice because both the wheelchair + your mob collide with the stairs.
return
if(target.Enter(moving_atom, src) && moving_atom.dir == dir)
moving_atom.forceMove(target)
if(isliving(moving_atom))
var/mob/living/living_mob = moving_atom
if(target.Enter(AM, src) && AM.dir == dir)
AM.forceMove(target)
if(isliving(AM))
var/mob/living/living_mob = AM
if(living_mob.pulling)
living_mob.pulling.forceMove(target)
for(var/obj/item/grab/grab in living_mob)