Files
Alexis 21b4095dfd [MDB IGNORE] [IDB IGNORE] Upstream Sync - 04/17/2026 (#5453)
Upstream 04/17/2026

fixes https://github.com/Bubberstation/Bubberstation/issues/5549

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com>
Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com>
Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com>
Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com>
Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com>
Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com>
Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com>
Co-authored-by: loganuk <fakeemail123@aol.com>
Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com>
Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com>
Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com>
Co-authored-by: Lucy <lucy@absolucy.moe>
Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com>
Co-authored-by: Isratosh <Isratosh@hotmail.com>
Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com>
Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com>
Co-authored-by: Alexander V. <volas@ya.ru>
Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com>
Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
Co-authored-by: Tim <timothymtorres@gmail.com>
Co-authored-by: Iamgoofball <iamgoofball@gmail.com>
Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com>
Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com>
Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com>
Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com>
Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com>
Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com>
Co-authored-by: Josh <josh.adam.powell@gmail.com>
Co-authored-by: Josh Powell <josh.powell@softwire.com>
Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com>
Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com>
Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com>
Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
2026-05-16 00:56:00 +02:00

143 lines
4.9 KiB
Plaintext

/* Gifts
* Contains:
* Gifts
*/
/// 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'
icon_state = "giftdeliverypackage3"
inhand_icon_state = "gift"
resistance_flags = FLAMMABLE
/// What type of thing are we guaranteed to spawn in with?
var/obj/item/contains_type = null
/obj/item/gift/Initialize(mapload)
. = ..()
pixel_x = rand(-10,10)
pixel_y = rand(-10,10)
icon_state = "giftdeliverypackage[rand(1,5)]"
if(isnull(contains_type))
contains_type = get_gift_type()
/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/gift/examine(mob/user)
. = ..()
if(HAS_MIND_TRAIT(user, TRAIT_PRESENT_VISION) || isobserver(user))
. += span_notice("It contains \a [initial(contains_type.name)].")
/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)
SEND_SIGNAL(thing, COMSIG_ITEM_OPENED_FROM_GIFT, user)
qdel(src)
/obj/item/gift/proc/get_gift_type()
var/static/list/gift_type_list = null
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)
//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
/// 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!"
/// Weak reference to who this gift is for and who can open it, if that's nobody then anyone can
var/datum/weakref/recipient_ref = null
/obj/item/gift/anything/get_gift_type()
var/static/list/obj/item/possible_gifts = null
if(isnull(possible_gifts))
possible_gifts = get_sane_item_types(/obj/item)
var/gift_type = pick(possible_gifts)
return gift_type
/obj/item/gift/anything/attack_self(mob/user)
if (isnull(recipient_ref))
return ..()
var/datum/mind/recipient = recipient_ref.resolve()
if(recipient && recipient != user?.mind)
to_chat(user, span_notice("This gift isn't for you, and you don't want to get on Santa's bad side!"))
return FALSE
return ..()
/// Assign the mind of someone as the person this gift is for
/obj/item/gift/anything/proc/assign_recipient(datum/mind/recipient)
if (ismob(recipient)) // You're presumably at this point because you are an admin who fucked up but I will save you
var/mob/recipient_mob = recipient
recipient = recipient_mob.mind
if (isnull(recipient))
return
name = "[initial(name)] for [recipient.name] ([recipient.assigned_role.title])"
recipient_ref = WEAKREF(recipient)