mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-27 14:08:44 +01:00
Timeclock fixes
Fixes https://github.com/VOREStation/VOREStation/issues/6863 Also makes timeclock display all departments a job is in and which it earns/requires PTO for
This commit is contained in:
@@ -84,15 +84,16 @@
|
||||
if (job)
|
||||
data["job_datum"] = list(
|
||||
"title" = job.title,
|
||||
"department" = job.departments[1],
|
||||
"departments" = english_list(job.departments),
|
||||
"selection_color" = job.selection_color,
|
||||
"economic_modifier" = job.economic_modifier,
|
||||
"timeoff_factor" = job.timeoff_factor
|
||||
"timeoff_factor" = job.timeoff_factor,
|
||||
"pto_department" = job.pto_earning
|
||||
)
|
||||
if(config.time_off && config.pto_job_change)
|
||||
data["allow_change_job"] = TRUE
|
||||
if(job && job.timeoff_factor < 0) // Currently are Off Duty, so gotta lookup what on-duty jobs are open
|
||||
data["job_choices"] = getOpenOnDutyJobs(user, job.departments[1])
|
||||
data["job_choices"] = getOpenOnDutyJobs(user, job.pto_earning)
|
||||
|
||||
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
@@ -141,23 +142,17 @@
|
||||
var/list/available_jobs = list()
|
||||
for(var/datum/job/job in job_master.occupations)
|
||||
if(job && job.is_position_available() && !job.whitelist_only && !jobban_isbanned(user,job.title) && job.player_old_enough(user.client))
|
||||
if(job.departments[1] == department && !job.disallow_jobhop && job.timeoff_factor > 0)
|
||||
if(job.pto_earning == department && !job.disallow_jobhop && job.timeoff_factor > 0)
|
||||
available_jobs += job.title
|
||||
if(job.alt_titles)
|
||||
for(var/alt_job in job.alt_titles)
|
||||
available_jobs += alt_job
|
||||
if(alt_job != job.title)
|
||||
available_jobs += alt_job
|
||||
return available_jobs
|
||||
|
||||
/obj/machinery/computer/timeclock/proc/makeOnDuty(var/newjob)
|
||||
var/datum/job/foundjob = null
|
||||
for(var/datum/job/job in job_master.occupations)
|
||||
if(newjob == job.title)
|
||||
foundjob = job
|
||||
break
|
||||
if(newjob in job.alt_titles)
|
||||
foundjob = job
|
||||
break
|
||||
if(!newjob in getOpenOnDutyJobs(usr, job_master.GetJob(card.rank).department))
|
||||
var/datum/job/foundjob = job_master.GetJob(card.rank)
|
||||
if(!newjob in getOpenOnDutyJobs(usr, foundjob.pto_earning))
|
||||
return
|
||||
if(foundjob && card)
|
||||
card.access = foundjob.get_access()
|
||||
@@ -175,19 +170,13 @@
|
||||
return
|
||||
|
||||
/obj/machinery/computer/timeclock/proc/makeOffDuty()
|
||||
var/datum/job/foundjob = null
|
||||
for(var/datum/job/job in job_master.occupations)
|
||||
if(card.rank == job.title)
|
||||
foundjob = job
|
||||
break
|
||||
var/datum/job/foundjob = job_master.GetJob(card.rank)
|
||||
if(!foundjob)
|
||||
return
|
||||
var/real_dept = foundjob.departments[1]
|
||||
if(real_dept && real_dept == "Command")
|
||||
real_dept = "Civilian"
|
||||
var/new_dept = foundjob.pto_earning || PTO_CIVILIAN
|
||||
var/datum/job/ptojob = null
|
||||
for(var/datum/job/job in job_master.occupations)
|
||||
if(job.departments[1] == real_dept && job.timeoff_factor < 0)
|
||||
if(job.pto_earning == new_dept && job.timeoff_factor < 0)
|
||||
ptojob = job
|
||||
break
|
||||
if(ptojob && card)
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class='item'>
|
||||
<div class='itemLabel'>Department:</div>
|
||||
<div class='itemContent'>{{:data.job_datum.department}}</div>
|
||||
<div class='itemLabel'>Departments:</div>
|
||||
<div class='itemContent'>{{:data.job_datum.departments}}</div>
|
||||
</div>
|
||||
<div class='item'>
|
||||
<div class='itemLabel'>Pay Scale:</div>
|
||||
@@ -42,11 +42,11 @@
|
||||
<div class='itemLabel'>PTO Eligibility:</div>
|
||||
{{if data.job_datum.timeoff_factor > 0 }}
|
||||
<div class='itemContent' title='Hours working this position will earn time off for its department.' style='cursor: help;'>
|
||||
Earns PTO
|
||||
Earns PTO - {{:data.job_datum.pto_department}}
|
||||
</div>
|
||||
{{else data.job_datum.timeoff_factor < 0}}
|
||||
<div class='itemContent' title='Hours spent in this position are deducted from your time off for its department.' style='cursor: help;'>
|
||||
Requires PTO
|
||||
Requires PTO - {{:data.job_datum.pto_department}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class='itemContent' title='This job neither requires nor earnts time off hours.' style='cursor: help;'>
|
||||
|
||||
Reference in New Issue
Block a user