Storage Exploit Fix (#17298)

* storage fix

* storage fix 2

* am i dumb?

* add message check

* Revert "am i dumb?"

This reverts commit 91f7f24968.
This commit is contained in:
matttheficus
2022-01-02 22:11:09 -05:00
committed by GitHub
parent c6d5f294c8
commit a4e2cbfe25

View File

@@ -164,6 +164,23 @@
master.attackby(I, usr, params)
return TRUE
/obj/screen/storage/proc/is_item_accessible(obj/item/I, mob/user)
if (!user || !I)
return FALSE
var/storage_depth = I.storage_depth(user)
if((I in user.loc) || (storage_depth != -1))
return TRUE
if(!isturf(user.loc))
return FALSE
var/storage_depth_turf = I.storage_depth_turf()
if(isturf(I.loc) || (storage_depth_turf != -1))
if(I.Adjacent(user))
return TRUE
return FALSE
/obj/screen/storage/MouseDrop_T(obj/item/I, mob/user)
if(!user || !istype(I) || user.incapacitated(ignore_restraints = TRUE, ignore_lying = TRUE) || istype(user.loc, /obj/mecha) || !master)
return
@@ -172,6 +189,11 @@
if(!S)
return
if(!is_item_accessible(I, user))
log_game("[user.simple_info_line()] tried to abuse storage remote drag&drop with '[I]' at [atom_loc_line(I)] into '[S]' at [atom_loc_line(S)]")
message_admins("[user.simple_info_line()] tried to abuse storage remote drag&drop with '[I]' at [atom_loc_line(I)] into '[S]' at [atom_loc_line(S)]")
return
if(I in S.contents) // If the item is already in the storage, move them to the end of the list
if(S.contents[S.contents.len] == I) // No point moving them at the end if they're already there!
return