Adds DropLocation(). To generally be preferred to get_turf() (#29814)

Fixes #29802

Unlike get_turf()this will sensibly pick if loc can be safely used
This commit is contained in:
Jordan Brown
2017-08-18 16:44:20 +12:00
committed by oranges
parent 076c533285
commit 728aefbd70
11 changed files with 36 additions and 21 deletions
@@ -110,7 +110,12 @@
return 1
/obj/structure/closet/proc/dump_contents()
var/turf/T = get_turf(src)
var/atom/L = loc
if(!L)
for(var/I in src)
qdel(I)
return
var/turf/T = L.drop_location()
for(var/atom/movable/AM in src)
AM.forceMove(T)
if(throwing) // you keep some momentum when getting out of a thrown closet
@@ -119,7 +124,10 @@
throwing.finalize(FALSE)
/obj/structure/closet/proc/take_contents()
var/turf/T = get_turf(src)
var/atom/L = loc
if(!L)
return
var/turf/T = L.drop_location()
for(var/atom/movable/AM in T)
if(AM != src && insert(AM) == -1) // limit reached
break
@@ -448,3 +456,6 @@
/obj/structure/closet/singularity_act()
dump_contents()
..()
/obj/structure/closet/AllowDrop()
return TRUE