When animating a mob, it messes with garbage collection. Instead of getting rid of the mob once there's nothing referencing it, it waits until another animated mob is scheduled to be dealt with before finally being collected; however, the second animated mob isn't collected until yet another animated mob is scheduled take it's place in limbo. The cycle then continues.
Numbered Steps to Reproduce Problem:
1a) Download this test environment or use the Code Snippet below.
1b) Click NewMob() if you'd like to see garbage collection working properly.
2) Click NewAnimatedMob() to see that "Del() Mob #X" doesn't get called.
3a) Click NewAnimatedMob() to see that the previous "Del() Mob #X" gets called in place of the current "Del() Mob #X".
3b) Monitor which mobs are currently in the world via Mobs Alive statpanel.
Code Snippet (if applicable) to Reproduce Problem:
These are simple defaults for your project.
fps = 25 // 25 frames per second
icon_size = 32 // 32x32 icon size by default
view = 6 // show up to 6 tiles outward from center (13x13 view)
maxx = 13
maxy = 13
maxz = 1
// Make objects move 8 pixels per tick when walking
icon = 'icons.dmi'
icon_state = "m"
step_size = 8
icon_state = "t"
var/total_mobs = 0
name = "Mob #[++total_mobs]"
world << "New() [src]"
world << "Del() [src]"
var/mob/m = new(locate(rand(1, world.maxx), rand(1, world.maxy), 1))
m.loc = null
var/x = 8
var/matrix/m = matrix()
var/mob/M = new(locate(rand(1, world.maxx), rand(1, world.maxy), 1))
animate(M, transform = m, time = 1)
animate(transform = null)
M.loc = null
Garbage collection to work properly on animated mobs.
Garbage collection on animated mobs is delayed, and only called when another animated mob can take it's place in limbo.
Does the problem occur:
Every time? Or how often? Yes.
In other games? So far, yes.
In other user accounts? Yes.
On other computers? Yes.
When does the problem NOT occur?
Problem doesn't occur when I don't use animate().
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Not sure, I'll look into older versions post-bug report.
Manually call del on mobs that use animate().