ID:2410404
 
Resolved
When a movable object was inside another movable, its locs list included the turf they were all ultimately standing on instead of just the container, which was somewhat useless and also conflicted with the behavior described in the reference.
BYOND Version:511
Operating System:Windows 7 Ultimate
Web Browser:Firefox 63.0
Applies to:Dream Daemon
Status: Resolved (513.1512)

This issue has been resolved.
Descriptive Problem Summary:
According to the documentation:
// For every turf in locs, this atom will also be in that turf's contents list.
// If loc is not a turf, it will be the only item in the locs list. If loc is null, locs will be empty.

However it seems to be adding the base turf regardless of whether it's inside something else. Furthermore, the turf in locs does not have the object in it's contents.

Numbered Steps to Reproduce Problem:
Use the below code and run the verb test_loc

Code Snippet (if applicable) to Reproduce Problem:
/world/maxx = 1

/client/verb/test_loc()
var/atom/movable/holder = new(locate(1,1,1))
holder.name = "holder"
var/atom/movable/thing = new(holder)

usr << "loc:[thing.loc], locs:[json_encode(thing.locs)]"
if(isturf(thing.locs[1]))
var/turf/place = thing.locs[1]
usr << "turf contents:[json_encode(place.contents)]"


Expected Results:
loc:the holder, locs:["the holder"]


Actual Results:
loc:the holder, locs:["the turf"]
turf contents:["the holder"]


Does the problem occur:
Every time? Or how often? Every time
In other user accounts? Untested
On other computers? Untested

When does the problem NOT occur?
Never

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
I found this while debugging some code in 512 and it happens at least in latest 511. I have no clue where to start looking before then.

Workarounds:
None
I found this while debugging some ss13 code. We don't use the locs variable at all though so this wouldn't affect us. Here's an image with it shown in our debug tools though.
As far as I know this has always been the case
Baystation and some other codebases used to use it for get_turf() before everyone switched to the new version
Yeah it does seem to be a very old behavior. If it's intended then the issue is with the documentation.
I'll take a look and figure out what the deal is. Should be a simple fix either way.
What's the status on this? This isn't too big a deal but does cause some minor bugs if the code assumes the documentation is correct.
Sorry, I must have missed this somehow. It must have gotten buried. I'll give it another look.
Lummox JR resolved issue with message:
When a movable object was inside another movable, its locs list included the turf they were all ultimately standing on instead of just the container, which was somewhat useless and also conflicted with the behavior described in the reference.