mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 23:17:02 +01:00
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:
@@ -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 ..()
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user