From fab78d29579fc7e6433c9de22732e6317f917194 Mon Sep 17 00:00:00 2001 From: Alan Date: Sat, 1 Aug 2026 02:10:02 -0400 Subject: [PATCH] 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 --------- Signed-off-by: Alan Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> --- .../LavaRuins/lavaland_surface_pizzaparty.dmm | 4 +- code/game/objects/effects/misc_effects.dm | 10 -- .../objects/items/storage/storage_base.dm | 8 +- .../objects/items/weapons/gift_wrappaper.dm | 93 ++++++++++--------- .../items/weapons/grenades/clusterbuster.dm | 2 +- code/game/objects/items/weapons/misc_items.dm | 14 --- code/modules/clothing/suits/suit_storage.dm | 8 +- .../under/accessories/storage_accessories.dm | 8 +- code/modules/holiday/christmas.dm | 2 +- code/modules/mob/living/living.dm | 9 -- code/modules/recycling/sortingmachinery.dm | 1 + 11 files changed, 65 insertions(+), 94 deletions(-) diff --git a/_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_pizzaparty.dmm b/_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_pizzaparty.dmm index a31a5d9d758..4c8a90c06f3 100644 --- a/_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_pizzaparty.dmm +++ b/_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_pizzaparty.dmm @@ -122,7 +122,7 @@ "z" = ( /obj/structure/table/wood, /obj/structure/glowshroom, -/obj/item/a_gift, +/obj/item/small_delivery/gift/random, /turf/simulated/floor/wood/lavaland_air, /area/ruin/powered/pizza_party) "A" = ( @@ -191,7 +191,7 @@ /area/ruin/powered/pizza_party) "M" = ( /obj/effect/decal/cleanable/dirt, -/obj/item/a_gift, +/obj/item/small_delivery/gift/random, /turf/simulated/floor/wood/lavaland_air, /area/ruin/powered/pizza_party) "N" = ( diff --git a/code/game/objects/effects/misc_effects.dm b/code/game/objects/effects/misc_effects.dm index 6b77b153ec0..b425377707c 100644 --- a/code/game/objects/effects/misc_effects.dm +++ b/code/game/objects/effects/misc_effects.dm @@ -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' diff --git a/code/game/objects/items/storage/storage_base.dm b/code/game/objects/items/storage/storage_base.dm index e7ff87198dc..7b95ed46310 100644 --- a/code/game/objects/items/storage/storage_base.dm +++ b/code/game/objects/items/storage/storage_base.dm @@ -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 diff --git a/code/game/objects/items/weapons/gift_wrappaper.dm b/code/game/objects/items/weapons/gift_wrappaper.dm index 765014d86f9..a8b0abf05bf 100644 --- a/code/game/objects/items/weapons/gift_wrappaper.dm +++ b/code/game/objects/items/weapons/gift_wrappaper.dm @@ -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 + diff --git a/code/game/objects/items/weapons/grenades/clusterbuster.dm b/code/game/objects/items/weapons/grenades/clusterbuster.dm index 7ac5b4d2708..9ce8351811c 100644 --- a/code/game/objects/items/weapons/grenades/clusterbuster.dm +++ b/code/game/objects/items/weapons/grenades/clusterbuster.dm @@ -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" diff --git a/code/game/objects/items/weapons/misc_items.dm b/code/game/objects/items/weapons/misc_items.dm index db501789602..5195a5d2550 100644 --- a/code/game/objects/items/weapons/misc_items.dm +++ b/code/game/objects/items/weapons/misc_items.dm @@ -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' diff --git a/code/modules/clothing/suits/suit_storage.dm b/code/modules/clothing/suits/suit_storage.dm index db398de54cb..7a97caf578d 100644 --- a/code/modules/clothing/suits/suit_storage.dm +++ b/code/modules/clothing/suits/suit_storage.dm @@ -74,10 +74,10 @@ L += I for(var/obj/item/storage/S in src) L += S.return_inv() - for(var/obj/item/gift/G in src) - L += G.gift - if(isstorage(G.gift)) - L += G.gift: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() diff --git a/code/modules/clothing/under/accessories/storage_accessories.dm b/code/modules/clothing/under/accessories/storage_accessories.dm index d2b438a5b0b..c94d33648e4 100644 --- a/code/modules/clothing/under/accessories/storage_accessories.dm +++ b/code/modules/clothing/under/accessories/storage_accessories.dm @@ -58,10 +58,10 @@ for(var/obj/item/storage/S in src) L += S.return_inv() - for(var/obj/item/gift/G in src) - L += G.gift - if(isstorage(G.gift)) - L += G.gift: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/accessory/storage/activate_self(mob/user) diff --git a/code/modules/holiday/christmas.dm b/code/modules/holiday/christmas.dm index 00a5c06b3e7..78ca5fb2a0f 100644 --- a/code/modules/holiday/christmas.dm +++ b/code/modules/holiday/christmas.dm @@ -3,7 +3,7 @@ if(!is_station_level(xmas.z)) continue for(var/turf/simulated/floor/T in orange(1,xmas)) for(var/i=1,i<=rand(1,5),i++) - new /obj/item/a_gift(T) + new /obj/item/small_delivery/gift/random(T) for(var/mob/living/simple_animal/pet/dog/corgi/ian/Ian in GLOB.mob_list) Ian.place_on_head(new /obj/item/clothing/head/helmet/space/santahat) for(var/datum/crafting_recipe/snowman/S in GLOB.crafting_recipes) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 21f96e5355e..44e8fa2db46 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -452,11 +452,6 @@ //for(var/obj/item/storage/S in Storage.return_inv()) //Check for storage items // L += get_contents(S) - for(var/obj/item/gift/G in Storage.return_inv()) //Check for gift-wrapped items - L += G.gift - if(isstorage(G.gift)) - L += get_contents(G.gift) - for(var/obj/item/small_delivery/D in Storage.return_inv()) //Check for package wrapped items L += D.wrapped if(isstorage(D.wrapped)) //this should never happen @@ -478,10 +473,6 @@ L += get_contents(S) for(var/obj/item/bio_chip/storage/I in contents) //Check for storage implants. L += I.get_contents() - for(var/obj/item/gift/G in contents) //Check for gift-wrapped items - L += G.gift - if(isstorage(G.gift)) - L += get_contents(G.gift) for(var/obj/item/small_delivery/D in contents) //Check for package wrapped items L += D.wrapped diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index 145126158e6..caf21ffef62 100644 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -135,6 +135,7 @@ user.put_in_hands(wrapped) playsound(src, 'sound/items/poster_ripped.ogg', 50, TRUE) qdel(src) + return ITEM_INTERACT_COMPLETE /obj/item/small_delivery/item_interaction(mob/living/user, obj/item/used, list/modifiers) if(istype(used, /obj/item/dest_tagger))