mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Fixes internal storage on ground
Fixes not being able to remove items from internal storage when the master item is on the ground.
This commit is contained in:
@@ -118,7 +118,8 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
// Allows you to click on a box's contents, if that box is on the ground, but no deeper than that
|
// Allows you to click on a box's contents, if that box is on the ground, but no deeper than that
|
||||||
if(isturf(A) || isturf(A.loc) || (A.loc && isturf(A.loc.loc)))
|
sdepth = A.storage_depth_turf()
|
||||||
|
if(isturf(A) || isturf(A.loc) || (sdepth != -1 && sdepth <= 1))
|
||||||
next_move = world.time + 10
|
next_move = world.time + 10
|
||||||
|
|
||||||
if(A.Adjacent(src)) // see adjacent.dm
|
if(A.Adjacent(src)) // see adjacent.dm
|
||||||
|
|||||||
@@ -81,7 +81,5 @@
|
|||||||
src.close(M)
|
src.close(M)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
/obj/item/weapon/storage/internal/Adjacent(var/atom/neighbor)
|
||||||
|
return master_item.Adjacent(neighbor)
|
||||||
|
|
||||||
|
|
||||||
@@ -456,12 +456,30 @@
|
|||||||
O.hear_talk(M, text)
|
O.hear_talk(M, text)
|
||||||
|
|
||||||
//Returns the storage depth of an atom. This is the number of storage items the atom is contained in before reaching toplevel (the area).
|
//Returns the storage depth of an atom. This is the number of storage items the atom is contained in before reaching toplevel (the area).
|
||||||
//Returns -1 if the atom was not found on user.
|
//Returns -1 if the atom was not found on container.
|
||||||
/atom/proc/storage_depth(mob/user)
|
/atom/proc/storage_depth(atom/container)
|
||||||
var/depth = 0
|
var/depth = 0
|
||||||
var/atom/cur_atom = src
|
var/atom/cur_atom = src
|
||||||
|
|
||||||
while (cur_atom && !(cur_atom in user.contents))
|
while (cur_atom && !(cur_atom in container.contents))
|
||||||
|
if (isarea(cur_atom))
|
||||||
|
return -1
|
||||||
|
if (istype(cur_atom.loc, /obj/item/weapon/storage))
|
||||||
|
depth++
|
||||||
|
cur_atom = cur_atom.loc
|
||||||
|
|
||||||
|
if (!cur_atom)
|
||||||
|
return -1 //inside something with a null loc.
|
||||||
|
|
||||||
|
return depth
|
||||||
|
|
||||||
|
//Like storage depth, but returns the depth to the nearest turf
|
||||||
|
//Returns -1 if no top level turf (a loc was null somewhere, or a non-turf atom's loc was an area somehow).
|
||||||
|
/atom/proc/storage_depth_turf()
|
||||||
|
var/depth = 0
|
||||||
|
var/atom/cur_atom = src
|
||||||
|
|
||||||
|
while (cur_atom && !isturf(cur_atom))
|
||||||
if (isarea(cur_atom))
|
if (isarea(cur_atom))
|
||||||
return -1
|
return -1
|
||||||
if (istype(cur_atom.loc, /obj/item/weapon/storage))
|
if (istype(cur_atom.loc, /obj/item/weapon/storage))
|
||||||
|
|||||||
Reference in New Issue
Block a user