Skip to content

Commit bd50c28

Browse files
authored
Heirloom Audit and Custom(ish) Heirlooms (#823)
1 parent 0469065 commit bd50c28

75 files changed

Lines changed: 583 additions & 380 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

code/__DEFINES/dcs/signals/signals_object.dm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
/// from /obj/obj_reskin: (mob/user, skin)
1616
#define COMSIG_OBJ_RESKIN "obj_reskin"
1717

18+
/// from /datum/component/subtype_picker/pick_subtype(): (obj/item/old_item, mob/picker)
19+
#define COMSIG_ITEM_SUBTYPE_PICKER_SELECTED "item_subtype_picker_selected"
20+
/// from /datum/component/subtype_picker/pick_subtype(): (obj/item/new_item, mob/picker)
21+
#define COMSIG_ITEM_SUBTYPE_PICKER_REPLACED "item_subtype_picker_replaced"
22+
1823
// /obj/machinery signals
1924

2025
///from /obj/machinery/atom_break(damage_flag): (damage_flag)

code/__DEFINES/preferences.dm

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,19 @@
154154
#define SPRITE_ACCESSORY_NONE "None"
155155

156156
// Loadout
157-
/// Used to make something not recolorable even if it's capable
158-
#define DONT_GREYSCALE -1
157+
/// When equipped, applies a job specific palette to the item. Only applicable to GAGS items.
158+
#define LOADOUT_FLAG_JOB_GREYSCALING (1<<0)
159+
/// Prevents GAGS items from being player customizable.
160+
#define LOADOUT_FLAG_BLOCK_GREYSCALING (1<<1)
161+
/// Allows the item to be greyscaled by the player, if it's a GAGS item. Automatically set if the item is innately recolorable.
162+
#define LOADOUT_FLAG_GREYSCALING_ALLOWED (1<<2)
163+
/// Allows the item to be renamed by the player.
164+
#define LOADOUT_FLAG_ALLOW_NAMING (1<<3)
165+
/// Allows the item to be reskinned by the player. Only applicable to items with unique_reskin defined.
166+
#define LOADOUT_FLAG_ALLOW_RESKIN (1<<4)
167+
/// The item can be selected as a family heirloom for the family heirloom quirk.
168+
#define LOADOUT_FLAG_ALLOW_HEIRLOOM (1<<5)
169+
159170
// Loadout item info keys
160171
// Changing these will break existing loadouts
161172
/// Tracks GAGS color information
@@ -166,8 +177,28 @@
166177
#define INFO_RESKIN "reskin"
167178
/// Handles which layer the item will be on, for accessories
168179
#define INFO_LAYER "layer"
180+
/// Is this item an heirloom item
181+
#define INFO_HEIRLOOM "heirloom"
169182

170183
// Lipstick styles
171184
#define UPPER_LIP "Upper"
172185
#define MIDDLE_LIP "Middle"
173186
#define LOWER_LIP "Lower"
187+
188+
// Job greyscale colors for loadout items
189+
#define COLOR_JOB_ASSISTANT /obj/item/clothing/under/color/grey::greyscale_colors
190+
#define COLOR_JOB_BOTANIST "#33cc33"
191+
#define COLOR_JOB_CARGO_GENERIC "#824b32"
192+
#define COLOR_JOB_CE "#d0d0d0"
193+
#define COLOR_JOB_CHEF "#d0d0d0"
194+
#define COLOR_JOB_CHEMIST "#ff6600"
195+
#define COLOR_JOB_CLOWN "#ffbeff"
196+
#define COLOR_JOB_CMO "#009999"
197+
#define COLOR_JOB_DEFAULT "#303030"
198+
#define COLOR_JOB_ENGI_GENERIC "#ff6600"
199+
#define COLOR_JOB_JANITOR /obj/item/clothing/gloves/color/purple::greyscale_colors
200+
#define COLOR_JOB_LAWYER "#003399"
201+
#define COLOR_JOB_SCI_GENERIC "#800080"
202+
#define COLOR_JOB_SEC_GENERIC "#A53228"
203+
#define COLOR_JOB_MED_GENERIC "#5B97BC"
204+
#define COLOR_JOB_COMMAND_GENERIC "#3C5A96"

code/datums/components/heirloom.dm

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// Heirloom component. For use with the family heirloom quirk, tracks that an item is someone's family heirloom.
22
/datum/component/heirloom
3+
can_transfer = TRUE
34
/// The mind that actually owns our heirloom.
45
var/datum/mind/owner
56
/// Flavor. The family name of the owner of the heirloom.
@@ -12,7 +13,20 @@
1213
owner = new_owner
1314
family_name = new_family_name
1415

16+
/datum/component/heirloom/RegisterWithParent()
1517
RegisterSignal(parent, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))
18+
RegisterSignal(parent, COMSIG_ITEM_SUBTYPE_PICKER_REPLACED, PROC_REF(transfer_to_new_item))
19+
20+
/datum/component/heirloom/UnregisterFromParent()
21+
UnregisterSignal(parent, COMSIG_ATOM_EXAMINE)
22+
UnregisterSignal(parent, COMSIG_ITEM_SUBTYPE_PICKER_REPLACED)
23+
24+
/datum/component/heirloom/PostTransfer()
25+
if(!isitem(parent))
26+
return COMPONENT_INCOMPATIBLE
27+
// Moves weakref to our new item
28+
var/datum/quirk/item_quirk/family_heirloom/quirk = owner?.current?.get_quirk(/datum/quirk/item_quirk/family_heirloom)
29+
quirk?.heirloom = WEAKREF(parent)
1630

