diff --git a/code/datums/spells/area_teleport.dm b/code/datums/spells/area_teleport.dm index aec85ce4db..b2ced9fa0d 100644 --- a/code/datums/spells/area_teleport.dm +++ b/code/datums/spells/area_teleport.dm @@ -46,11 +46,20 @@ usr <<"The spell matrix was unable to locate a suitable teleport destination for an unknown reason. Sorry." return - var/attempt = 0 + if(target && target.buckled) + target.buckled.unbuckle() + + var/list/tempL = L + var/attempt = null var/success = 0 - while(!success) - success = target.Move(pick(L)) - if(attempt > 20) break //Failsafe + while(tempL.len) + attempt = pick(tempL) + success = target.Move(attempt) + if(!success) + tempL.Remove(attempt) + else + break + if(!success) target.loc = pick(L) diff --git a/code/game/objects/items/weapons/scrolls.dm b/code/game/objects/items/weapons/scrolls.dm index c747d65439..e0d3697c3a 100644 --- a/code/game/objects/items/weapons/scrolls.dm +++ b/code/game/objects/items/weapons/scrolls.dm @@ -69,12 +69,22 @@ user <<"The spell matrix was unable to locate a suitable teleport destination for an unknown reason. Sorry." return - var/attempt = 0 + if(user && user.buckled) + user.buckled.unbuckle() + + var/list/tempL = L + var/attempt = null var/success = 0 - while(!success) - success = user.Move(pick(L)) - if(attempt > 20) break //Failsafe + while(tempL.len) + attempt = pick(tempL) + success = user.Move(attempt) + if(!success) + tempL.Remove(attempt) + else + break + if(!success) user.loc = pick(L) + smoke.start() src.uses -= 1 \ No newline at end of file