diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 3c3ceea9d347..fc17b34a2c2a 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -731,7 +731,7 @@ var/mob/living/carbon/human/H = user if(H.get_item_by_slot(SLOT_HUD_JUMPSUIT) == src) for(var/obj/item/clothing/accessory/A in accessories) - A.attached_unequip() + A.attached_unequip(user) // SS220 EDIT - FIX /obj/item/clothing/under/equipped(mob/user, slot, initial) ..() @@ -739,7 +739,7 @@ return if(slot == SLOT_HUD_JUMPSUIT) for(var/obj/item/clothing/accessory/A in accessories) - A.attached_equip() + A.attached_equip(user) // SS220 EDIT - FIX /* * # can_attach_accessory diff --git a/modular_ss220/modular_ss220.dme b/modular_ss220/modular_ss220.dme index 53a170e02283..8e0f223a9a41 100644 --- a/modular_ss220/modular_ss220.dme +++ b/modular_ss220/modular_ss220.dme @@ -77,6 +77,7 @@ #include "phrases/_phrases.dme" #include "species_whitelist/_species_whitelist.dme" #include "antagonists/_antagonists.dme" +#include "ranks/_ranks.dme" // --- PRIME --- // // #define MODPACK_MAIN_ONLY diff --git a/modular_ss220/ranks/_rank.dme b/modular_ss220/ranks/_rank.dme deleted file mode 100644 index 78355d28b543..000000000000 --- a/modular_ss220/ranks/_rank.dme +++ /dev/null @@ -1,14 +0,0 @@ -#include "_ranks.dm" - -#include "code/accessory.dm" -#include "code/accessory_security.dm" -#include "code/job/security_rank.dm" -// BEGIN_INTERNALS -// END_INTERNALS -// BEGIN_FILE_DIR -#define FILE_DIR . -// END_FILE_DIR -// BEGIN_PREFERENCES -// END_PREFERENCES -// BEGIN_INCLUDE -// END_INCLUDE diff --git a/modular_ss220/ranks/_rank.dm b/modular_ss220/ranks/_ranks.dm similarity index 100% rename from modular_ss220/ranks/_rank.dm rename to modular_ss220/ranks/_ranks.dm diff --git a/modular_ss220/ranks/_ranks.dme b/modular_ss220/ranks/_ranks.dme new file mode 100644 index 000000000000..31ed897f6107 --- /dev/null +++ b/modular_ss220/ranks/_ranks.dme @@ -0,0 +1,7 @@ +#include "_ranks.dm" + +#include "code/accessory.dm" +#include "code/accessory_security.dm" +#include "code/accessory_supervisor.dm" +#include "code/job/security_rank.dm" +#include "code/job/supervisor_rank.dm" diff --git a/modular_ss220/ranks/code/accessory.dm b/modular_ss220/ranks/code/accessory.dm index 6a7f032847c5..49ace57cd746 100644 --- a/modular_ss220/ranks/code/accessory.dm +++ b/modular_ss220/ranks/code/accessory.dm @@ -6,6 +6,7 @@ name = "голографические погоны" desc = "Погоны выдаваемые при выслуге лет. Наденьте их и каждый увидит ваше звание." icon = 'modular_ss220/ranks/icons/clothing/attachments.dmi' + icon_override = 'modular_ss220/ranks/icons/clothing/mob/attachments_overlay.dmi' icon_state = "holobadge" item_state = "" //no inhands item_color = "holobadge" @@ -23,63 +24,77 @@ . = ..() inv_overlay = image("icon" = 'modular_ss220/ranks/icons/clothing/mob/attachments_overlay.dmi', "icon_state" = "[item_color? "[item_color]" : "[icon_state]"]") if(!length(rank_exp_order_dict) || !(length(exp_types))) - QDEL(src) + qdel(src) + if(ishuman(loc)) + var/mob/living/carbon/human/H = loc + owner = H.mind + get_rank_name(H) // ============= Attach&Pick ============= -/obj/item/clothing/accessory/rank/pickup(mob/living/user) + +/obj/item/clothing/under/attach_accessory(obj/item/clothing/accessory/A, mob/user, unequip = FALSE) + if(!istype(A, /obj/item/clothing/accessory/rank)) + return FALSE + var/obj/item/clothing/accessory/rank/attachment = A + if(!attachment.check_allowed_to_attach(user)) + to_chat(user, span_warning("При приближении к цели, [src.name] деактивируется!")) + return FALSE . = ..() - check_allowed_to_attach(user) -/obj/item/clothing/accessory/on_attached(obj/item/clothing/under/S, mob/user as mob) +/obj/item/clothing/accessory/rank/attack(mob/living/carbon/human/H, mob/living/user) + . = TRUE + if(!check_allowed_to_attach(H)) + to_chat(user, span_warning("При приближении к [H], [src.name] деактивируется!")) + return FALSE . = ..() - if(!check_allowed_to_attach(user)) - return +// Clothing equip at human +/obj/item/clothing/accessory/rank/attached_equip(mob/user) saved_real_name = user.real_name - user.rename_character(M.real_name, get_rank_name(user)) + user.rename_character(user.real_name, get_rank_name(user)) -/obj/item/clothing/accessory/on_removed(mob/user) . = ..() - user.rename_character(M.real_name, saved_real_name) -/obj/item/clothing/accessory/rank/attached_equip(mob/user) +// Clothing drop from human +/obj/item/clothing/accessory/rank/attached_unequip(mob/user) + user.rename_character(user.real_name, saved_real_name) + . = ..() - if(!check_allowed_to_attach(user)) - return - saved_real_name = user.real_name - user.rename_character(M.real_name, get_rank_name(user)) +/obj/item/clothing/accessory/rank/on_attached(obj/item/clothing/under/S, mob/user as mob) + attached_equip(user) + . = ..() -/obj/item/clothing/accessory/rank/attached_unequip(mob/user) +/obj/item/clothing/accessory/rank/on_removed(mob/user) + attached_unequip(user) . = ..() - user.rename_character(M.real_name, saved_real_name) /obj/item/clothing/accessory/rank/proc/check_allowed_to_attach(mob/user) - if(user.mind) + if(!user.mind) to_chat(user, span_warning("[src.name] слетели с [user], не зафиксировав в нём отклика разума.")) return FALSE + if(!owner) owner = user.mind - to_chat(user, span_notice("[src.name] привязались к [user].")) + return TRUE + if(user.mind == owner) return TRUE - to_chat(user, span_warning("[src.name] слетели!")) - user.Confused(2 SECONDS) - user.Jitter(1 SECONDS) - if(has_suit) - has_suit.detach_accessory(src, null) - return FALSE + return FALSE // ============= Initial Name ============= /obj/item/clothing/accessory/rank/proc/get_rank_name(mob/user) var/exp_sum = 0 + var/datum/job/job_req + if(add_job_req_exp) + job_req = SSjobs.GetJob(user.job) var/list/play_records = params2list(user.client.prefs.exp) for(var/exp_type in exp_types) if(!(exp_type in play_records)) continue - exp_sum += text2num(play_records[exp_type]) + exp_sum += text2num(play_records[exp_type]) - (job_req ? job_req.exp_map[exp_type] : 0) var/choosen_rank for(var/rank in rank_exp_order_dict) diff --git a/modular_ss220/ranks/code/accessory_security.dm b/modular_ss220/ranks/code/accessory_security.dm index fb27883052e4..f53d52aafd80 100644 --- a/modular_ss220/ranks/code/accessory_security.dm +++ b/modular_ss220/ranks/code/accessory_security.dm @@ -2,9 +2,10 @@ // Воинские и офицерские звания // ================================= -// Officer, Detective +// Officer /obj/item/clothing/accessory/rank/sec icon_state = "holobadge_rank" + item_state = "gold_id" item_color = "holobadge_rank" exp_types = list(EXP_TYPE_SECURITY) rank_exp_order_dict = list( @@ -28,12 +29,59 @@ "Гвардии Прапорщик" = 3000, ) -// HOS, Warden, Blueshield +// Detective +/obj/item/clothing/accessory/rank/sec/detective + add_job_req_exp = TRUE + rank_exp_order_dict = list( + "Рядовой" = 0, + "Рядовой I кл." = 15, + "Ефрейтор" = 30, + "Мл.Сержант" = 50, + "Сержант" = 70, + "Ст.Сержант" = 80, + "Старшина" = 100, + + // Дослужился до дековских и полицейских званий + "Сыщик" = 150, + "Следователь" = 300, + "Ст.Следователь" = 500, + "Специалист Бюро" = 700, + "Инспектор" = 1000, + "Начальник Исследовательского Бюро" = 3000, // большие часы. Большое название. + ) + +// Warden +/obj/item/clothing/accessory/rank/sec/warden + icon_state = "holobadge_rank_officer" + item_color = "holobadge_rank_officer" + add_job_req_exp = TRUE + rank_exp_order_dict = list( + // у Вардена начальный ускоренный курс + "Рядовой" = 0, + "Рядовой I кл." = 2, + "Ефрейтор" = 5, + "Мл.Сержант" = 10, + "Сержант" = 15, + "Ст.Сержант" = 30, + + // Дошел до привычных званий + "Старшина" = 50, + "Прапорщик" = 100, + "Ст.Прапорщик" = 300, + + // Уникальные звания, до которых никто не дойдет. + "Смотритель" = 500, + "Надзиратель" = 1000, + "Тюремный Начальник" = 1500, + "Верховный Надзиратель" = 3000, // нафармил + ) + +// HOS /obj/item/clothing/accessory/rank/sec/officer icon_state = "holobadge_rank_officer" item_color = "holobadge_rank_officer" exp_types = list(EXP_TYPE_SECURITY, EXP_TYPE_COMMAND) - add_required_exp_for_prof = TRUE + add_job_req_exp = TRUE rank_exp_order_dict = list( "Прапорщик" = 0, "Ст.Прапорщик" = 50, @@ -51,14 +99,14 @@ ) // Special for spawns -/obj/item/clothing/accessory/rank/sec/officer/seniour +/obj/item/clothing/accessory/rank/sec/officer/supreme rank_exp_order_dict = list( "Подполковник" = 0, "Полковник" = 50, "Генерал-майор" = 150, "Генерал-лейтенант" = 300, "Генерал-полковник" = 500, - "Генерал" = 800, + "Верховный Генерал" = 800, "Гвардии Полковник" = 1000, "Гвардии Генерал" = 2000, diff --git a/modular_ss220/ranks/code/accessory_supervisor.dm b/modular_ss220/ranks/code/accessory_supervisor.dm new file mode 100644 index 000000000000..8316313eda8f --- /dev/null +++ b/modular_ss220/ranks/code/accessory_supervisor.dm @@ -0,0 +1,37 @@ +// ================================= +// Звания наблюдателей за станцией +// ================================= + +// BlueShield +/obj/item/clothing/accessory/rank/blueshield + icon_state = "holobadge_rank_officer" + item_state = "gold_id" + item_color = "holobadge_rank_officer" + exp_types = list(EXP_TYPE_SECURITY, EXP_TYPE_COMMAND) + rank_exp_order_dict = list( + // Блющилд имеет сумму опытов, от того и начинает с нуля. + "Рядовой" = 0, + "Рядовой I кл." = 5, + "Ефрейтор" = 15, + "Мл.Сержант" = 30, + "Сержант" = 50, + "Ст.Сержант" = 100, + "Старшина" = 150, + "Прапорщик" = 200, + "Ст.Прапорщик" = 300, + "Мл.Лейтенант" = 400, + "Лейтенант" = 500, + "Ст.Лейтенант" = 600, + "Капитан" = 700, + "Майор" = 900, + + // Блющилд дослужился до 1000? Шо ж... А теперь пускай попробует это! + "Гвардии Рядовой" = 1000, + "Гвардии Ефрейтор" = 1250, + "Гвардии Сержант" = 1500, + "Гвардии Старшина" = 1750, + "Гвардии Прапорщик" = 2000, + "Гвардии Лейтенант" = 2250, + "Гвардии Капитан" = 2500, + "Гвардии Майор" = 3000, + ) diff --git a/modular_ss220/ranks/code/job/security_rank.dm b/modular_ss220/ranks/code/job/security_rank.dm index 245f2ba9ce90..328b49c9db19 100644 --- a/modular_ss220/ranks/code/job/security_rank.dm +++ b/modular_ss220/ranks/code/job/security_rank.dm @@ -1,16 +1,20 @@ - -/datum/job/officer/New() +// Security +/datum/job/officer/equip(mob/living/carbon/human/H, visualsOnly, announce) . = ..() - backpack_contents |= /obj/item/clothing/accessory/rank/sec + var/accessory = new /obj/item/clothing/accessory/rank/sec(H) + H.equip_or_collect(accessory, SLOT_HUD_IN_BACKPACK) -/datum/job/detective/New() +/datum/job/detective/equip(mob/living/carbon/human/H, visualsOnly, announce) . = ..() - backpack_contents |= /obj/item/clothing/accessory/rank/sec + var/accessory = new /obj/item/clothing/accessory/rank/sec/detective(H) + H.equip_or_collect(accessory, SLOT_HUD_IN_BACKPACK) -/datum/job/warden/New() +/datum/job/warden/equip(mob/living/carbon/human/H, visualsOnly, announce) . = ..() - backpack_contents |= /obj/item/clothing/accessory/rank/sec/officer + var/accessory = new /obj/item/clothing/accessory/rank/sec/warden(H) + H.equip_or_collect(accessory, SLOT_HUD_IN_BACKPACK) -/datum/job/hos/New() +/datum/job/hos/equip(mob/living/carbon/human/H, visualsOnly, announce) . = ..() - backpack_contents |= /obj/item/clothing/accessory/rank/sec/officer + var/accessory = new /obj/item/clothing/accessory/rank/sec/officer(H) + H.equip_or_collect(accessory, SLOT_HUD_IN_BACKPACK) diff --git a/modular_ss220/ranks/code/job/supervisor_rank.dm b/modular_ss220/ranks/code/job/supervisor_rank.dm new file mode 100644 index 000000000000..35ebc665bbd7 --- /dev/null +++ b/modular_ss220/ranks/code/job/supervisor_rank.dm @@ -0,0 +1,4 @@ +/datum/job/blueshield/equip(mob/living/carbon/human/H, visualsOnly, announce) + . = ..() + var/accessory = new /obj/item/clothing/accessory/rank/blueshield(H) + H.equip_or_collect(accessory, SLOT_HUD_IN_BACKPACK) diff --git a/modular_ss220/ranks/icons/clothing/mob/attachments_overlay.dmi b/modular_ss220/ranks/icons/clothing/mob/attachments_overlay.dmi index f0ad7e0f871a..c8305bf79154 100644 Binary files a/modular_ss220/ranks/icons/clothing/mob/attachments_overlay.dmi and b/modular_ss220/ranks/icons/clothing/mob/attachments_overlay.dmi differ