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>
This commit is contained in:
Alan
2026-08-01 06:10:02 +00:00
committed by GitHub
co-authored by CRUNCH
parent f3c1c9ef7b
commit fab78d2957
11 changed files with 65 additions and 94 deletions
-10
View File
@@ -3,7 +3,6 @@
//This file is for effects that are less than 20 lines and don't fit very well in any other category.
/*CURRENT CONTENTS
Strange Present
Mark
Beam
Laser
@@ -16,15 +15,6 @@
List_container
*/
//The effect when you wrap a dead body in gift wrap
/obj/effect/spresent
name = "strange present"
desc = "It's a ... present?"
icon = 'icons/obj/items.dmi'
icon_state = "strangepresent"
density = TRUE
anchored = FALSE
/obj/effect/mark
var/mark = ""
icon = 'icons/misc/mark.dmi'
@@ -204,10 +204,10 @@
for(var/obj/item/storage/S in src) // Inventory of nested storage items
L += S.return_inv()
for(var/obj/item/gift/G in src)
L += G.gift
if(isstorage(G.gift)) // If the gift contains a storage item
var/obj/item/storage/S = G.gift
for(var/obj/item/small_delivery/gift/G in src)
L += G.wrapped
if(isstorage(G.wrapped)) // If the gift contains a storage item.
var/obj/item/storage/S = G.wrapped
L += S.return_inv()
for(var/obj/item/folder/F in src)
L += F.contents
@@ -7,48 +7,29 @@
/*
* Gifts
*/
/obj/item/a_gift
/obj/item/small_delivery/gift
name = "gift"
desc = "PRESENTS!!!! eek!"
icon_state = "gift1"
desc = "A gift-wrapped item."
icon_state = "giftcrate2"
giftwrapped = TRUE
inhand_icon_state = "gift"
resistance_flags = FLAMMABLE
scatter_distance = 10
/obj/item/a_gift/Initialize(mapload)
. = ..()
/obj/item/small_delivery/gift/Initialize(mapload)
..()
if(wrapped && isitem(wrapped))
icon_state = "giftcrate[wrapped.w_class]"
/obj/item/small_delivery/gift/activate_self(mob/user)
if(!wrapped)
to_chat(user, SPAN_WARNING("The gift was empty!"))
return ..()
/obj/item/small_delivery/gift/random
desc = "PRESENTS!!!! eek!"
/obj/item/small_delivery/gift/random/Initialize(mapload)
scatter_atom()
if(w_class > 0 && w_class < 4)
icon_state = "gift[w_class]"
else
icon_state = "gift[pick(1, 2, 3)]"
/obj/item/gift/attack_self__legacy__attackchain(mob/user as mob)
user.drop_item()
if(src.gift)
user.put_in_active_hand(gift)
src.gift.add_fingerprint(user)
else
to_chat(user, SPAN_NOTICE("The gift was empty!"))
qdel(src)
/obj/effect/spresent/relaymove(mob/user as mob)
if(user.stat)
return
to_chat(user, SPAN_NOTICE("You can't move."))
/obj/effect/spresent/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(!istype(used, /obj/item/wirecutters))
to_chat(user, SPAN_NOTICE("I need wirecutters for that."))
return ITEM_INTERACT_COMPLETE
to_chat(user, SPAN_NOTICE("You cut open the present."))
for(var/mob/M in src) //Should only be one but whatever.
M.forceMove(loc)
qdel(src)
return ITEM_INTERACT_COMPLETE
/obj/item/a_gift/attack_self__legacy__attackchain(mob/M as mob)
var/gift_type = pick(
/obj/effect/spawner/random/toy/carp_plushie,
/obj/effect/spawner/random/plushies,
@@ -111,14 +92,10 @@
/obj/item/stack/tile/fakespace/loaded,
)
if(!ispath(gift_type,/obj/item)) return
var/obj/item/I = new gift_type(M)
M.unequip(src, force = TRUE)
M.put_in_hands(I)
I.add_fingerprint(M)
qdel(src)
return
wrapped = new gift_type(src)
if(!(wrapped in contents))
wrapped = contents[1]
return ..()
/*
* Wrapping Paper
@@ -138,3 +115,29 @@
. = ..()
to_chat(user, SPAN_NOTICE("You need to use it on a package that has already been wrapped!"))
return ITEM_INTERACT_COMPLETE
// The effect when you wrap a dead body in gift wrap.
/obj/effect/spresent
name = "strange present"
desc = "It's a ... present?"
icon = 'icons/obj/items.dmi'
icon_state = "strangepresent"
density = TRUE
anchored = FALSE
/obj/effect/spresent/relaymove(mob/user)
if(user.stat)
return
to_chat(user, SPAN_NOTICE("You can't move."))
/obj/effect/spresent/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(!istype(used, /obj/item/wirecutters))
to_chat(user, SPAN_WARNING("You need wirecutters for that!"))
return ITEM_INTERACT_COMPLETE
to_chat(user, SPAN_NOTICE("You cut open the present."))
for(var/mob/M in src) // Should only be one but whatever.
M.forceMove(loc)
qdel(src)
return ITEM_INTERACT_COMPLETE
@@ -156,7 +156,7 @@
/obj/item/grenade/clusterbuster/xmas
name = "\improper Christmas Miracle"
payload = /obj/item/a_gift
payload = /obj/item/small_delivery/gift/random
/obj/item/grenade/clusterbuster/dirt
name = "\improper Megamaid's Job Security Grenade"
@@ -8,7 +8,6 @@
Cardboard Tube
Fan
Gaming Kit
Gift
Kidan Globe
Lightning
Newton Cradle
@@ -187,19 +186,6 @@
desc = "A small desktop fan. The button seems to be stuck in the 'on' position."
new_attack_chain = TRUE
/obj/item/gift
name = "gift"
desc = "A wrapped item."
icon_state = "gift3"
inhand_icon_state = "gift"
w_class = WEIGHT_CLASS_BULKY
var/size = 3.0
var/obj/item/gift = null
/obj/item/gift/emp_act(severity)
..()
gift.emp_act(severity)
/obj/item/kidanglobe
name = "Kidan homeworld globe"
icon = 'icons/obj/decorations.dmi'