ID:2086980
 
Not a bug
BYOND Version:510.1344
Operating System:Windows 10 Pro 64-bit
Web Browser:Chrome 51.0.2704.36
Applies to:DM Language
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary:
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}
(the correct tile)

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.
I'm getting someone to try it on another computer, will post results.
Lummox JR resolved issue (Not a bug)
Objs whose bounds overhang the turf will be in its contents too.
its not, its 32x32, each track is on ONE turf, its not one giant object
In response to TheDracheX1
Keyword is "bounds", not icon size.
(E) (C) (M) bounds = "32,32"
(E) (C) (M) bound_height = 32
(E) (C) (M) bound_width = 32
(E) (C) (M) bound_x = 0
(E) (C) (M) bound_y = 0
Lummox JR changed status to 'Open'
Hrm. I think I'll need a test case on this, then.
Working on it. I think I could make a video or something if that would help
Whoops. Not sure what's going on there. Pro tip: you don't need to set bounds to a 32x32 icon that fills up the entire space.
I'm not setting anything special, thats the default value I'm pretty sure.
A video won't help much. I'll need something I can test in the debugger.
I can make a new environment and set it up and send it your way if that helps.
Or I can push this to the repo and send you a link?
A new environment is ideal.

For more info, it'd help to see what the misplaced obj's locs var says (not loc).
I can double-check but I think it was the turf that was 4 tiles over.

EDIT: Double-checked, the track's locs is the turf 4 tiles over from the red colored one. https://i.imgur.com/7cwU3b9.png

The railroad i'm viewing the variables from is the one with the arrow on it.
In response to Lummox JR
So it appears that in the test environment, everything works just dandy. Here's the test environment: https://drive.google.com/file/d/ 0B7CX9-46GwHNRy1fdnJuQUZXUG8/view?usp=sharing

EDIT: Although I could be lying because I can't see the variables in the test environment.
I'm not too surprised the test environment doesn't show it. I would imagine there's something specifically about this happening in the larger SS13 environment that's the problem.

If you can get this to happen consistently, then I might be able to get somewhere in the debugger. That's less likely if it's a megaproject like tg, though, which makes the debugger angry based on its sheer size.
Consistency isn't an issue here, it happens 100% of the time. I've been ripping my hairs out for 3-4 days on this issue now.

Anyway I pushed the commits and you can download the branch here: https://github.com/LLA-Gaming/Ice-Station/archive/ drache_dev.zip

To test it:

1. Set yourself as admin in config/admins.txt (ckey = Game Master)
2. Join the game (declare ready -> start-game)
3. Use jump-to-coordinate to jump to (112, 142, 1)
4. Right click on the corner of the track
5. Click view-variables
6. next_track holds the wrong information
Page: 1 2