Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Квоты для профессий 2.0 #13632

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,7 @@
#define SMOOTH_ADAPTERS_WALLS_FOR_WALLS list( \
/obj/machinery/door/airlock = "wall", \
)

#define QUOTA_NEUTRAL 0
#define QUOTA_WANTED 1
#define QUOTA_UNWANTED 2
3 changes: 3 additions & 0 deletions code/controllers/subsystem/jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ SUBSYSTEM_DEF(job)
player.mind.role_alt_title = GetPlayerAltTitle(player, rank)
unassigned -= player
job.current_positions++

if(job.quota == QUOTA_WANTED)
job.quota = QUOTA_NEUTRAL
return TRUE
Debug("AR has failed, Player: [player], Rank: [rank]")
return FALSE
Expand Down
2 changes: 2 additions & 0 deletions code/game/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@

var/flags = 0

var/quota = QUOTA_NEUTRAL

/datum/job/proc/post_equip(mob/living/carbon/human/H, visualsOnly = FALSE)
return

Expand Down
65 changes: 65 additions & 0 deletions code/game/machinery/computer/card.dm
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,53 @@
data["fast_modify_region"] = is_skill_competent(user, list(/datum/skill/command = SKILL_LEVEL_PRO))
data["fast_full_access"] = is_skill_competent(user, list(/datum/skill/command = SKILL_LEVEL_MASTER))

if(mode == 2)
var/list/jobsCategories = list(
"Command" = list(titles = command_positions, color = "#aac1ee"),
"NT Representatives" = list(titles = centcom_positions, color = "#6c7391"),
"Engineering" = list(titles = engineering_positions, color = "#ffd699"),
"Security" = list(titles = security_positions, color = "#ff9999"),
"Miscellaneous" = list(titles = list(), color = "#ffffff"),
"Synthetic" = list(titles = nonhuman_positions, color = "#ccffcc"),
"Service" = list(titles = civilian_positions, color = "#cccccc"),
"Medical" = list(titles = medical_positions, color = "#99ffe6"),
"Science" = list(titles = science_positions, color = "#e6b3e6"),
)
var/list/categorizedJobs = list()
var/list/categorizedJobsToFront = list()

for(var/datum/job/job in SSjob.occupations)
if(!job)
continue
var/list/jobList = list(list("name" = job.title, "type" = job.type, "quota" = job.quota))
var/categorized = FALSE
for(var/jobcat in jobsCategories)
if(!categorizedJobs[jobcat])
categorizedJobs[jobcat] = list("title" = jobcat, "jobs" = list(), color = jobsCategories[jobcat]["color"])
var/list/jobs = categorizedJobs[jobcat]["jobs"]
if(job.title in jobsCategories[jobcat]["titles"])
categorized = TRUE
if(jobcat == "Command")

if(job.title == "Captain") // Put captain at top of command jobs
jobs.Insert(1, jobList)
else
jobs += jobList
else // Put heads at top of non-command jobs
if(job.title in command_positions)
jobs.Insert(1, jobList)
else
jobs += jobList
if(!categorized)
categorizedJobs["Miscellaneous"]["jobs"] += jobList
Comment on lines +136 to +159
Copy link
Contributor

@NinjaPikachuska NinjaPikachuska Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

я не совсем понимаю нужду генерировать это все на ходу каждый раз при открытии менюшки
у нас разве уже нет готовых листов в нужном порядке? https://github.com/TauCetiStation/TauCetiClassic/blob/25977739f68995654a95b67950a69eb7dff88abb/code/game/jobs/jobs.dm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Неа, нет готовых листов в нужном порядке.

Copy link
Contributor

@NinjaPikachuska NinjaPikachuska Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а чем command_positions, engineering_positions, security_positions и подобные не подходят?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тем, что это лишь часть списка блин

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Там вместе со списком передаётся цвет обрамления:
image


for(var/category in categorizedJobs)
if(!length(categorizedJobs[category]["jobs"]))
continue
categorizedJobsToFront += list(categorizedJobs[category])

data["all_jobs"] = categorizedJobsToFront

if (modify && is_centcom())
var/list/all_centcom_access = list()
for(var/access in get_all_centcom_access())
Expand Down Expand Up @@ -323,6 +370,24 @@
if(datum_account)
datum_account.set_salary(0) //no salary

if ("up_quota")
var/job_type = text2path(href_list["quotajob_type"])
var/datum/job/Job = SSjob.type_occupations[job_type]
if(Job)
if(Job.quota == QUOTA_WANTED)
Job.quota = QUOTA_NEUTRAL
else
Job.quota = QUOTA_WANTED

