mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Adds cap on PTO
18 consecutive off-duty shifts is ... probably enough.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
var/time_off = FALSE
|
||||
var/limit_interns = -1 //Unlimited by default
|
||||
var/limit_visitors = -1 //Unlimited by default
|
||||
var/pto_cap = 100 //Hours
|
||||
|
||||
/hook/startup/proc/read_vs_config()
|
||||
var/list/Lines = file2list("config/config.txt")
|
||||
@@ -47,6 +48,8 @@
|
||||
config.limit_interns = text2num(value)
|
||||
if ("limit_visitors")
|
||||
config.limit_visitors = text2num(value)
|
||||
if ("pto_cap")
|
||||
config.pto_cap = text2num(value)
|
||||
if ("time_off")
|
||||
config.time_off = TRUE
|
||||
|
||||
|
||||
@@ -45,10 +45,15 @@ SUBSYSTEM_DEF(persist)
|
||||
var/client/C = M.client
|
||||
var/wait_in_hours = (wait / (1 HOUR)) * J.timeoff_factor
|
||||
LAZYINITLIST(C.department_hours)
|
||||
var/dept_hours = C.department_hours
|
||||
if(isnum(C.department_hours[J.department]))
|
||||
C.department_hours[J.department] += wait_in_hours
|
||||
dept_hours[J.department] += wait_in_hours
|
||||
else
|
||||
C.department_hours[J.department] = wait_in_hours
|
||||
dept_hours[J.department] = wait_in_hours
|
||||
|
||||
//Cap it
|
||||
dept_hours[J.department] = min(config.pto_cap, dept_hours[J.department])
|
||||
|
||||
|
||||
// Okay we figured it out, lets update database!
|
||||
var/sql_ckey = sql_sanitize_text(C.ckey)
|
||||
|
||||
Reference in New Issue
Block a user