Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 8bce9f0

Browse files
committed
personalized santa gifts
1 parent f63e17f commit 8bce9f0

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

code/game/objects/items/gift.dm

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,35 @@ GLOBAL_LIST_EMPTY(possible_gifts)
2020

2121
var/obj/item/contains_type
2222

23+
var/should_have_victim = FALSE
24+
var/datum/weakref/victim
25+
2326
/obj/item/a_gift/Initialize(mapload)
2427
. = ..()
2528
pixel_x = rand(-10,10)
2629
pixel_y = rand(-10,10)
2730
icon_state = "giftdeliverypackage[rand(1,5)]"
2831

2932
contains_type = get_gift_type()
33+
if(should_have_victim)
34+
var/list/eligible_victims = list()
35+
for(var/mob/player in GLOB.player_list)
36+
if(player.client && player.stat <= SOFT_CRIT && SSjob.GetJob(player.mind.assigned_role) && !HAS_TRAIT(player.mind, TRAIT_CANNOT_OPEN_PRESENTS))
37+
eligible_victims |= player
38+
if(eligible_victims.len > 0)
39+
victim = WEAKREF(pick(eligible_victims))
3040

3141
/obj/item/a_gift/suicide_act(mob/user)
3242
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..."))
3343
return (BRUTELOSS)
3444

3545
/obj/item/a_gift/examine(mob/M)
3646
. = ..()
47+
var/mob/living/victim_ref = victim?.resolve()
48+
if(istype(victim_ref))
49+
. += span_notice("It has <b>[victim_ref]</b>'s name on it.")
50+
else
51+
. += span_notice("It lacks a name tag. Anyone can claim it!")
3752
if((M.mind && HAS_TRAIT(M.mind, TRAIT_PRESENT_VISION)) || isobserver(M))
3853
. += span_notice("It contains \a [initial(contains_type.name)].")
3954

@@ -42,6 +57,11 @@ GLOBAL_LIST_EMPTY(possible_gifts)
4257
to_chat(M, span_warning("You're supposed to be spreading gifts, not opening them yourself!"))
4358
return
4459

60+
var/mob/living/victim_ref = victim?.resolve()
61+
if(istype(victim_ref) && victim_ref != M)
62+
to_chat(M, span_warning("This isn't your gift!"))
63+
return
64+
4565
qdel(src)
4666

4767
var/obj/item/I = new contains_type(get_turf(M))
@@ -109,3 +129,6 @@ GLOBAL_LIST_EMPTY(possible_gifts)
109129
var/gift_type = pick(GLOB.possible_gifts)
110130

111131
return gift_type
132+
133+
/obj/item/a_gift/anything/personal
134+
should_have_victim = TRUE

code/game/objects/items/storage/backpack.dm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@
121121
if(M.mind && HAS_TRAIT(M.mind, TRAIT_CANNOT_OPEN_PRESENTS))
122122
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
123123
var/turf/floor = get_turf(src)
124-
var/obj/item/I = new /obj/item/a_gift/anything(floor)
125-
if(STR.can_be_inserted(I, stop_messages=TRUE))
126-
STR.handle_item_insertion(I, prevent_warning=TRUE)
124+
var/obj/item/a_gift/anything/personal/new_gift = new(floor)
125+
if(STR.can_be_inserted(new_gift, stop_messages=TRUE))
126+
STR.handle_item_insertion(new_gift, prevent_warning=TRUE)
127127
else
128-
qdel(I)
128+
qdel(new_gift)
129129

130130

131131
/obj/item/storage/backpack/cultpack

code/modules/clothing/outfits/event.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
gloves = /obj/item/clothing/gloves/color/red
1111

1212
box = /obj/item/storage/box/survival/engineer
13-
backpack_contents = list(/obj/item/a_gift/anything = 5)
13+
backpack_contents = list(/obj/item/a_gift/anything/personal = 5)
1414

1515
/datum/outfit/santa/post_equip(mob/living/carbon/human/H, visualsOnly = FALSE)
1616
if(visualsOnly)

0 commit comments

Comments
 (0)