From 097aae989c4136da132a932dbcd55c6b3c25a92b Mon Sep 17 00:00:00 2001 From: "baloh.matevz" Date: Fri, 17 Aug 2012 08:01:13 +0000 Subject: [PATCH] - Fixes issue 675. I just added a few Move() -s and it works fine. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4468 316c924e-a436-60f5-8080-3fe189b3f50e --- code/datums/spells/area_teleport.dm | 8 ++++++- code/datums/spells/ethereal_jaunt.dm | 14 ++++++++++-- code/game/gamemodes/wizard/spells.dm | 32 ++++++++++++++++++++++------ 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/code/datums/spells/area_teleport.dm b/code/datums/spells/area_teleport.dm index 22f81ae1809..046a2d39db0 100644 --- a/code/datums/spells/area_teleport.dm +++ b/code/datums/spells/area_teleport.dm @@ -42,7 +42,13 @@ if(clear) L+=T - target.loc = pick(L) + var/attempt = 0 + var/success = 0 + while(!success) + success = target.Move(pick(L)) + if(attempt > 20) break //Failsafe + if(!success) + target.loc = pick(L) return diff --git a/code/datums/spells/ethereal_jaunt.dm b/code/datums/spells/ethereal_jaunt.dm index be4c641251d..b3fdb460162 100644 --- a/code/datums/spells/ethereal_jaunt.dm +++ b/code/datums/spells/ethereal_jaunt.dm @@ -40,7 +40,12 @@ animation.dir = target.dir flick("phase_shift2",animation) sleep(5) - target.loc = mobloc + if(!target.Move(mobloc)) + for(var/direction in list(1,2,4,8,5,6,9,10)) + var/turf/T = get_step(mobloc, direction) + if(T) + if(target.Move(T)) + break target.canmove = 1 target.client.eye = target del(animation) @@ -61,7 +66,12 @@ sleep(20) flick("reappear",animation) sleep(5) - target.loc = mobloc + if(!target.Move(mobloc)) + for(var/direction in list(1,2,4,8,5,6,9,10)) + var/turf/T = get_step(mobloc, direction) + if(T) + if(target.Move(T)) + break target.canmove = 1 target.client.eye = target del(animation) diff --git a/code/game/gamemodes/wizard/spells.dm b/code/game/gamemodes/wizard/spells.dm index 4e175db027b..adea8968672 100644 --- a/code/game/gamemodes/wizard/spells.dm +++ b/code/game/gamemodes/wizard/spells.dm @@ -372,10 +372,18 @@ break if(clear) L+=T - if(L.len) - usr.loc = pick(L) - else + + if(!L.len) usr <<"The spell matrix was unable to locate a suitable teleport destination for an unknown reason. Sorry." + return + + var/attempt = 0 + var/success = 0 + while(!success) + success = Move(pick(L)) + if(attempt > 20) break //Failsafe + if(!success) + usr.loc = pick(L) smoke.start() @@ -404,12 +412,17 @@ L+=T if(!L.len) - usr <<"Invalid teleport destination." + usr <<"The spell matrix was unable to locate a suitable teleport destination for an unknown reason. Sorry." return - else + var/attempt = 0 + var/success = 0 + while(!success) + success = Move(pick(L)) + if(attempt > 20) break //Failsafe + if(!success) usr.loc = pick(L) - smoke.start() + smoke.start() //JAUNT @@ -454,7 +467,12 @@ sleep(20) flick("reappear",animation) sleep(5) - H.loc = mobloc + if(!H.Move(mobloc)) + for(var/direction in list(1,2,4,8,5,6,9,10)) + var/turf/T = get_step(mobloc, direction) + if(T) + if(H.Move(T)) + break H.canmove = 1 H.client.eye = H del(animation)