ID:272739
 
How would I check to see if there's a specific overlay in a mob's overlay list?

if() //?
Generally, you don't, unless you use a system or custom list to keep track of overlays yourself. It probably shouldn't be needed often, either. There is a way though, involving looping through the special elements of the list and checking their vars. There are examples here: [link], ID 677477. This would be considered a hacky method, though; you're generally not supposed to even try to access things in the overlays list, even though it works and could be useful at times. Also note depending on the purpose of what you're doing this could be a bad method to choose to implement it. For example, if you'd use this for determining various statuses of an atom based on what overlays it has, that would be not-robust similarly to identifying an atom based by its name alone.
In response to Kaioken
so...

var/list/Overs
for(var/appearance/A as anything in overlays)
Overs+=A
if() //?
//...


What would I put in the if() to reference the overlay? Or should I make it an object with a tag, and then reference the tag?
In response to Mizukouken Ketsu
The first linked post already demonstrates searching for a specific overlay, so I say read, experiment and think on your own more, and ask less. =P Note such code on its own would of course generate a compile-time error (even disregarding the if() statement) as well as a runtime one once the former is fixed.
In response to Kaioken
for(var/image/I as anything in overlays)
if(I == 'icon.dmi')
//...


Like that? What if I have icon_states inside that icon file? How would I reference that specific icon state inside that icon file?
In response to Mizukouken Ketsu
Mizukouken Ketsu wrote:
Like that?

No. Compare that with the post.

How would I reference that specific icon state inside that icon file?

That's pretty simple. You'll do it the same way as you would the icon itself, so once you get that working this won't be a problem. The same thing for most other appearance-related vars, such as layer. I trust you can figure out the rest. ;P
In response to Kaioken
Sorry...

if(I.icon == 'icon.dmi')


Then there's the "src." I deliberately didn't put in. So that will loop through every overlay with the icon states within the icon.dmi file? And then of course I can run whatever I wanted to do if that check runs true...
In response to Mizukouken Ketsu
Basically, yes. You could have just tried it and checked. >_>
In response to Kaioken
I was in a rush and had to go somewhere, so I didn't really get the chance to test it. I probably could've waited to get back, but sometimes I just prefer getting an okay from someone who knows what they're doing before I start using a different technique on how to do something.