Made storage nesting better, improved consistency between storage types. (#24699)

* Made storage nesting better, improved consistency between storage types.

* Out, er, space.

* Null safety is good.

* Apply suggestions from code review

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

---------

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
Charlie Nolan
2024-04-10 18:59:43 +00:00
committed by GitHub
co-authored by Burzah
parent 94c93c2537
commit fe74786905
9 changed files with 104 additions and 65 deletions
+15 -7
View File
@@ -64,20 +64,28 @@
This is not used in stock /tg/station currently.
*/
/atom/movable/Adjacent(atom/neighbor)
if(neighbor == loc) return 1
if(!isturf(loc)) return 0
if(neighbor == loc)
return TRUE
if(!isturf(loc))
return FALSE
for(var/turf/T in locs)
if(isnull(T)) continue
if(T.Adjacent(neighbor,src)) return 1
return 0
if(T.Adjacent(neighbor, src)) return TRUE
return FALSE
// This is necessary for storage items not on your person.
/obj/item/Adjacent(atom/neighbor, recurse = 1)
if(neighbor == loc) return 1
if(neighbor == loc)
return TRUE
if(!istype(neighbor))
return ..()
if(HAS_TRAIT(loc, TRAIT_ADJACENCY_TRANSPARENT))
// Transparent parent, don't decrease recurse.
return loc.Adjacent(neighbor, recurse)
if(isitem(loc) || isstructure(loc) || isvehicle(loc))
if(recurse > 0)
return loc.Adjacent(neighbor,recurse - 1)
return 0
return loc.Adjacent(neighbor, recurse - 1)
return FALSE
return ..()
/*