ID:2298839
 
I was wondering if anybody knew if byond triggered appearance tree lookups if you made a non-change to an appearance var.

For example, say you have a proc that made sure an atom had the right kind of icon for its state, adding/removing overlays as needed, but one of those lines was just
icon_state = "[mode][power_state]"
or something to that effect.

Say that was previously set to "build1" and it was being set to "build1"

Would that trigger an appearance update (causing it to search for identical appearances in the appearance tree, as well as send client updates) or is byond smarter than that?
Well, in theory, generating a message should eat up some processing time. Provided we write some code with the exact same instructions (more or less), we should be able to reasonably test this ourselves:

#define TEST_ITERATIONS 10000

world
loop_checks = 0

mob
verb
appearance_test1()
var/list/l = list("a","b")
for(var/count in 1 to TEST_ITERATIONS)
icon_state = l[count%2 + 1]

appearance_test2()
var/list/l = list("b","b")
for(var/count in 1 to TEST_ITERATIONS)
icon_state = l[count%2 + 1]


The above should give us some insight. Am not at home ATM and can't test it myself, otherwise I would.