ID:1018831
 
Keywords: loop, overlays
BYOND Version:497
Operating System:Windows 7 Ultimate 64-bit
Web Browser:Chrome 22.0.1229.94
Applies to:Dream Seeker
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:

Since approx version 493, a number of my overlays have broken. Some seemed to work still, which caused me much confusion (as the code for them was the same). However it turned out that the act of changing the icon_state of the 'obj' that I added the overlay to (to anything) caused the overlay to play. This was being done by a fluke in certain instances during game-play. However in cases where this was not done I would not see anything when the overlay was added... it was as if nothing had happened.

Ok so I narrowed down the following:

- All other Overlays and Underlays I have seem to work fine, from what I can see. However these are 32 x 32 in size.

- The overlays which do not appear when added to Objs are 96 x 96, and have multiple frames and are set to Loop once.

- The only way I can get those overlays to appear is if I change the icon_state of the Obj they are attached to something else (anything). Then it will play as if I had just added it, but the icon_state has to visibly change to the user for the overlay to play (if I do it instantly in code, as I tried to bi-pass this issue, it does nothing).

- If I set the animation to 'indefinitely' play then it will play as expected (just loop constantly which is not what I want). But if I set it to Loop once, then nothing will show up when its added.

Numbered Steps to Reproduce Problem:

Make a large icon (96 x 96?) and give it some frames. Set it to loop once. Then write a bit of code to add it to an Obj's overlays. You would expect the animation to play. However nothing happens.

Code Snippet (if applicable) to Reproduce Problem:
obj/overlays
layer = FLOAT_LAYER -4

animation

pixel_x = -32
pixel_y = -32

icon = 'summon.dmi'
icon_state = "_SS"

mob/var/tmp/obj/cards/S1

mob/verb/Summon_Animation()

usr.S1.overlays += /obj/overlays/animation


Expected Results:

The overlay to be added and play, once.

Actual Results:

Nothing happens.

Does the problem occur:
Every time? Or how often? Every time.
In other games? I do not know. Would assume so.
In other user accounts? Yes.
On other computers? Yes.

When does the problem NOT occur?

If the icon's animation is set to not Loop a set number of times.

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.)

I think it was around v493 that this started to happen. I have been away from BYOND for quite a few months and was having this issue just before. This code and my overlays had all been working fine for many years though previously!

Workarounds:

Set your animation to loop indefinitely.
I believe I see where the problem lies here. We have code that specifically does not reset an object's "creation time" (the time since its last significant appearance change) unless its icon or icon state change. I suppose it's an open question whether it'd be a bad thing for all overlay/underlay changes to affect this as well. Some changes, like dir and visibility, obviously don't matter for this purpose.
Ok, I think. So you are saying this is on purpose?

The thing is that this used to work fine for many years. So it seems to have changed at some point recently (ish).

I built a lot of animations in my game around the fact that if I add an icon that's animated, and set to loop X number of times, to an obj's overlays it played that number of times over the top. Then I could -= it later and not have to worry about timing spawn() etc to the animation length too accurately (which is impossible anyway).

It used to work great.
In response to UnknownDuelist
No, I think this really is a bug. IIRC, we made the change to deal with visibility changing, but didn't intend it to cover overlays changing. I could see some cases where resetting the animation time wouldn't be desirable, but in general I think it'd probably be okay to allow overlay/underlay changes to trigger the animation reset.
Oh thats good :) hopefully a fix that can be snuck into the next release then. My games been without overlays for a while :(