ID:2487117
 
Resolved
Filter animations had multiple issues, including that removing a filter that was on an infinite animation loop did not have any effect. Filter handling has been improved to fix these issues, which also has the side effect that a reference like obj.filters[1] is more "stable" than before. This change impacts both the client and server.
BYOND Version:512
Operating System:N/A
Web Browser:N/A
Applies to:Dream Daemon & Dream Seeker
Status: Resolved (512.1473)

This issue has been resolved.
Descriptive Problem Summary:
If a filter is animated, it seems to stick around even if removed from the filters list.

Numbered Steps to Reproduce Problem:
1) Add a filter to an atom.
2) Animate said filter.
3) Set the atoms filters list to list()

If the filter is not animated, it goes away fine. If it is animated, it sticks around. Even trying to grab the filter from the filters list and manually deleting it doesn't work.

Code Snippet (if applicable) to Reproduce Problem:
mob
verb
AFilter()
filters += filter(type="outline", size=2, color="#ac323299")
animate(filters[1], size=1, time=5, loop=-1)
animate(size=2, time=5)

SFilter()
filters += filter(type="outline", size=2, color="#ac323299")

ClearFilters()
world << filters.len // 1
filters = list()
world << filters.len // 0

Obviously this is just a test case and can be all kinds of broken, but it serves it's purpose.

Expected Results:
Filter goes away

Actual Results:
Filter doesn't go away



Workarounds:
Dont animate filters that you might want to get rid of later.



EDIT: It does go away if you change the loop count to a positive value, once it has looped that many times.
Yeah, this has been an annoying one. I'll try out your test to see if that helps me get to the bottom of it. Filter animations have been fairly rough to figure out as you can imagine.
Was given a workaround for now at least. Saving a ref to the filter and 'animate(ref)' in the Clearfilters() proc gets rid of it.
Descriptive Problem Summary:

When attempting to remove a filter that has an animation loop running it won't disappear unless you cease the animation (unreliable with a changing filters list) or don't loop it.

Numbered Steps to Reproduce Problem:

1) Add a filter to mob.filters
2) Animate the filter with the loop=-1 parameter.
3) Attempt to remove the filter using filter() with the final values animate() would set the filter's variables to.

Code Snippet (if applicable) to Reproduce Problem:
// Use AddFilter() to add an animated drop_shadow filter
// Use RemoveFilter() to see it fail to remove it.
// If the filter isn't looping its animate() it works
// If the filter isn't animated at all, it works
// If you null the animate() on the filter it works

mob
icon = 'stuff.dmi'
icon_state = "mob"


verb


AddFilter()
filters += filter(type="drop_shadow",x=2,y=2,color=rgb(0,255,0),size=3)
animate(filters[1],x=4,y=4,time=4,loop=-1)

RemoveFilter()
//animate(filters[1],null) // Uncomment this for a workaround, non-viable for larger filters lists.
filters -= filter(type="drop_shadow",x=4,y=4,color=rgb(0,255,0),size=3)



turf
icon = 'stuff.dmi'
icon_state = "turf"


Expected Results:

Filter to be removed.

Actual Results:

Filter hangs around and continues to animate but is removed from the filters list.

Does the problem occur:
Every time? Or how often? Every time.
In other games? Probably
In other user accounts? Yep
On other computers? Yep

When does the problem NOT occur?

When animate(null) is used on the filter, which isn't always possible if the filters list has changed since you added the filter, as there's not actually a static object to hold a reference to for filters.

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.) Long standing issue with filters and animate()

Workarounds:

Cease the animation on the filter, if possible.
Lummox JR resolved issue with message:
Filter animations had multiple issues, including that removing a filter that was on an infinite animation loop did not have any effect. Filter handling has been improved to fix these issues, which also has the side effect that a reference like obj.filters[1] is more "stable" than before. This change impacts both the client and server.