I'm getting a turf next to another and when I iterate over its contents i get objects from 4 turfs over (consistently the same track). GIF of it in action: https://i.imgur.com/QqkcpFo.gifv. The red tile is the one im trying to get the railroad track from. The green turf gets its next railroad track just fine (north). Note: I tried locate first, didnt work. I tried iterating over the contents, didnt work. Now I am copying the contents list and it still doesnt work. It correctly gets the railroad track when i iterate over it, but not when i assign it to a variable apparently.
Case in point: (see code in code snippet for more context)
if(dir in list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST))
var/turf/t1 = get_step(src, turn(dir, -135))
t1.color = rgb(255, 0, 0)
var/list/cnts = t1.contents.Copy()
for(var/atom/movable/A in cnts)
if(istype(A, /obj/structure/railroad_track))
world << "Found one! {[A.x], [A.y], [A.z]}"
// next_track[dir2text(turn(dir, -135))] = A
var/turf/t2 = get_step(src, turn(dir, 135))
t2.color = rgb(0, 255, 0)
// next_track[dir2text(turn(dir, 135))] = A
results in
Found one! {112, 141, 1}
Code Snippet (if applicable) to Reproduce Problem:
New()
..()
spawn(10)
UpdateNearbyTracks()
proc/UpdateNearbyTracks()
if(dir in cardinal)
var/turf/t1 = get_step(src, dir)
next_track[dir2text(dir)] = locate(/obj/structure/railroad_track) in t1
var/turf/t2 = get_step(src, turn(dir, 180))
next_track[dir2text(turn(dir, 180))] = locate(/obj/structure/railroad_track) in t2
if(dir in list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST))
var/turf/t1 = get_step(src, turn(dir, -135))
t1.color = rgb(255, 0, 0)
var/list/cnts = t1.contents.Copy()
for(var/atom/movable/A in cnts)
if(istype(A, /obj/structure/railroad_track))
next_track[dir2text(turn(dir, -135))] = A
var/turf/t2 = get_step(src, turn(dir, 135))
t2.color = rgb(0, 255, 0)
cnts = t2.contents.Copy()
for(var/atom/movable/A in cnts)
if(istype(A, /obj/structure/railroad_track))
next_track[dir2text(turn(dir, 135))] = A
Expected Results:
I should be getting the railroad track from one turf over
Actual Results:
Getting a railroad track from 4 turfs over
Does the problem occur:
Every time? Or how often?
Every time
In other games?
N/A
In other user accounts?
N/A
On other computers?
N/A
When does the problem NOT occur?
I can't speak for the non-beta byond version but i tested 4 different beta versions and it is an issue in each.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
N/A
Workarounds:
N/A
I'm either completely dumb or this is an actual bug, either one.