destroying a projectile

Started by superpirson, June 07, 2014, 09:15:10 PM

Previous topic - Next topic

superpirson

for some reason, using the shield mod sometimes projectiles sort of "get stuck" in the shield, they stop moving after their destroy() function is called, and they do not cease to exist. I tried using thinggrid.deregester() instead of the projectile's destroy(), but that function gave me different problems, so I assume that is for something else.
clearly I have a total misunderstanding of how one should delete something from the thinggrid, but I can't find any way to do it. does anyone know what I am doing wrong?
specs: mid2009 MBP OSX 10.9.3 NVIDIA GeForce 9400M 256 MB

superpirson

forgive me, here is the source and data for the mod as I am using it.

[attachment deleted by admin: too old]
specs: mid2009 MBP OSX 10.9.3 NVIDIA GeForce 9400M 256 MB

mrofa

Maybe this will work
this.Destroy(DestroyMode.Vanish);
All i do is clutter all around.

superpirson

The thing is that DestroyMode defaults to vanish. also, the bullets don't stick every time, it's only after a few shots that they start persisting. Thanks for the help though.
specs: mid2009 MBP OSX 10.9.3 NVIDIA GeForce 9400M 256 MB

Jaxxa

I can confirm that I a found the same issue.

It looks like the Find.Map.thingGrid.ThingsAt() continuing to return objects that have had their Destroy(); function called.

I found that by adding a check that the projectile's "destroyed" Boolean value is false I can get the expected result of just the projectiles that have not been destroyed in that square.

I uploaded a patched version of that specific mod to it's post if you want to have a look or check if it is working.

mrofa

Find.Thingrid is kinda crappy when it comes to moving objects, then again it might be just my codding skills :D
Well you could try to list projectiles id and then just destroy projectiles with that id on entire map, since id should be unique to each object it shouldnt be a problem, but thats just my theory
All i do is clutter all around.