range in for loops does not return all present atoms every time.
Numbered Steps to Reproduce Problem:
1. Surround atom with opaque objects
2. Compare results of for(var/atom/x as anything in range(1,src)) with freestanding range(1,src) results
Code Snippet (if applicable) to Reproduce Problem:
obj/opaque
name = "opaque"
icon = 'icons.dmi'
icon_state = "bread"
opacity = 1
mob/verb/test()
var/list/found = range(1,src)
var/list/in_loop = new
for(var/atom/x as anything in range(1,src))
in_loop += x
found -= in_loop
if(!found.len)
world << "\bold Test successful!"
return
world << "\red Test failed!"
for(var/atom/x in found)
world << "[x]"
mob/verb/spawnblocker()
var/obj/opaque/blocker = new(usr.loc)
Expected Results:
Test successful
Actual Results:
Test failed
Workarounds: Use intermediate variable for range