From a8cb1dc4f88eae66f75e7dadf7928c8ba2124032 Mon Sep 17 00:00:00 2001 From: "aranclanos@hotmail.com" Date: Thu, 17 Jan 2013 06:22:29 +0000 Subject: [PATCH] Some improvement to the teleport scroll and spell code. It unbuckles the user now. Thanks to Nodrak~ git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5565 316c924e-a436-60f5-8080-3fe189b3f50e --- code/datums/spells/area_teleport.dm | 17 +++++++++++++---- code/game/objects/items/weapons/scrolls.dm | 18 ++++++++++++++---- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/code/datums/spells/area_teleport.dm b/code/datums/spells/area_teleport.dm index aec85ce4dbf..b2ced9fa0d5 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 c747d65439b..e0d3697c3a6 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