ID:194530
 
If you delete something when it is taking its first step with dd_StepTowards(), it crashes the proc.

Uh oh.

[edited:]

And no, I won't fix it myself! =)
On 12/5/00 6:43 pm Spuzzum wrote:
If you delete something when it is taking its first step with dd_StepTowards(), it crashes the proc.

Uh oh.

[edited:]

And no, I won't fix it myself! =)

Now I get to be Tom:

Could you provide some code? I'm not clear on whether the thing taking the step or the thing being stepped toward is being deleted or how one would get into this situation...

That said, I'm glad someone is using it!
In response to Deadron
Now I get to be Tom:

That's not a good sign.

Could you provide some code? I'm not clear on whether the thing taking the step or the thing being stepped toward is being deleted or how one would get into this situation...

The thing that is stepping is deleted; here's the general sequence of things:

  • homing projectile attempts to dd_StepTowards() its selected target
  • projectile begins to Move() into the next turf
  • next turf contains acid...
  • next turf calls Enter()
  • Enter() calls Entering() for every object in the space (Entering() returns 1 if the object is allowed to enter and 0 if it is not. This allows objects in the space to veto the turf's decision in the Enter() proc.)
  • the acid's Entering() proc sizzles and destroys mobs that land in it, spawning del() 2 ticks after the proc returns 1.
  • thus, the mob moves into the space successfully, and is deleted.


That said, I'm glad someone is using it!

Oh, yeah, I find myself using your library more and more. I make lists out of text, use the pathing as if it were my god, and otherwise experiment a lot. Haven't found a need for that number system, though. Why are those in there, by the way?


I'll show you the actual code when I get home and actually have access to it. I don't want to violate school policy by bringing it here... after all, I'm already violating school policy by posting to forums!


Anyhoo, I actually plan on finishing s_missile, but I'd still have to use the pathing library for the efficient pathing of projectiles like the nanomachines that fly through the air in this example.
In response to Spuzzum
On 12/6/00 1:24 pm Spuzzum wrote:
  • the acid's Entering() proc sizzles and destroys mobs that land in it, spawning del() 2 ticks after the proc returns 1.

    It's not clear to me why dd_StepTowards() is crashing if the mob isn't being deleted until 2 ticks after the move...I threw in a check after the step is taken to verify that the mob still exists.

    If the crash is reporting the line that is crashing, that would be very helpful information....oh yeah if you wanna provide the code that's even better.


    Haven't found a need for that number system, though. Why are those in there, by the way?

    I was about to rip that out, and then I found I needed it again. I forget what for. Someplace where something stores only objects and I needed to keep a number...in general not too useful. I may yet rip it out.
In response to Deadron
It's not clear to me why dd_StepTowards() is crashing if the mob isn't being deleted until 2 ticks after the move...I threw in a check after the step is taken to verify that the mob still exists.

It's not clear to me either, but it does. =P

If the crash is reporting the line that is crashing, that would be very helpful information....oh yeah if you wanna provide the code that's even better.

Whoops, my memory failed me last night and I forgot to post the code. You'll have to wait 'til 4 PST before you'll get a response. =P
In response to Spuzzum
If the crash is reporting the line that is crashing, that would be very helpful information....oh yeah if you wanna provide the code that's even better.

First the proc crash:

Cannot read null.loc.
proc name: StepTowards (/deadron/PathController/proc/StepTowards)
source file: paths.dm,179
usr: Spuzzum (/mob/player)
src: /deadron/PathController (/deadron/PathController)
call stack: dd StepTowards MoveLoop Click
args: the floor (8,6,1) (/turf), 10, 0


And now the cause thereof:

mob
seeker
icon = 'seekers.dmi'
var/target
proc/Check()
proc/MoveLoop()
src.dd_StepTowards(src.target)
spawn(2) MoveLoop()

New()
..()
spawn(1) Check()

Bump(O)
if(ismob(O))
src.loc = O:loc

nanoapple
icon_state = "nanomachines"
density = 1
Check()
if(src.target == src.loc)
new /obj/nanoapple(src.loc)
del src
spawn(2) Check()

obj
acid
Entering(O)
if((ismob(O) || isobj(O)) && !istype(O,/mob/player))
Sizzle(O)
sleep(2)
del(O)
return 1

proc
Sizzle(O)
var/sizzle = image('sizzle.dmi',O)
Players() << sizzle
spawn(5) del(sizzle)

Players()
var/L[0]
var/client/C
for(C in world)
L += C
return L


It wasn't a spawn() in the Entering() proc after all, it was a sleep(). That must be why it's crashing. I think I might be able to fix it on my end, too. You'll still need to fix up your library, though, if you can.
In response to Spuzzum
On 12/7/00 4:49 pm Spuzzum wrote:
It wasn't a spawn() in the Entering() proc after all, it was a sleep(). That must be why it's crashing. I think I might be able to fix it on my end, too. You'll still need to fix up your library, though, if you can.

A sleep() makes sense for a crash -- the fix I put in yesterday should take care of that, as it checks for the existence of the mob after taking the step (if you don't want to wait for my next release, which may be a little while, you can just make this change in PathController.StepTowards():

After this line:

var/result = step_towards(owner, nextstep)

change

if (!result)

to

if (!result || !owner)