ID:1677359
 
(See the best response by Kaiochao.)
Hi guys good night.

I'm having some trouble with my projectile system and the Move() proc.

The problem is : When i create a new projectile and almost in the same time this projectile hits an mob I get an infinity loop error and the mob freezes. The only way to make the mob walk again are entering again on the server or using the "MovementLoop()" proc.

Here is a image of the problem and the error code: http://i1101.photobucket.com/albums/g425/tacurumin/Bug.png

runtime error: Maximum recursion level reached (perhaps there is an infinite loop)
To avoid this safety check, set world.loop_checks=0.
proc name: Move (/atom/movable/Move)
usr: Tacurumin (/mob/Jogador)
src: Tacurumin (/mob/Jogador)
call stack:
Tacurumin (/mob/Jogador): Move(Vegetacao 2 (469,117,2) (/turf/Grama_Ilha/Vegetacao_2), 10, -2, 6)
Tacurumin (/mob/Jogador): Move(Vegetacao 2 (469,117,2) (/turf/Grama_Ilha/Vegetacao_2), 10, -2, 6)
Tacurumin (/mob/Jogador): Bump(Shuriken Gigante (/obj/Shuriken_Gigante))
Tacurumin (/mob/Jogador): Move(Vegetacao 2 (469,117,2) (/turf/Grama_Ilha/Vegetacao_2), 10, -2, 6)
Tacurumin (/mob/Jogador): Move(Vegetacao 2 (469,117,2) (/turf/Grama_Ilha/Vegetacao_2), 10, -2, 6)
Tacurumin (/mob/Jogador): Bump(Shuriken Gigante (/obj/Shuriken_Gigante))
Tacurumin (/mob/Jogador): Move(Vegetacao 2 (469,117,2) (/turf/Grama_Ilha/Vegetacao_2), 10, -2, 6)
Tacurumin (/mob/Jogador): Move(Vegetacao 2 (469,117,2) (/turf/Grama_Ilha/Vegetacao_2), 10, -2, 6)
Tacurumin (/mob/Jogador): Bump(Shuriken Gigante (/obj/Shuriken_Gigante))
Tacurumin (/mob/Jogador): Move(Vegetacao 2 (469,117,2) (/turf/Grama_Ilha/Vegetacao_2), 10, -2, 6)
...
Tacurumin (/mob/Jogador): Move(Vegetacao 2 (469,117,2) (/turf/Grama_Ilha/Vegetacao_2), 10, -2, 6)
Tacurumin (/mob/Jogador): Bump(Shuriken Gigante (/obj/Shuriken_Gigante))
Tacurumin (/mob/Jogador): Move(Vegetacao 2 (469,117,2) (/turf/Grama_Ilha/Vegetacao_2), 10, -2, 6)
Tacurumin (/mob/Jogador): Move(Vegetacao 2 (469,117,2) (/turf/Grama_Ilha/Vegetacao_2), 10, -2, 6)
Tacurumin (/mob/Jogador): Bump(Shuriken Gigante (/obj/Shuriken_Gigante))
Tacurumin (/mob/Jogador): Move(Vegetacao 2 (469,117,2) (/turf/Grama_Ilha/Vegetacao_2), 10, -2, 6)
Tacurumin (/mob/Jogador): Move(Vegetacao 2 (469,117,2) (/turf/Grama_Ilha/Vegetacao_2), 8, -12, 8)
Tacurumin (/mob/Jogador): stepDiagonal()
Tacurumin (/mob/Jogador): Login()


I think it could be a bug on the projectile system but i can't figure how to solve it. Here is my base projectile code :

obj
Shuriken_Gigante
density = 1
layer = 3
bound_width = 96
bound_height = 96

Bump(A) //Se ele encostar em algo :
if(ismob(A)) //se esse algo for um mob..
var/mob/J = A //Definimos que é um mob que ele acertou
var/mob/H = src.Dono //Definimos quem castou o jutsu

if(J.Tensei_On == 1)
view(src)<< sound('Sons/Pein/Shinra_Hit.wav', volume=30)
src.dir = rand(1, 10)
walk(src, src.dir)
J.Shinra_Tensei()
else
var/Dano_Tiro = rand(1, (H.Mp * H.Forca) / (J.Defesa * 0.5))//Algoritimo de dano.

if(Dano_Tiro <= J.Defesa && J in world)
J.Exibe_Damage("Miss", J)
del(src)
else
view(src)<< sound('Sons/Obito/Shuriken_Acerta.wav', volume = 30)
J.Hp -= Dano_Tiro

if(J in world)
J.Exibe_Damage(Dano_Tiro, J)

J.Barra_Hp(J)
J.Checa_Morte(H, J)

sleep(0)
del(src)
else if(isobj(A))
del(src)

New()
Sombra_Reflexo_Obj("Sombra", 'Shuriken_Gigante.dmi', 37, -5)
Auto_Deleta_Goukakyuu()


//Kamui Bureezu
mob
verb
Kamui_Bureezu()
switch(src.Jutsu_Ativo)
if(1)
return
else
src.Jutsu_Ativo = 1
// Tempo_Selos()

view(src)<<"<b>[usr] Diz :</b> Kamui Bureezu !"

view(src)<< sound('Sons/Kamui_SFX.wav', volume = 30)

view(src)<< sound('Sons/Obito/Shuriken_Lança.wav', volume = 30)

var/obj/Shuriken_Gigante/A = new(src.loc) //Primeiro cria-se o objeto
A.icon = 'Shuriken_Gigante.dmi' //Segundo, define-se um ícone para ele

walk(A,src.dir) //Libera o projetil
A.Dono = src //Vemos quem é o dono para se o projetil acertar alguem verificar quem foi o assassino

Kamui = overlay('Kamui.dmi')
Kamui.Flick("Kamui", 5)

sleep(10)
src.Jutsu_Ativo = 0


Thanks for the help !
If you move a bumping object when it bumps something, you're gonna have a bad time.
In response to Kaiochao


Fixed
Hahaha i'm already having. What do you recommend for me to solve this issue ?
In response to Tacurumin
Best response
Make sure that whatever you do in Object.Bump(Bumper) doesn't cause Bumper to bump into Object again. Think about it?
I think I got it. I will try.
My recommendation would honestly be to make a targeting system where the animation of the projectile flying to the target is just for looks, but the actually hit chance and damage are calculated separately. Using Bump() with projectiles can get pretty hazy, but that's just my suggestion.

I just think that it could be done much easier and in a much better way.
In response to Kaiochao
Issue solved =D.

In the mob bump() i have another definition for walk and this one is conflicting with the obj walk() so this is what is causing the bug.

Thanks for the help guys, best regards, TacurumiN.