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.