Files
fab78d2957 Migrate gifts to the new attack chain and to the same file. (#32276)
* Migrate gifts to the new attack chain and the same file.

* Make wrapped gifts a small_delivery subtype.

* Remove duplicate vars.

* Apply suggestions from CRUNCH review.

Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
Signed-off-by: Alan <alfalfascout@users.noreply.github.com>

---------

Signed-off-by: Alan <alfalfascout@users.noreply.github.com>
Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
2026-08-01 06:10:02 +00:00

91 lines
2.7 KiB
Plaintext

/obj/item/clothing/suit/storage
var/obj/item/storage/internal/pockets = /obj/item/storage/internal
w_class = WEIGHT_CLASS_NORMAL //we don't want these to be able to fit in their own pockets.
/obj/item/clothing/suit/storage/Initialize(mapload)
. = ..()
pockets = new pockets(src, src)
pockets.storage_slots = 2 //two slots
pockets.max_w_class = WEIGHT_CLASS_SMALL //fit only pocket sized items
pockets.max_combined_w_class = 4
ADD_TRAIT(src, TRAIT_ADJACENCY_TRANSPARENT, ROUNDSTART_TRAIT)
/obj/item/clothing/suit/storage/Destroy()
QDEL_NULL(pockets)
return ..()
/obj/item/clothing/suit/storage/attack_hand(mob/user as mob)
if(pockets?.handle_attack_hand(user))
..(user)
/obj/item/clothing/suit/storage/MouseDrop(obj/over_object as obj)
if(pockets?.handle_mousedrop(usr, over_object))
..(over_object)
/obj/item/clothing/suit/storage/equipped(mob/user, slot)
..()
pockets?.update_viewers()
/obj/item/clothing/suit/storage/Moved(atom/oldloc, dir, forced = FALSE)
. = ..()
pockets?.update_viewers()
/obj/item/clothing/suit/storage/AltClick(mob/user)
..()
if(ishuman(user) && Adjacent(user) && !user.incapacitated(FALSE, TRUE))
pockets?.open(user)
add_fingerprint(user)
return
if(isobserver(user))
pockets?.show_to(user)
/obj/item/clothing/suit/storage/attack_ghost(mob/user)
if(isobserver(user))
// Revenants don't get to play with the toys.
pockets.show_to(user)
return ..()
/obj/item/clothing/suit/storage/item_interaction(mob/living/user, obj/item/used, list/modifiers)
// Inserts shouldn't be added into the inventory of the pockets if they're attaching.
if(istype(used, /obj/item/smithed_item/insert) && length(inserts) != insert_max)
return NONE
return pockets?.attackby__legacy__attackchain(used, user, modifiers)
/obj/item/clothing/suit/storage/emp_act(severity)
..()
pockets?.emp_act(severity)
/obj/item/clothing/suit/storage/hear_talk(mob/M, list/message_pieces)
pockets?.hear_talk(M, message_pieces)
..()
/obj/item/clothing/suit/storage/hear_message(mob/M, msg)
pockets?.hear_message(M, msg)
..()
/obj/item/clothing/suit/storage/proc/return_inv()
var/list/L = list()
for(var/obj/item/I in src.contents)
if(!istype(I, /obj/item/smithed_item/insert)) // We don't want people to pull inserts out without calling the proper signals, so they shouldn't be displayed in storage.
L += I
for(var/obj/item/storage/S in src)
L += S.return_inv()
for(var/obj/item/small_delivery/gift/G in src)
L += G.wrapped
if(isstorage(G.wrapped))
L += G.wrapped:return_inv()
return L
/obj/item/clothing/suit/storage/serialize()
var/list/data = ..()
data["pockets"] = pockets?.serialize()
return data
/obj/item/clothing/suit/storage/deserialize(list/data)
qdel(pockets)
pockets = list_to_object(data["pockets"], src)