ID:175653
 
I think I've asked this before, but I don't recall exactly what kind of response there was. I'm doing this for Simant. This is a regular flick that works for a character's own icon_state:


flick("Ant1",src)


Now, when an ant eats food, I want an overlay to be flicked OVER their icon_state. But I have no idea how to do it. I tried this:

flick("FoodLeat",src.overlays)

Obviously, src.overlays does nothing. So how do I do this? I thought it was fairly simple....but alas, t'is not. Actually I bet it is. {:

-Dagolar

If the overlay is only seen when they are eating, I'd just create it in the eating proc, and then flick() its state (heck, you could just give it one icon_state that is what you want it to show, and when it is created, it will just show that animation)

Eat()
var/obj/eat_overlay/E = new()
src.overlays += E
flick("FoodLeat", E)
del(E)

Or something along those lines... But like I mentioned, if you just give it the one icon_state that shows what you want to display, then there's no need for flick()... But if you do it this way, you'll have to add in a sleep() delay before it is deleted to give it enough time to be seen...

Another method I think would work (and would be much more flexible) would be as follows:

mob
var/obj/effect_overlay/effect_overlay

Login()
var/obj/effect_overlay/E = new()
src.overlays += E
src.effect_overlay = E

verb
Eat()
flick("eat",src.effect_overlay)
Explode()
flick("explode",src.effect_overlay)

obj
effect_overlay
icon = 'effects.dmi'

This way, you can add one overlay object with all of the effects you need, set a mob var to point to that object, and use that var to flick() that particular overlay object to whatever effect you want it to show...