diff --git a/code/__DEFINES/_flags/item_flags.dm b/code/__DEFINES/_flags/item_flags.dm index e2f6caecb2a0..9631ea14a1bc 100644 --- a/code/__DEFINES/_flags/item_flags.dm +++ b/code/__DEFINES/_flags/item_flags.dm @@ -26,6 +26,8 @@ #define ITEM_CAN_PARRY (1<<12) /// This item can be used in the directional blocking system. Only a basic check used to determine if we should proceed with directional block handling at all. #define ITEM_CAN_BLOCK (1<<13) +/// Является ли данный предмет семейной ценностью (family heirloom) +#define FAMILY_HEIRLOOM (1<<14) // BLUEMOON ADD - выбор вещей из лодаута как family heirloom // Flags for the clothing_flags var on /obj/item/clothing diff --git a/code/__DEFINES/loadout.dm b/code/__DEFINES/loadout.dm index d8d12f8f1625..c41e3ae3859b 100644 --- a/code/__DEFINES/loadout.dm +++ b/code/__DEFINES/loadout.dm @@ -85,6 +85,7 @@ #define LOADOUT_COLOR "loadout_color" #define LOADOUT_CUSTOM_NAME "loadout_custom_name" #define LOADOUT_CUSTOM_DESCRIPTION "loadout_custom_description" +#define LOADOUT_IS_HEIRLOOM "loadout_is_heirloom" // BLUEMOON ADD - выбор вещей из лодаута как family heirloom //loadout item flags #define LOADOUT_CAN_NAME (1<<0) //renaming items diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index fb5d2c2fad41..6527526f7968 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -264,6 +264,7 @@ DEFINE_BITFIELD(item_flags, list( "NO_MAT_REDEMPTION" = NO_MAT_REDEMPTION, "NO_PIXEL_RANDOM_DROP" = NO_PIXEL_RANDOM_DROP, "SLOWS_WHILE_IN_HAND" = SLOWS_WHILE_IN_HAND, + "FAMILY_HEIRLOOM" = FAMILY_HEIRLOOM // BLUEMOON ADD - выбор вещей из лодаута как family heirloom )) DEFINE_BITFIELD(material_flags, list( diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index afa4ac26ab85..494edd186930 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -722,6 +722,10 @@ SUBSYSTEM_DEF(job) if(!the_mob) the_mob = M // cause this doesn't get assigned if player is a latejoiner var/list/chosen_gear = the_mob.client.prefs.loadout_data["SAVE_[the_mob.client.prefs.loadout_slot]"] + var/heirloomer = FALSE + var/list/my_quirks = the_mob.client.prefs.all_quirks.Copy() + if("Семейная реликвия" in my_quirks) + heirloomer = TRUE if(the_mob.client && the_mob.client.prefs && (chosen_gear && chosen_gear.len)) if(!ishuman(M))//no silicons allowed return @@ -740,6 +744,10 @@ SUBSYSTEM_DEF(job) if(G.handle_post_equip) permitted = FALSE if(!permitted) + // BLUEMOON ADD START - выбор вещей из лодаута как family heirloom + if(i[LOADOUT_IS_HEIRLOOM] && heirloomer) + to_chat(M, "Вы не смогли взять с собой свой любимый предмет, [G.name], из-за ограничений вашей профессии или других проблем, но у вас была и другая семейная ценность, поэтому вы прихватили её!") + // BLUEMOON END continue var/obj/item/I = new G.path if(I) @@ -784,6 +792,14 @@ SUBSYSTEM_DEF(job) I.forceMove(get_turf(M)) // If everything fails, just put it on the floor under the mob. else qdel(I) + // BLUEMOON ADD START - выбор вещей из лодаута как family heirloom + if(i[LOADOUT_IS_HEIRLOOM] && !QDELETED(I) && heirloomer) + I.item_flags |= FAMILY_HEIRLOOM + if(!i[LOADOUT_CUSTOM_NAME]) + var/list/family_name = splittext(M.real_name, " ") + I.name = "\improper [family_name[family_name.len]] family [I.name]" + // BLUEMOON END + /datum/controller/subsystem/job/proc/post_equip_loadout(mob/dead/new_player/N, mob/living/M, bypass_prereqs = FALSE, can_drop = TRUE) var/mob/the_mob = N @@ -852,7 +868,6 @@ SUBSYSTEM_DEF(job) I.forceMove(get_turf(M)) // If everything fails, just put it on the floor under the mob. else qdel(I) - /datum/controller/subsystem/job/proc/FreeRole(rank) if(!rank) return diff --git a/code/datums/traits/negative.dm b/code/datums/traits/negative.dm index d9104e2f5123..6b95710ddd90 100644 --- a/code/datums/traits/negative.dm +++ b/code/datums/traits/negative.dm @@ -39,6 +39,7 @@ medical_record_text = "Пациент демонстрирует неестественную привязанность к семейной реликвии." var/obj/item/heirloom var/where + var/loadout_heirloom = FALSE // BLUEMOON EDIT - выбор вещей из лодаута как family heirloom processing_quirk = TRUE GLOBAL_LIST_EMPTY(family_heirlooms) @@ -47,43 +48,52 @@ GLOBAL_LIST_EMPTY(family_heirlooms) // Define holder and type var/mob/living/carbon/human/human_holder = quirk_holder var/obj/item/heirloom_type - - // The quirk holder's species - we have a 50% chance, if we have a species with a set heirloom, to choose a species heirloom. - var/datum/species/holder_species = human_holder.dna?.species - if(holder_species && LAZYLEN(holder_species.family_heirlooms) && prob(50)) - heirloom_type = pick(holder_species.family_heirlooms) - else - // Our quirk holder's job - var/datum/job/holder_job = SSjob.GetJob(human_holder.last_mind?.assigned_role) - if(holder_job && LAZYLEN(holder_job.family_heirlooms)) - heirloom_type = pick(holder_job.family_heirlooms) - - // If we didn't find an heirloom somehow, throw them a generic one - if(!heirloom_type) - heirloom_type = pick(/obj/item/toy/cards/deck, /obj/item/lighter, /obj/item/dice/d20) - - // Create the heirloom item - heirloom = new heirloom_type(get_turf(quirk_holder)) - + // BLUEMOON EDIT START - выбор вещей из лодаута как family heirloom + for (var/obj/item/item in quirk_holder.GetAllContents()) + if(item.item_flags & FAMILY_HEIRLOOM) + loadout_heirloom = TRUE + heirloom = item + if(!loadout_heirloom) + // The quirk holder's species - we have a 50% chance, if we have a species with a set heirloom, to choose a species heirloom. + var/datum/species/holder_species = human_holder.dna?.species + if(holder_species && LAZYLEN(holder_species.family_heirlooms) && prob(50)) + heirloom_type = pick(holder_species.family_heirlooms) + else + // Our quirk holder's job + var/datum/job/holder_job = SSjob.GetJob(human_holder.last_mind?.assigned_role) + if(holder_job && LAZYLEN(holder_job.family_heirlooms)) + heirloom_type = pick(holder_job.family_heirlooms) + + // If we didn't find an heirloom somehow, throw them a generic one + if(!heirloom_type) + heirloom_type = pick(/obj/item/toy/cards/deck, /obj/item/lighter, /obj/item/dice/d20) + // Create the heirloom item + heirloom = new heirloom_type(get_turf(quirk_holder)) + heirloom.item_flags |= FAMILY_HEIRLOOM + // Determine and assign item location + var/list/slots = list( + "В левом кармане" = ITEM_SLOT_LPOCKET, + "В правом кармане" = ITEM_SLOT_RPOCKET, + "В рюкзаке" = ITEM_SLOT_BACKPACK + ) + where = human_holder.equip_in_one_of_slots(heirloom, slots, FALSE) || "под ногами" + // BLUEMOON EDIT END // Add to global list GLOB.family_heirlooms += heirloom - // Determine and assign item location - var/list/slots = list( - "В левом кармане" = ITEM_SLOT_LPOCKET, - "В правом кармане" = ITEM_SLOT_RPOCKET, - "В рюкзаке" = ITEM_SLOT_BACKPACK - ) - where = human_holder.equip_in_one_of_slots(heirloom, slots, FALSE) || "под ногами" - /datum/quirk/family_heirloom/post_add() - if(where == "В рюкзаке") - var/mob/living/carbon/human/H = quirk_holder - SEND_SIGNAL(H.back, COMSIG_TRY_STORAGE_SHOW, H) - - to_chat(quirk_holder, "[where] находится [heirloom.name], передающаяся из поколения в поколение. Береги её!") - var/list/family_name = splittext(quirk_holder.real_name, " ") - heirloom.name = "\improper [family_name[family_name.len]] family [heirloom.name]" + // BLUEMOON EDIT START - выбор вещей из лодаута как family heirloom + if(!loadout_heirloom) + if(where == "В рюкзаке") + var/mob/living/carbon/human/H = quirk_holder + SEND_SIGNAL(H.back, COMSIG_TRY_STORAGE_SHOW, H) + + to_chat(quirk_holder, "[where] находится [heirloom.name], передающаяся из поколения в поколение. Береги её!") + var/list/family_name = splittext(quirk_holder.real_name, " ") + heirloom.name = "\improper [family_name[family_name.len]] family [heirloom.name]" + else + to_chat(quirk_holder, "Ты прихватил с собой свою любимую вещь, [heirloom.name]. Береги её!") + // BLUEMOON EDIT END /datum/quirk/family_heirloom/on_process() // Ignore for dead holder diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 9be81ee4644f..a6f6a31eef22 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -316,6 +316,22 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb var/datum/block_parry_data/data = return_block_parry_datum(block_parry_data) . += "[src] has the capacity to be used to block and/or parry. \[Show Stats\]" + // BLUEMOON ADD START - выбор вещей из лодаута как family heirloom + if(item_flags & FAMILY_HEIRLOOM) + var/my_heirloom = FALSE + if(istype(user, /mob/living)) + var/mob/living/examiner = user + for(var/datum/quirk/Q in examiner.roundstart_quirks) + if(istype(Q, /datum/quirk/family_heirloom)) + var/datum/quirk/family_heirloom/heirloom_quirk = Q + if(src == heirloom_quirk.heirloom) + my_heirloom = TRUE // МОЯ ПРЕЛЕСТЬ! + if(my_heirloom) + . += "[src] - это моя реликвия! Нужно её беречь!" + else + . += "[src] выглядит очень ухоженно. Видимо, этот предмет кому-то ценен..." + // BLUEMOON ADD END + if(!user.research_scanner) return diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 172776985c9b..de00a1ed5a28 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -1340,8 +1340,16 @@ GLOBAL_LIST_EMPTY(preferences_datums) extra_loadout_data += "
Name [loadout_item[LOADOUT_CUSTOM_NAME] ? loadout_item[LOADOUT_CUSTOM_NAME] : "N/A"]" if(gear.loadout_flags & LOADOUT_CAN_DESCRIPTION) extra_loadout_data += "
Description" + else + extra_loadout_data += "
Select as Heirloom
" + // BLUEMOON ADD START - выбор вещей из лодаута как family heirloom + if(loadout_item[LOADOUT_IS_HEIRLOOM]) + extra_loadout_data += "
Select as Heirloom
" + else + extra_loadout_data += "
Select as Heirloom
" if(ispath(gear.path, /obj/item/clothing/neck/petcollar)) //"name tag" sounds better for me, but in petcollar code "tagname" is used so let it be. extra_loadout_data += "
Name tag [loadout_item["loadout_custom_tagname"] ? loadout_item["loadout_custom_tagname"] : "Name tag is visible for everyone looking at wearer."]" + // BLUEMOON ADD END else if((gear_points - gear.cost) < 0) class_link = "style='white-space:normal;' class='linkOff'" else if(donoritem) @@ -1363,8 +1371,9 @@ GLOBAL_LIST_EMPTY(preferences_datums) dat += gear.restricted_roles.Join(";") dat += "" if(!istype(gear, /datum/gear/unlockable)) + var/is_heirloom_string = loadout_item ? (loadout_item[LOADOUT_IS_HEIRLOOM] ? "

