diff --git a/_maps/RandomRuins/LavaRuins/lavaland_surface_pizzaparty.dmm b/_maps/RandomRuins/LavaRuins/lavaland_surface_pizzaparty.dmm index 8fc2a2b03de..f05c972ec35 100644 --- a/_maps/RandomRuins/LavaRuins/lavaland_surface_pizzaparty.dmm +++ b/_maps/RandomRuins/LavaRuins/lavaland_surface_pizzaparty.dmm @@ -377,10 +377,10 @@ /obj/structure/rack, /obj/item/storage/box/lights/bulbs, /obj/item/storage/toolbox/mechanical/old, -/obj/item/a_gift{ +/obj/item/gift{ contains_type = /obj/item/gun/ballistic/automatic/toy/unrestricted }, -/obj/item/a_gift{ +/obj/item/gift{ contains_type = /obj/item/gun/ballistic/automatic/pistol/toy }, /obj/item/ammo_box/foambox, @@ -524,13 +524,13 @@ /obj/structure/table/wood, /obj/effect/decal/cleanable/dirt, /obj/machinery/light/small/directional/south, -/obj/item/a_gift{ +/obj/item/gift{ contains_type = /obj/item/toy/plush/goatplushie; pixel_x = 7; pixel_y = 6 }, /obj/structure/sign/clock/directional/south, -/obj/item/a_gift{ +/obj/item/gift{ contains_type = /obj/item/toy/plush/ratplush; pixel_x = -4; pixel_y = 2 @@ -713,7 +713,7 @@ /obj/structure/table, /obj/effect/turf_decal/tile/yellow/diagonal_edge, /obj/effect/turf_decal/tile/neutral/diagonal_centre, -/obj/item/a_gift{ +/obj/item/gift{ contains_type = /obj/item/toy/figure/wizard }, /turf/open/floor/iron/diagonal/lavaland, diff --git a/code/game/machinery/computer/arcade/arcade.dm b/code/game/machinery/computer/arcade/arcade.dm index 9ff935a9165..b9e8bd9d1e9 100644 --- a/code/game/machinery/computer/arcade/arcade.dm +++ b/code/game/machinery/computer/arcade/arcade.dm @@ -695,4 +695,4 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list( /obj/machinery/computer/arcade/amputation/festive //dispenses wrapped gifts instead of arcade prizes, also known as the ancap christmas tree name = "Mediborg's Festive Amputation Adventure" desc = "A picture of a blood-soaked medical cyborg wearing a Santa hat flashes on the screen. The mediborg has a speech bubble that says, \"Put your hand in the machine if you aren't a coward!\"" - prize_override = list(/obj/item/a_gift/anything = 1) + prize_override = list(/obj/item/gift/anything = 1) diff --git a/code/game/objects/items/gift.dm b/code/game/objects/items/gift.dm index 324151feddb..866945d9440 100644 --- a/code/game/objects/items/gift.dm +++ b/code/game/objects/items/gift.dm @@ -1,16 +1,10 @@ -/* Gifts and wrapping paper +/* Gifts * Contains: * Gifts - * Wrapping Paper */ -/* - * Gifts - */ - -GLOBAL_LIST_EMPTY(possible_gifts) - -/obj/item/a_gift +/// Gifts to give to players, will contain a nice toy or other fun item for them to play with. +/obj/item/gift name = "gift" desc = "PRESENTS!!!! eek!" icon = 'icons/obj/storage/wrapping.dmi' @@ -18,99 +12,112 @@ GLOBAL_LIST_EMPTY(possible_gifts) inhand_icon_state = "gift" resistance_flags = FLAMMABLE - var/obj/item/contains_type + /// What type of thing are we guaranteed to spawn in with? + var/obj/item/contains_type = null -/obj/item/a_gift/Initialize(mapload) +/obj/item/gift/Initialize(mapload) . = ..() pixel_x = rand(-10,10) pixel_y = rand(-10,10) icon_state = "giftdeliverypackage[rand(1,5)]" - contains_type = get_gift_type() + if(isnull(contains_type)) + contains_type = get_gift_type() -/obj/item/a_gift/suicide_act(mob/living/user) +/obj/item/gift/suicide_act(mob/living/user) user.visible_message(span_suicide("[user] peeks inside [src] and cries [user.p_them()]self to death! It looks like [user.p_they()] [user.p_were()] on the naughty list...")) return BRUTELOSS -/obj/item/a_gift/examine(mob/M) +/obj/item/gift/examine(mob/user) . = ..() - if(HAS_MIND_TRAIT(M, TRAIT_PRESENT_VISION) || isobserver(M)) + if(HAS_MIND_TRAIT(user, TRAIT_PRESENT_VISION) || isobserver(user)) . += span_notice("It contains \a [initial(contains_type.name)].") -/obj/item/a_gift/attack_self(mob/M) - if(HAS_MIND_TRAIT(M, TRAIT_CANNOT_OPEN_PRESENTS)) - to_chat(M, span_warning("You're supposed to be spreading gifts, not opening them yourself!")) +/obj/item/gift/attack_self(mob/user) + if(HAS_MIND_TRAIT(user, TRAIT_CANNOT_OPEN_PRESENTS)) + to_chat(user, span_warning("You're supposed to be spreading gifts, not opening them yourself!")) return + moveToNullspace() + + var/obj/item/thing = new contains_type(get_turf(user)) + + if (QDELETED(thing)) //might contain something like metal rods that might merge with a stack on the ground + user.visible_message(span_danger("Oh no! The present that [user] opened had nothing inside it!")) + else + user.visible_message(span_notice("[user] unwraps \the [src], finding \a [thing] inside!")) + user.investigate_log("has unwrapped a present containing [thing.type].", INVESTIGATE_PRESENTS) + user.put_in_hands(thing) + thing.add_fingerprint(user) + qdel(src) - var/obj/item/I = new contains_type(get_turf(M)) - if (!QDELETED(I)) //might contain something like metal rods that might merge with a stack on the ground - M.visible_message(span_notice("[M] unwraps \the [src], finding \a [I] inside!")) - M.investigate_log("has unwrapped a present containing [I.type].", INVESTIGATE_PRESENTS) - M.put_in_hands(I) - I.add_fingerprint(M) - else - M.visible_message(span_danger("Oh no! The present that [M] opened had nothing inside it!")) +/obj/item/gift/proc/get_gift_type() + var/static/list/gift_type_list = null -/obj/item/a_gift/proc/get_gift_type() - var/gift_type_list = list(/obj/item/sord, - /obj/item/storage/wallet, - /obj/item/storage/photo_album, - /obj/item/storage/box/snappops, - /obj/item/storage/crayons, - /obj/item/storage/backpack/holding, - /obj/item/storage/belt/champion, - /obj/item/soap/deluxe, - /obj/item/pickaxe/diamond, - /obj/item/pen/invisible, - /obj/item/lipstick/random, - /obj/item/grenade/smokebomb, - /obj/item/grown/corncob, - /obj/item/poster/random_contraband, - /obj/item/poster/random_official, - /obj/item/book/manual/wiki/barman_recipes, - /obj/item/book/manual/chef_recipes, - /obj/item/bikehorn, - /obj/item/toy/beach_ball, - /obj/item/toy/basketball, - /obj/item/banhammer, - /obj/item/food/grown/ambrosia/deus, - /obj/item/food/grown/ambrosia/vulgaris, - /obj/item/pai_card, - /obj/item/instrument/violin, - /obj/item/instrument/guitar, - /obj/item/storage/belt/utility/full, - /obj/item/clothing/neck/tie/horrible, - /obj/item/clothing/suit/jacket/leather, - /obj/item/clothing/suit/jacket/leather/biker, - /obj/item/clothing/suit/costume/poncho, - /obj/item/clothing/suit/costume/poncho/green, - /obj/item/clothing/suit/costume/poncho/red, - /obj/item/clothing/suit/costume/snowman, - /obj/item/clothing/head/costume/snowman, - /obj/item/stack/sheet/mineral/coal) + if(isnull(gift_type_list)) + gift_type_list = list( + /obj/item/banhammer, + /obj/item/bikehorn, + /obj/item/book/manual/chef_recipes, + /obj/item/book/manual/wiki/barman_recipes, + /obj/item/clothing/head/costume/snowman, + /obj/item/clothing/neck/tie/horrible, + /obj/item/clothing/suit/costume/poncho, + /obj/item/clothing/suit/costume/poncho/green, + /obj/item/clothing/suit/costume/poncho/red, + /obj/item/clothing/suit/costume/snowman, + /obj/item/clothing/suit/jacket/leather, + /obj/item/clothing/suit/jacket/leather/biker, + /obj/item/food/grown/ambrosia/deus, + /obj/item/food/grown/ambrosia/vulgaris, + /obj/item/grenade/smokebomb, + /obj/item/grown/corncob, + /obj/item/instrument/guitar, + /obj/item/instrument/violin, + /obj/item/lipstick/random, + /obj/item/pai_card, + /obj/item/pen/invisible, + /obj/item/pickaxe/diamond, + /obj/item/poster/random_contraband, + /obj/item/poster/random_official, + /obj/item/soap/deluxe, + /obj/item/sord, + /obj/item/stack/sheet/mineral/coal, + /obj/item/storage/backpack/holding, + /obj/item/storage/belt/champion, + /obj/item/storage/belt/utility/full, + /obj/item/storage/box/snappops, + /obj/item/storage/crayons, + /obj/item/storage/photo_album, + /obj/item/storage/wallet, + /obj/item/toy/basketball, + /obj/item/toy/beach_ball, + ) - gift_type_list += subtypesof(/obj/item/clothing/head/collectable) - gift_type_list += subtypesof(/obj/item/toy) - (((typesof(/obj/item/toy/cards) - /obj/item/toy/cards/deck) + /obj/item/toy/figure + /obj/item/toy/ammo)) //All toys, except for abstract types and syndicate cards. + gift_type_list += subtypesof(/obj/item/clothing/head/collectable) + //Add all toys, except for abstract types and syndicate cards. + gift_type_list += subtypesof(/obj/item/toy) - (((typesof(/obj/item/toy/cards) - /obj/item/toy/cards/deck) + /obj/item/toy/figure + /obj/item/toy/ammo)) var/gift_type = pick(gift_type_list) - return gift_type - -/obj/item/a_gift/anything +/// Gifts that typically only very OP stuff or admins or Santa Claus himself should be giving out, as they contain ANY valid subtype of `/obj/item`, including stuff like instagib rifles. Wow! +/obj/item/gift/anything name = "christmas gift" desc = "It could be anything!" -/obj/item/a_gift/anything/get_gift_type() - if(!GLOB.possible_gifts.len) - var/list/gift_types_list = subtypesof(/obj/item) - for(var/V in gift_types_list) - var/obj/item/I = V - if((!initial(I.icon_state)) || (!initial(I.inhand_icon_state)) || (initial(I.item_flags) & ABSTRACT)) - gift_types_list -= V - GLOB.possible_gifts = gift_types_list - var/gift_type = pick(GLOB.possible_gifts) +/obj/item/gift/anything/get_gift_type() + var/static/list/obj/item/possible_gifts = null + if(isnull(possible_gifts)) + possible_gifts = list() + for(var/type in subtypesof(/obj/item)) + var/obj/item/thing = type + if(!initial(thing.icon_state) || !initial(thing.inhand_icon_state) || (initial(thing.item_flags) & ABSTRACT)) + continue + + possible_gifts += type + + var/gift_type = pick(possible_gifts) return gift_type diff --git a/code/game/objects/items/storage/backpack.dm b/code/game/objects/items/storage/backpack.dm index ee0f232a216..f5783d30c8d 100644 --- a/code/game/objects/items/storage/backpack.dm +++ b/code/game/objects/items/storage/backpack.dm @@ -102,7 +102,7 @@ return if(HAS_MIND_TRAIT(user, TRAIT_CANNOT_OPEN_PRESENTS)) var/turf/floor = get_turf(src) - var/obj/item/thing = new /obj/item/a_gift/anything(floor) + var/obj/item/thing = new /obj/item/gift/anything(floor) if(!atom_storage.attempt_insert(thing, user, override = TRUE, force = STORAGE_SOFT_LOCKED)) qdel(thing) diff --git a/code/game/objects/structures/flora.dm b/code/game/objects/structures/flora.dm index eab29099dfd..5d75f9cb02d 100644 --- a/code/game/objects/structures/flora.dm +++ b/code/game/objects/structures/flora.dm @@ -451,7 +451,7 @@ /obj/structure/flora/tree/pine/xmas/presents icon_state = "pinepresents" desc = "A wondrous decorated Christmas tree. It has presents!" - var/gift_type = /obj/item/a_gift/anything + var/gift_type = /obj/item/gift/anything var/unlimited = FALSE var/static/list/took_presents //shared between all xmas trees diff --git a/code/modules/clothing/outfits/event.dm b/code/modules/clothing/outfits/event.dm index aa85bd795a3..fc94adb9ff5 100644 --- a/code/modules/clothing/outfits/event.dm +++ b/code/modules/clothing/outfits/event.dm @@ -5,8 +5,8 @@ suit = /obj/item/clothing/suit/space/santa back = /obj/item/storage/backpack/santabag backpack_contents = list( - /obj/item/a_gift/anything = 5, -) + /obj/item/gift/anything = 5, + ) gloves = /obj/item/clothing/gloves/color/red head = /obj/item/clothing/head/helmet/space/santahat/beardless shoes = /obj/item/clothing/shoes/sneakers/red diff --git a/code/modules/holiday/holidays.dm b/code/modules/holiday/holidays.dm index 8c62144dfc5..b9155f3c3b6 100644 --- a/code/modules/holiday/holidays.dm +++ b/code/modules/holiday/holidays.dm @@ -842,9 +842,9 @@ SSticker.OnRoundstart(CALLBACK(src, PROC_REF(roundstart_celebrate))) GLOB.maintenance_loot += list( list( - /obj/item/toy/xmas_cracker = 3, /obj/item/clothing/head/costume/santa = 1, - /obj/item/a_gift/anything = 1 + /obj/item/gift/anything = 1, + /obj/item/toy/xmas_cracker = 3, ) = maint_holiday_weight, ) diff --git a/code/modules/spells/spell_types/conjure/presents.dm b/code/modules/spells/spell_types/conjure/presents.dm index 057fef9b9b4..b630c43225c 100644 --- a/code/modules/spells/spell_types/conjure/presents.dm +++ b/code/modules/spells/spell_types/conjure/presents.dm @@ -10,5 +10,5 @@ invocation_type = INVOCATION_SHOUT summon_radius = 3 - summon_type = list(/obj/item/a_gift) + summon_type = list(/obj/item/gift) summon_amount = 5 diff --git a/tools/UpdatePaths/Scripts/80035_gift_renaming.txt b/tools/UpdatePaths/Scripts/80035_gift_renaming.txt new file mode 100644 index 00000000000..910259aa0b7 --- /dev/null +++ b/tools/UpdatePaths/Scripts/80035_gift_renaming.txt @@ -0,0 +1 @@ +/obj/item/a_gift : /obj/item/gift{@OLD}