ID:158883
 
Is it possible at all to flick a overlay as if it were a icon state?

I have tried to use
flick("overlay", src)

and
flick("overlay", src.overlays)

And neither have worked, so here I am asking if it is even possible to easily flick a overlay to where it is taken off when it is over (like flick does with icon states)
often when overlays are used they are used in the form of

src.overlays += /obj/hat

or any other way for that mather, but it always refers to adding something. that something i would think is an icon ?

thus flicking an overlay , the way i see it, would be flicking the icon refered to when adding the overlay.
as an example:
obj/hat
icon = 'hat.dmi'
layer = MOB_LAYER +1


mob/verb/Wear()
src.overlays += /obj/hat
////////////////////////////
//lets say we have this smoke(which is animated for this purpose).
obj/smoke
icon = 'smoke.dmi'
layer = MOB_LAYER +1

//now we use flick.

mob/verb/something()
flick('smoke.dmi',src) // im sure you know what it does so im not going to explain it.

anyways, thats how you should do it. instead of having flick("overlay",src) input the icon you want it to show instead.
In response to Jarquille
But will that still work like the
src.overlays += /obj/hat
works? Because I have a base icon, that has the attacking state, with the weapons in another file for the overlay, but whenever I try the above code (src.overlays += /obj/hat) it adds it but when I am attacking every few seconds it creates a really bad looking effect (the overlay does not match up with the attacking state and such)
In response to VolksBlade
When you flick an atom with an icon state (e.g. flick("attack",Object)), any overlays of that atom that also have such a state name in their icon are also automatically switched to it. In other words, all you need to do is add the hat overlay by using an icon that has the same "attacking" state name as the player, and when the player is flicked, the overlay will also be flicked.
In response to Kaioken
Alright, thanks.