Hmm.. The only case I can think of where setting loc will fail is when you try loc=locate(x,y,z) before run-time generation of the map. In this case, locate will return null.
In response to Jemai1
Jemai1 wrote:
Hmm.. The only case I can think of where setting loc will fail is when you try loc=locate(x,y,z) before run-time generation of the map.

Maybe it was setting the loc of two things to the same loc in the same tick? I can't remember.
I believe you're talking about Move instead. Setting loc doesn't do any checking or whatsoever. It simply sets the location.
In response to Jemai1
Jemai1 wrote:
I believe you're talking about Move instead. Setting loc doesn't do any checking or whatsoever. It simply sets the location.

I'll dig up the source where it occured. Perhaps it was a bug.
Hmm, turns out it was if Cross() returns 0 before a delayed loc = blah is set to happen.

area/transfer
icon = 'transfer.dmi'
var/loc_tag = null as text
layer = FLY_LAYER
mouse_opacity = 0
//invisibility = 101

Enter(atom/movable/a) //using Enter() instead of Entered() so that people or objects can't block transfers
switch(src.CanTransfer(a))
if(1)
var/location = locate(src.loc_tag)
a.Transfer(location)
src.Transferred(a)
return ..()
if(2)
return ..()
if(0)
return 0

proc/CanTransfer(atom/movable/a)
return 1

proc/Transferred(atom/movable/a)

atom/movable
var/tmp/transferring = 0

proc/Transfer(atom/location)
if(!location) return

src.transferring = 1

spawn(get_speed_delay(src.get_speed()))
//src.x = location.x //we must set x y and z because setting loc can cause black outs
//src.y = location.y
//src.z = location.z
src.loc = location //black screen!!

spawn(world.tick_lag)
src.transferring = 0


This would happen when the destination location had a box on it which overrode Cross() and returned 0
Are you certain that location is a turf? loc = locate(location.x,location.y,location.z) shouldn't pose any problem.
loc_tag is a text tag

either way, i changed my advice code.

my code base is more confusing.
Page: 1 2