1731
/datum/component/heirloom/Destroy(force)
1832
owner = null
@@ -38,3 +52,9 @@
3852
return
3953

4054
examine_list += span_notice("It is the [family_name] family heirloom, belonging to [owner].")
55+
56+
/// Transfer the component to a new item when a subtype picker replaces it.
57+
/datum/component/heirloom/proc/transfer_to_new_item(datum/source, obj/item/new_item, mob/user)
58+
SIGNAL_HANDLER
59+
60+
new_item.TakeComponent(src)

code/datums/components/subtype_picker.dm

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@
6969
return
7070

7171
var/picked_subtype = name2subtype[name_of_type]
72-
on_picked_callback?.Invoke(picked_subtype)
73-
picked_subtype = new picked_subtype(picker.drop_location())
72+
var/obj/item/picked = new picked_subtype(picker.drop_location())
73+
on_picked_callback?.Invoke(picked, picker)
74+
SEND_SIGNAL(picked, COMSIG_ITEM_SUBTYPE_PICKER_SELECTED, target, picker)
75+
SEND_SIGNAL(target, COMSIG_ITEM_SUBTYPE_PICKER_REPLACED, picked, picker)
7476

7577
qdel(target)
76-
picker.put_in_hands(picked_subtype)
78+
picker.put_in_hands(picked)
7779

7880
/**
7981
* Checks if we are allowed to interact with the radial menu

code/datums/outfit.dm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@
2424
var/id_trim = null
2525

2626
/// Type path of item to go in uniform slot
27-
var/uniform = null
27+
var/obj/item/uniform = null
2828

2929
/// Type path of item to go in suit slot
30-
var/suit = null
30+
var/obj/item/suit = null
3131

3232
/**
3333
* Type path of item to go in suit storage slot
3434
*
3535
* (make sure it's valid for that suit)
3636
*/
37-
var/suit_store = null
37+
var/obj/item/suit_store = null
3838

3939
/// Type path of item to go in back slot
40-
var/back = null
40+
var/obj/item/back = null
4141

