Adds cap on PTO

18 consecutive off-duty shifts is ... probably enough.
This commit is contained in:
Arokha Sieyes
2018-02-02 18:29:53 -05:00
parent 6e259344a3
commit cf4455e8db
2 changed files with 10 additions and 2 deletions

View File

@@ -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

View File

@@ -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)