Fixes swapping/stepping mechanics ignoring the basic passability

This commit is contained in:
Heroman
2019-04-08 04:48:48 +10:00
parent 84f3fa0a74
commit 12183c890f
2 changed files with 47 additions and 13 deletions

View File

@@ -103,18 +103,23 @@ default behaviour is:
return
//BubbleWrap: people in handcuffs are always switched around as if they were on 'help' intent to prevent a person being pulled from being seperated from their puller
var/dense = 0
if(loc.density)
dense = 1
for(var/atom/movable/A in loc)
if(A == src)
continue
if(A.density)
if(A.flags&ON_BORDER)
dense = !A.CanPass(src, src.loc)
else
dense = 1
if(dense) break
var/can_swap = 1
if(loc.density || tmob.loc.density)
can_swap = 0
if(can_swap)
for(var/atom/movable/A in loc)
if(A == src)
continue
if(!A.CanPass(tmob, loc))
can_swap = 0
if(!can_swap) break
if(can_swap)
for(var/atom/movable/A in tmob.loc)
if(A == tmob)
continue
if(!A.CanPass(src, tmob.loc))
can_swap = 0
if(!can_swap) break
//Leaping mobs just land on the tile, no pushing, no anything.
if(status_flags & LEAPING)
@@ -123,7 +128,7 @@ default behaviour is:
now_pushing = 0
return
if((tmob.mob_always_swap || (tmob.a_intent == I_HELP || tmob.restrained()) && (a_intent == I_HELP || src.restrained())) && tmob.canmove && canmove && !tmob.buckled && !buckled && !dense && can_move_mob(tmob, 1, 0)) // mutual brohugs all around!
if((tmob.mob_always_swap || (tmob.a_intent == I_HELP || tmob.restrained()) && (a_intent == I_HELP || src.restrained())) && tmob.canmove && canmove && !tmob.buckled && !buckled && can_swap && can_move_mob(tmob, 1, 0)) // mutual brohugs all around!
var/turf/oldloc = loc
forceMove(tmob.loc)
//VOREstation Edit - Begin

View File

@@ -155,6 +155,20 @@ var/const/RESIZE_A_SMALLTINY = (RESIZE_SMALL + RESIZE_TINY) / 2
* @return false if normal code should continue, true to prevent normal code.
*/
/mob/living/proc/handle_micro_bump_helping(var/mob/living/tmob)
//Make sure we would be able to step there in the first place:
var/can_move_into = 1
if(tmob.loc.density)
can_move_into = 0
if(can_move_into)
for(var/atom/movable/A in tmob.loc)
if(A == src)
continue
if(!A.CanPass(src, tmob.loc))
can_move_into = 0
if(!can_move_into) break
if(!can_move_into)
return FALSE
//Both small! Go ahead and go.
if(src.get_effective_size() <= RESIZE_A_SMALLTINY && tmob.get_effective_size() <= RESIZE_A_SMALLTINY)
@@ -198,6 +212,21 @@ var/const/RESIZE_A_SMALLTINY = (RESIZE_SMALL + RESIZE_TINY) / 2
/mob/living/proc/handle_micro_bump_other(var/mob/living/tmob)
ASSERT(istype(tmob))
//Can we even step on their tile normally?
var/can_move_into = 1
if(tmob.loc.density)
can_move_into = 0
if(can_move_into)
for(var/atom/movable/A in tmob.loc)
if(A == src)
continue
if(!A.CanPass(src, tmob.loc))
can_move_into = 0
if(!can_move_into) break
if(!can_move_into)
return FALSE
//If they're flying, don't do any special interactions.
if(ishuman(src))
var/mob/living/carbon/human/P = src