Add ability to swap items in storage (#13648)

* Add ability to swap items in storage

Add ability to swap items in storage through
drag and drop
Fix "the the" message when putting item in storage
Clean code where possible

* Fix swap in stacked storages, clean up code (v3)

* Ignore restraints and lying for swapping items

* Clean up the code a bit, increase readability

* Clean up code, remove spawn(0)

* Fix some spacing issues

* Rename var, use crisp font
This commit is contained in:
dearmochi
2020-12-22 16:15:40 -05:00
committed by GitHub
parent 312c855371
commit 6ecc3d5234
6 changed files with 173 additions and 109 deletions
+9 -1
View File
@@ -310,7 +310,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect
if(istype(I, /obj/item/storage))
var/obj/item/storage/S = I
if(S.use_to_pickup)
if(S.collection_mode) //Mode is set to collect all items on a tile and we clicked on a valid one.
if(S.pickup_all_on_tile) //Mode is set to collect all items on a tile and we clicked on a valid one.
if(isturf(loc))
var/list/rejections = list()
var/success = 0
@@ -644,6 +644,14 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect
deltimer(tip_timer) //delete any in-progress timer if the mouse is moved off the item before it finishes
closeToolTip(usr)
/obj/item/MouseDrop_T(obj/item/I, mob/user)
if(!user || src == I)
return
if(loc && I.loc == loc && istype(loc, /obj/item/storage)) // Are we trying to swap two items in the storage?
var/obj/item/storage/S = loc
S.swap_items(src, I, user)
// Returns a numeric value for sorting items used as parts in machines, so they can be replaced by the rped
/obj/item/proc/get_part_rating()
return 0