Ваша семейная реликвия!
" : "") : "" // BLUEMOON EDIT - выбор вещей из лодаута как family heirloom // the below line essentially means "if the loadout item is picked by the user and has a custom description, give it the custom description, otherwise give it the default description" - dat += "[loadout_item ? (loadout_item[LOADOUT_CUSTOM_DESCRIPTION] ? loadout_item[LOADOUT_CUSTOM_DESCRIPTION] : gear.description) : gear.description]" + dat += "[loadout_item ? (loadout_item[LOADOUT_CUSTOM_DESCRIPTION] ? loadout_item[LOADOUT_CUSTOM_DESCRIPTION] : gear.description) : gear.description] [is_heirloom_string]" // BLUEMOON EDIT - выбор вещей из лодаута как family heirloom else //we add the user's progress to the description assuming they have progress var/datum/gear/unlockable/unlockable = gear @@ -4173,6 +4182,11 @@ GLOBAL_LIST_EMPTY(preferences_datums) return var/toggle = text2num(href_list["toggle_gear"]) if(!toggle && has_loadout_gear(loadout_slot, "[G.type]"))//toggling off and the item effectively is in chosen gear) + var/gear = has_loadout_gear(loadout_slot, "[G.type]") + // BLUEMOON EDIT START - выбор вещей из лодаута как family heirloom + if (gear[LOADOUT_IS_HEIRLOOM]) + gear[LOADOUT_IS_HEIRLOOM] = FALSE + // BLUEMOON EDIT END - выбор вещей из лодаута как family heirloom remove_gear_from_loadout(loadout_slot, "[G.type]") else if(toggle && !(has_loadout_gear(loadout_slot, "[G.type]"))) if(!is_loadout_slot_available(G.category)) @@ -4204,7 +4218,8 @@ GLOBAL_LIST_EMPTY(preferences_datums) sanitize_current_slot.Remove(list(entry)) break - if(href_list["loadout_color"] || href_list["loadout_color_polychromic"] || href_list["loadout_color_HSV"] || href_list["loadout_rename"] || href_list["loadout_redescribe"] || href_list["loadout_tagname"]) + if(href_list["loadout_color"] || href_list["loadout_color_polychromic"] || href_list["loadout_color_HSV"] || href_list["loadout_rename"] || href_list["loadout_redescribe"] || href_list["loadout_addheirloom"] || href_list["loadout_removeheirloom"] || href_list["loadout_tagname"]) + //if the gear doesn't exist, or they don't have it, ignore the request var/name = html_decode(href_list["loadout_gear_name"]) var/datum/gear/G = GLOB.loadout_items[gear_category][gear_subcategory][name] @@ -4262,6 +4277,17 @@ GLOBAL_LIST_EMPTY(preferences_datums) var/new_description = stripped_input(user, "Enter new description for item. Maximum 500 characters.", "Loadout Item Redescribing", null, 500) if(new_description) user_gear[LOADOUT_CUSTOM_DESCRIPTION] = new_description + // BLUEMOON ADD START - выбор вещей из лодаута как family heirloom + if(href_list["loadout_addheirloom"]) + // Выбран ли какой-либо другой предмет как семейная реликвия, и если да, то какой? + var/existing = find_gear_with_property(loadout_slot, LOADOUT_IS_HEIRLOOM, TRUE) + if(!existing) + user_gear[LOADOUT_IS_HEIRLOOM] = TRUE + else + to_chat(user, "У вас уже выбрана ваша семейная реликвия!") + if(href_list["loadout_removeheirloom"]) + user_gear[LOADOUT_IS_HEIRLOOM] = FALSE + // BLUEMOON ADD END //for collars with tagnames if(href_list["loadout_tagname"]) @@ -4517,6 +4543,15 @@ GLOBAL_LIST_EMPTY(preferences_datums) if(L[slot] < DEFAULT_SLOT_AMT) return TRUE +// BLUEMOON ADD START - выбор вещей из лодаута как семейной реликвии +///Searching for loadout item which `property` ([LOADOUT_ITEM], [LOADOUT_COLOR], etc) equals to `value`; returns this items, or FALSE if no gear matched conditions +/datum/preferences/proc/find_gear_with_property(save_slot, property, value) + var/list/gear_list = loadout_data["SAVE_[save_slot]"] + for(var/loadout_gear in gear_list) + if(loadout_gear[property] == value) + return loadout_gear + return FALSE + /datum/preferences/proc/has_loadout_gear(save_slot, gear_type) var/list/gear_list = loadout_data["SAVE_[save_slot]"] for(var/loadout_gear in gear_list) diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 07e31b85cc9b..d84ce665fa2f 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -1123,7 +1123,6 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car loadout_data = safe_json_decode(S["loadout"]) else loadout_data = list() - //try to fix any outdated data if necessary //preference updating will handle saving the updated data for us. if(needs_update >= 0) diff --git a/modular_splurt/code/modules/client/preferences.dm b/modular_splurt/code/modules/client/preferences.dm index 5e55be5a2e6a..f4d8100ae0ea 100644 --- a/modular_splurt/code/modules/client/preferences.dm +++ b/modular_splurt/code/modules/client/preferences.dm @@ -1041,6 +1041,12 @@ extra_loadout_data += "
Name [loadout_item[LOADOUT_CUSTOM_NAME] ? loadout_item[LOADOUT_CUSTOM_NAME] : "N/A"]" if(gear.loadout_flags & LOADOUT_CAN_DESCRIPTION) extra_loadout_data += "
Description" + else + extra_loadout_data += "
Select as Heirloom
" + // BLUEMOON ADD START - выбор вещей из лодаута как family heirloom + if(loadout_item[LOADOUT_IS_HEIRLOOM]) + extra_loadout_data += "
Select as Heirloom
" + // BLUEMOON ADD END else if((gear_points - gear.cost) < 0) class_link = "style='white-space:normal;' class='linkOff'" else if(donoritem)