obj {

overlay {

timer {


var {

mob/owner = null


New(mob/m,max_value) {

. = ..()

owner = m
if(m.character.type==/character/commander) { del(src)}
spawn() { update(m,max_value,max_value)}


proc {

update(mob/m,value,max_value) {

value -= (10-m.character.speed)
if(m.can_move) { value=0;}
var show_state = ((value/max_value)*100)
for(var/i=0,i<=100,i+=4) {
if(i<=show_state) {
if(value<=0) { value=max_value;return}






Problem description:
The overlays icons will not update. They are being added properly to according mob's, but will not change icon state at all. A fix I found was adding in


but all that does is add another layer on top of the one below.

I've never experienced this issue before... ideas?
What does the code you posted at the top have to do with your problem? o.o

Nevermind, I noticed the thing was called "overlay".
In response to Complex Robot
Complex Robot wrote:
What does the code you posted at the top have to do with your problem? o.o

The update() procedure would be your solution.
Okay, I see your problem, now.
When you add an object to an overlays list, it takes a snapshot of the object exactly as it is when it gets added.
Modifying the original object after it's been added to the overlays doesn't modify the snapshot that is in the overlays.

One fix to this would be using images attached to the mob instead of giving it overlays, but a problem with that is you have to send to image to all logged in players, and you have to make sure every player gets all these images as they log in. Not an ideal solution.

The other way would be the small snippet you mentioned which removes the object from the overlays and re-adds it. The problem then is that the overlays have to detect what you're trying to remove based on the object. I guess that doesn't always work. (I thought it was supposed to work, as long as you have the same object reference you started with.)

So, the only other way I could see, is clearing the entire overlays list and then repopulating it each time. (One way to do it is instead of adding objects directly to the overlays list, use an intermediate list for adding and removing. Then, whenever you want to update the overlays, simply assign the overlays to the list. That way, -= will work properly on the regular list as well.)
In response to Complex Robot
I have made a separate client variable called _overlays for that very purpose.

The problem is when I remove the overlay, the image stays on the character. It's bizarre - this has never happened to me before.
In response to CauTi0N
I don't understand how doing
overlays = _overlays

instead of
overlays -= src
overlays += src

doesn't fix your problem, then.
In response to Complex Robot
I'm going to try to duplicate the issue in another program. Will update with the results shortly.