Skip to content

Commit

Permalink
Аттачменты, аксессуары, лодауты
Browse files Browse the repository at this point in the history
  • Loading branch information
PhantornRU committed Jan 19, 2024
1 parent 4f1c89c commit e90e962
Show file tree
Hide file tree
Showing 11 changed files with 157 additions and 55 deletions.
4 changes: 2 additions & 2 deletions code/modules/clothing/clothing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -731,15 +731,15 @@
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)
..()
if(!ishuman(user))
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
Expand Down
1 change: 1 addition & 0 deletions modular_ss220/modular_ss220.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 0 additions & 14 deletions modular_ss220/ranks/_rank.dme

This file was deleted.

File renamed without changes.
7 changes: 7 additions & 0 deletions modular_ss220/ranks/_ranks.dme
Original file line number Diff line number Diff line change
@@ -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"
65 changes: 40 additions & 25 deletions modular_ss220/ranks/code/accessory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down
58 changes: 53 additions & 5 deletions modular_ss220/ranks/code/accessory_security.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand All @@ -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,
Expand Down
37 changes: 37 additions & 0 deletions modular_ss220/ranks/code/accessory_supervisor.dm
Original file line number Diff line number Diff line change
@@ -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,
)
22 changes: 13 additions & 9 deletions modular_ss220/ranks/code/job/security_rank.dm
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 4 additions & 0 deletions modular_ss220/ranks/code/job/supervisor_rank.dm
Original file line number Diff line number Diff line change
@@ -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)
Binary file modified modular_ss220/ranks/icons/clothing/mob/attachments_overlay.dmi
Binary file not shown.

0 comments on commit e90e962

Please sign in to comment.