4242
/**
4343
* list of items that should go in the backpack of the user
@@ -47,7 +47,7 @@
4747
var/list/backpack_contents = null
4848

4949
/// Type path of item to go in belt slot
50-
var/belt = null
50+
var/obj/item/belt = null
5151

5252
/// Type path of item to go in ears slot
5353
var/ears = null

code/datums/quirks/negative_quirks/family_heirloom.dm

Lines changed: 61 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
/datum/quirk/item_quirk/family_heirloom
22
name = "Family Heirloom"
3-
desc = "You are the current owner of an heirloom, passed down for generations. You have to keep it safe!"
3+
desc = "You are the current owner of an heirloom, passed down for generations. \
4+
The heirloom is based on your species, job, or one you selected in the loadout. \
5+
You have to keep it safe!"
46
icon = FA_ICON_TOOLBOX
57
value = -2
68
medical_record_text = "Patient demonstrates an unnatural attachment to a family heirloom."
79
hardcore_value = 1
8-
quirk_flags = QUIRK_HUMAN_ONLY|QUIRK_PROCESSES|QUIRK_MOODLET_BASED
10+
quirk_flags = QUIRK_HUMAN_ONLY|QUIRK_PROCESSES|QUIRK_MOODLET_BASED|QUIRK_CHANGES_APPEARANCE
911
/// A weak reference to our heirloom.
1012
var/datum/weakref/heirloom
1113
mail_goodies = list(/obj/item/storage/briefcase/secure)
@@ -14,31 +16,69 @@
1416
var/mob/living/carbon/human/human_holder = quirk_holder
1517
var/obj/item/heirloom_type
1618

17-
// The quirk holder's species - we have a 50% chance, if we have a species with a set heirloom, to choose a species heirloom.
19+
var/list/loadout = get_active_loadout(client_source?.prefs)
20+
var/loadout_heirloom = FALSE
21+
for(var/item_path in loadout)
22+
if(loadout[item_path][INFO_HEIRLOOM])
23+
heirloom_type = item_path
24+
loadout_heirloom = TRUE
25+
break
26+
27+
if(!loadout_heirloom && !GLOB.holy_weapon_type && quirk_holder.mind?.holy_role)
28+
for(var/obj/item/nullrod/rod in GLOB.steal_item_handler.objectives_by_path[/obj/item/nullrod])
29+
var/turf/rod_turf = get_turf(rod)
30+
if(!is_station_level(rod_turf.z))
31+
continue
32+
heirloom = WEAKREF(rod)
33+
LAZYADD(where_items_spawned, span_boldnotice("Your [rod.name] can be found in your office. It is your precious family heirloom, keep it safe!"))
34+
return
35+
1836
var/datum/species/holder_species = human_holder.dna?.species
37+
var/datum/job/holder_job = human_holder.mind?.assigned_role
1938
if(holder_species && LAZYLEN(holder_species.family_heirlooms) && prob(50))
2039
heirloom_type = pick(holder_species.family_heirlooms)
21-
else
22-
// Our quirk holder's job
23-
var/datum/job/holder_job = human_holder.last_mind?.assigned_role
24-
if(holder_job && LAZYLEN(holder_job.family_heirlooms))
25-
heirloom_type = pick(holder_job.family_heirlooms)
40+
else if(holder_job && LAZYLEN(holder_job.family_heirlooms))
41+
heirloom_type = pick(holder_job.family_heirlooms)
2642

2743
// If we didn't find an heirloom somehow, throw them a generic one
28-
if(!heirloom_type)
29-
heirloom_type = pick(/obj/item/toy/cards/deck, /obj/item/lighter, /obj/item/dice/d20)
44+
heirloom_type ||= pick(/obj/item/toy/cards/deck, /obj/item/lighter, /obj/item/dice/d20)
3045

31-
var/obj/new_heirloom = new heirloom_type(get_turf(human_holder))
46+
var/obj/item/new_heirloom = new heirloom_type(get_turf(human_holder))
3247
heirloom = WEAKREF(new_heirloom)
3348

49+
if(loadout_heirloom)
50+
var/datum/loadout_item/relevant_item = GLOB.all_loadout_datums[heirloom_type]
51+
relevant_item?.on_equip_item(new_heirloom, client_source?.prefs, loadout, human_holder)
52+
53+
var/list/spawn_locations = list()
54+
// specific slots
55+
if(new_heirloom.slot_flags & ITEM_SLOT_HEAD)
56+
spawn_locations[LOCATION_HEAD] = ITEM_SLOT_HEAD
57+
if(new_heirloom.slot_flags & ITEM_SLOT_OCLOTHING)
58+
spawn_locations["around your body"] = ITEM_SLOT_OCLOTHING
59+
if(new_heirloom.slot_flags & ITEM_SLOT_EYES)
60+
spawn_locations[LOCATION_EYES] = ITEM_SLOT_EYES
61+
if(new_heirloom.slot_flags & ITEM_SLOT_EARS)
62+
spawn_locations["covering your ears"] = ITEM_SLOT_EARS
63+
if(new_heirloom.slot_flags & ITEM_SLOT_GLOVES)
64+
spawn_locations["covering your hands"] = ITEM_SLOT_GLOVES
65+
if(new_heirloom.slot_flags & ITEM_SLOT_NECK)
66+
spawn_locations[LOCATION_NECK] = ITEM_SLOT_NECK
67+
if(new_heirloom.slot_flags & ITEM_SLOT_MASK)
68+
spawn_locations["covering your face"] = ITEM_SLOT_MASK
69+
if(new_heirloom.slot_flags & ITEM_SLOT_FEET)
70+
spawn_locations["covering your feet"] = ITEM_SLOT_FEET
71+
if(new_heirloom.slot_flags & ITEM_SLOT_BELT)
72+
spawn_locations["around your waist"] = ITEM_SLOT_BELT
73+
// defaults / accessories can just go to backpack, that's fine
74+
spawn_locations[LOCATION_LPOCKET] = ITEM_SLOT_LPOCKET
75+
spawn_locations[LOCATION_RPOCKET] = ITEM_SLOT_RPOCKET
76+
spawn_locations[LOCATION_BACKPACK] = ITEM_SLOT_BACKPACK
77+
spawn_locations[LOCATION_HANDS] = ITEM_SLOT_HANDS
78+
3479
give_item_to_holder(
3580
new_heirloom,
36-
list(
37-
LOCATION_LPOCKET = ITEM_SLOT_LPOCKET,
38-
LOCATION_RPOCKET = ITEM_SLOT_RPOCKET,
39-
LOCATION_BACKPACK = ITEM_SLOT_BACKPACK,
40-
LOCATION_HANDS = ITEM_SLOT_HANDS,
41-
),
81+
spawn_locations,
4282
flavour_text = "This is a precious family heirloom, passed down from generation to generation. Keep it safe!",
4383
notify_player = TRUE,
4484
)
@@ -47,21 +87,20 @@
4787
var/list/names = splittext(quirk_holder.real_name, " ")
4888
var/family_name = names[names.len]
4989

50-
var/obj/family_heirloom = heirloom?.resolve()
51-
if(!family_heirloom)
90+
var/obj/item/family_heirloom = heirloom?.resolve()
91+
if(isnull(family_heirloom))
5292
to_chat(quirk_holder, span_boldnotice("A wave of existential dread runs over you as you realize your precious family heirloom is missing. Perhaps the Gods will show mercy on your cursed soul?"))
5393
return
5494
family_heirloom.AddComponent(/datum/component/heirloom, quirk_holder.mind, family_name)
55-
5695
return ..()
5796

5897
/datum/quirk/item_quirk/family_heirloom/process()
59-
if(quirk_holder.stat == DEAD)
98+
if(HAS_TRAIT(quirk_holder, TRAIT_KNOCKEDOUT))
6099
return
61100

62101
var/obj/family_heirloom = heirloom?.resolve()
63102

64-
if(family_heirloom && (family_heirloom in quirk_holder.get_all_contents()))
103+
if(family_heirloom && get(family_heirloom.loc, /mob/living/carbon/human) == quirk_holder)
65104
quirk_holder.clear_mood_event("family_heirloom_missing")
66105
quirk_holder.add_mood_event("family_heirloom", /datum/mood_event/family_heirloom)
67106
else

code/modules/bitrunning/job.dm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
/datum/job_department/cargo,
1919
)
2020

21-
family_heirlooms = list(/obj/item/reagent_containers/cup/soda_cans/space_mountain_wind)
21+
// family_heirlooms = list(
22+
// /obj/item/reagent_containers/cup/soda_cans/space_mountain_wind,
23+
// )
2224

2325
mail_goodies = list(
2426
/obj/item/food/cornchips = 1,

code/modules/clothing/suits/jobs.dm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
. = ..()
6060
AddComponent(/datum/component/adjust_fishing_difficulty, -2)
6161

62+
/obj/item/clothing/suit/apron/overalls/grey
63+
greyscale_colors = COLOR_JOB_DEFAULT
64+
icon_state = "/obj/item/clothing/suit/apron/overalls/grey"
6265
//Captain
6366
/obj/item/clothing/suit/jacket/capjacket
6467
name = "captain's parade jacket"

code/modules/jobs/job_types/assistant/assistant.dm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ Assistant
2222

2323
department_for_prefs = /datum/job_department/assistant
2424

25-
family_heirlooms = list(/obj/item/storage/toolbox/mechanical/old/heirloom, /obj/item/clothing/gloves/cut/heirloom)
25+
// family_heirlooms = list(
26+
// /obj/item/storage/toolbox/mechanical/old/heirloom,
27+
// /obj/item/clothing/gloves/cut/heirloom,
28+
// )
2629

2730
mail_goodies = list(
2831
/obj/effect/spawner/random/food_or_drink/donkpockets = 10,

code/modules/jobs/job_types/atmospheric_technician.dm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
/datum/job_department/engineering,
2727
)
2828

29-
family_heirlooms = list(/obj/item/lighter, /obj/item/lighter/greyscale, /obj/item/storage/box/matches)
29+
family_heirlooms = list(
30+
/obj/item/lighter,
31+
/obj/item/lighter/greyscale,
32+
)
3033

3134
mail_goodies = list(
3235
/obj/item/rpd_upgrade/unwrench = 30,

0 commit comments

Comments
 (0)