Skip to content

Commit

Permalink
Квоты для профессий 2.0 (TauCetiStation#13632)
Browse files Browse the repository at this point in the history
* Готовченко

* Всплывающая подсказка

Сделал всплывающую подсказку что появляется при наведении на профессии что "требуются" или "не требуются".

* Выделил циферки квоты в Дефайн

Убрал цифры в Дефайн.

* Переделка
  • Loading branch information
DarthSidiousPalpatine authored Dec 5, 2024
1 parent 0332066 commit 8b34306
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 5 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -416,3 +416,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
44 changes: 44 additions & 0 deletions code/game/machinery/computer/card.dm
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,32 @@
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(
list(title = "Command", jobs = command_positions, color = "#aac1ee"),
list(title = "NT Representatives", jobs = centcom_positions, color = "#6c7391"),
list(title = "Engineering", jobs = engineering_positions, color = "#ffd699"),
list(title = "Security", jobs = security_positions, color = "#ff9999"),
list(title = "Synthetic", jobs = nonhuman_positions, color = "#ccffcc"),
list(title = "Service", jobs = civilian_positions, color = "#cccccc"),
list(title = "Medical", jobs = medical_positions, color = "#99ffe6"),
list(title = "Science", jobs = science_positions, color = "#e6b3e6"),
)

for(var/jobCategory in jobsCategories)
var/list/jobsList = jobCategory["jobs"]
var/list/newJobsList = list()

for(var/jobTitle in jobsList)
var/datum/job/job = SSjob.name_occupations[jobTitle]
if(!job)
continue
newJobsList += list(list("name" = jobTitle, "quota" = job.quota))

jobCategory["jobs"] = newJobsList

data["all_jobs"] = jobsCategories

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

if ("up_quota")
var/job_name = sanitize(href_list["quotajob_name"], 50)
var/datum/job/Job = SSjob.name_occupations[job_name]
if(Job)
if(Job.quota == QUOTA_WANTED)
Job.quota = QUOTA_NEUTRAL
else
Job.quota = QUOTA_WANTED

if ("down_quota")
var/job_name = sanitize(href_list["quotajob_name"], 50)
var/datum/job/Job = SSjob.name_occupations[job_name]
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}}
<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_name' : job.name}, null, job.quota == 1 ? 'selected' : null, null)}}
{{:helper.link('', 'arrowthick-1-s', {'choice' : "down_quota", 'quotajob_name' : job.name}, 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

0 comments on commit 8b34306

Please sign in to comment.