if ("down_quota")
var/job_type = text2path(href_list["quotajob_type"])
var/datum/job/Job = SSjob.type_occupations[job_type]
if(Job)
if(Job.quota == QUOTA_UNWANTED)
Job.quota = QUOTA_NEUTRAL
else
Job.quota = QUOTA_UNWANTED

if (modify)
modify.name = text("[modify.registered_name]'s ID Card ([modify.assignment])")

Expand Down
16 changes: 14 additions & 2 deletions code/modules/mob/dead/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,23 @@
for(var/mob/M in player_list) // Only players with the job assigned and AFK for less than 10 minutes count as active
if(M.mind && M.client && M.mind.assigned_role == job.title && M.client.inactivity <= 10 * 60 * 10)
active++
var/priority = 0
var/priorityMessage = ""
var/priority_color = "#ffffff"
switch(job.quota)
if(QUOTA_WANTED)
priority = "!+"
priority_color = "#83bf47"
priorityMessage = "Требуется"
if(QUOTA_UNWANTED)
priority = "¡-"
priority_color = "#ee0000"
priorityMessage = "Не требуется"
if(job.current_positions && active < job.current_positions)
dat += "<a class='[position_class]' style='display:block;width:170px' href='byond://?src=\ref[src];SelectedJob=[job.title]'>[job.title] ([job.current_positions])<br><i>(Active: [active])</i></a>"
dat += "<a class='[position_class]' style='display:block;width:190px;color:[priority_color];font-weight:[priority ? "bold" : "normal"]' title='[priorityMessage]' href='byond://?src=\ref[src];SelectedJob=[job.title]'>[priority ? priority : ""] [job.title] ([job.current_positions])<br><i>(Active: [active])</i></a>"
number_of_extra_line_breaks++
else
dat += "<a class='[position_class]' style='display:block;width:170px' href='byond://?src=\ref[src];SelectedJob=[job.title]'>[job.title] ([job.current_positions])</a>"
dat += "<a class='[position_class]' style='display:block;width:190px;color:[priority_color];font-weight:[priority ? "bold" : "normal"]' title='[priorityMessage]' href='byond://?src=\ref[src];SelectedJob=[job.title]'>[priority ? priority : ""] [job.title] ([job.current_positions])</a>"
categorizedJobs[jobcat]["jobs"] -= job

dat += "</fieldset><br>"
Expand Down
21 changes: 18 additions & 3 deletions nano/templates/identification_computer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,32 @@
Thank you for your patience!
</p>
{{else}}
{{:helper.link('Access Modification', 'home', {'choice' : 'mode', 'mode_target' : 0}, !data.mode ? 'disabled' : null)}}
{{:helper.link('Crew Manifest', 'folder-open', {'choice' : 'mode', 'mode_target' : 1}, data.mode ? 'disabled' : null)}}
{{:helper.link('Access Modification', 'home', {'choice' : 'mode', 'mode_target' : 0}, data.mode == 0 ? 'disabled' : null)}}
{{:helper.link('Crew Manifest', 'folder-open', {'choice' : 'mode', 'mode_target' : 1}, data.mode == 1 ? 'disabled' : null)}}
{{:helper.link('Quotas', 'star', {'choice' : 'mode', 'mode_target' : 2}, data.mode == 2 ? 'disabled' : null)}}
{{:helper.link('Print', 'print', {'choice' : 'print'}, (data.mode || data.has_modify) ? null : 'disabled')}}

{{if data.mode}}
{{if data.mode == 1}}
NinjaPikachuska marked this conversation as resolved.
Show resolved Hide resolved
<div class='item'>
<h2>Crew Manifest</h2>
</div>
<div class='item'>
{{:data.manifest}}
</div>
{{else data.mode == 2}}
<div class='item'>
{{for data.all_jobs:category:categ_num}}
<table style='margin-left:30%'><tr><td valign='top'><fieldset style='border: 2px solid {{:category.color}}; display: inline;'><legend align='center' style='color: {{:category.color}}'><b>{{:category.title}}</b></legend>
{{for data.all_jobs[categ_num].jobs:job}}
<div class='item' style='display:block;width:250px;background-color:#40628a;color:#ffffff'>
{{:helper.link('', 'arrowthick-1-n', {'choice' : "up_quota", 'quotajob_type' : job.type}, null, job.quota == 1 ? 'selected' : null, null)}}
{{:helper.link('', 'arrowthick-1-s', {'choice' : "down_quota", 'quotajob_type' : job.type}, null, job.quota == 2 ? 'selected' : null, null)}}
{{:job.name}}
</div>
{{/for}}
</fieldset><br></td></tr></table>
{{/for}}
</div>
{{else}}
<div class='item'>
<h2>Access Modification</h2>
Expand Down
Loading