Merge branch 'master' into are-those-horns-are-are-you-just-retarded
This commit is contained in:
@@ -175,18 +175,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
var/list/all_quirks = list()
|
||||
var/list/character_quirks = list()
|
||||
|
||||
//Jobs, uses bitflags
|
||||
var/job_civilian_high = 0
|
||||
var/job_civilian_med = 0
|
||||
var/job_civilian_low = 0
|
||||
|
||||
var/job_medsci_high = 0
|
||||
var/job_medsci_med = 0
|
||||
var/job_medsci_low = 0
|
||||
|
||||
var/job_engsec_high = 0
|
||||
var/job_engsec_med = 0
|
||||
var/job_engsec_low = 0
|
||||
//Job preferences 2.0 - indexed by job title , no key or value implies never
|
||||
var/list/job_preferences = list()
|
||||
|
||||
// Want randomjob if preferences already filled - Donkie
|
||||
var/joblessrole = BERANDOMJOB //defaults to 1 for fewer assistants
|
||||
@@ -1022,9 +1012,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
//The job before the current job. I only use this to get the previous jobs color when I'm filling in blank rows.
|
||||
var/datum/job/lastJob
|
||||
|
||||
var/datum/job/overflow = SSjob.GetJob(SSjob.overflow_role)
|
||||
|
||||
for(var/datum/job/job in SSjob.occupations)
|
||||
for(var/datum/job/job in sortList(SSjob.occupations, /proc/cmp_job_display_asc))
|
||||
|
||||
index += 1
|
||||
if((index >= limit) || (job.title in splitJobs))
|
||||
@@ -1041,7 +1029,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
var/rank = job.title
|
||||
lastJob = job
|
||||
if(jobban_isbanned(user, rank))
|
||||
HTML += "<font color=red>[rank]</font></td><td><a href='?_src_=prefs;jobbancheck=[rank]'> BANNED</a></td></tr>"
|
||||
HTML += "<font color=red>[rank]</font></td><td><a href='?_src_=prefs;bancheck=[rank]'> BANNED</a></td></tr>"
|
||||
continue
|
||||
var/required_playtime_remaining = job.required_playtime_remaining(user.client)
|
||||
if(required_playtime_remaining)
|
||||
@@ -1051,7 +1039,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
var/available_in_days = job.available_in_days(user.client)
|
||||
HTML += "<font color=red>[rank]</font></td><td><font color=red> \[IN [(available_in_days)] DAYS\]</font></td></tr>"
|
||||
continue
|
||||
if((job_civilian_low & overflow.flag) && (rank != SSjob.overflow_role) && !jobban_isbanned(user, SSjob.overflow_role))
|
||||
if((job_preferences[SSjob.overflow_role] == JP_LOW) && (rank != SSjob.overflow_role) && !jobban_isbanned(user, SSjob.overflow_role))
|
||||
HTML += "<font color=orange>[rank]</font></td><td></td></tr>"
|
||||
continue
|
||||
if((rank in GLOB.command_positions) || (rank == "AI"))//Bold head jobs
|
||||
@@ -1066,32 +1054,32 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
var/prefUpperLevel = -1 // level to assign on left click
|
||||
var/prefLowerLevel = -1 // level to assign on right click
|
||||
|
||||
if(GetJobDepartment(job, 1) & job.flag)
|
||||
prefLevelLabel = "High"
|
||||
prefLevelColor = "slateblue"
|
||||
prefUpperLevel = 4
|
||||
prefLowerLevel = 2
|
||||
else if(GetJobDepartment(job, 2) & job.flag)
|
||||
prefLevelLabel = "Medium"
|
||||
prefLevelColor = "green"
|
||||
prefUpperLevel = 1
|
||||
prefLowerLevel = 3
|
||||
else if(GetJobDepartment(job, 3) & job.flag)
|
||||
prefLevelLabel = "Low"
|
||||
prefLevelColor = "orange"
|
||||
prefUpperLevel = 2
|
||||
prefLowerLevel = 4
|
||||
else
|
||||
prefLevelLabel = "NEVER"
|
||||
prefLevelColor = "red"
|
||||
prefUpperLevel = 3
|
||||
prefLowerLevel = 1
|
||||
|
||||
switch(job_preferences[job.title])
|
||||
if(JP_HIGH)
|
||||
prefLevelLabel = "High"
|
||||
prefLevelColor = "slateblue"
|
||||
prefUpperLevel = 4
|
||||
prefLowerLevel = 2
|
||||
if(JP_MEDIUM)
|
||||
prefLevelLabel = "Medium"
|
||||
prefLevelColor = "green"
|
||||
prefUpperLevel = 1
|
||||
prefLowerLevel = 3
|
||||
if(JP_LOW)
|
||||
prefLevelLabel = "Low"
|
||||
prefLevelColor = "orange"
|
||||
prefUpperLevel = 2
|
||||
prefLowerLevel = 4
|
||||
else
|
||||
prefLevelLabel = "NEVER"
|
||||
prefLevelColor = "red"
|
||||
prefUpperLevel = 3
|
||||
prefLowerLevel = 1
|
||||
|
||||
HTML += "<a class='white' href='?_src_=prefs;preference=job;task=setJobLevel;level=[prefUpperLevel];text=[rank]' oncontextmenu='javascript:return setJobPrefRedirect([prefLowerLevel], \"[rank]\");'>"
|
||||
|
||||
if(rank == SSjob.overflow_role)//Overflow is special
|
||||
if(job_civilian_low & overflow.flag)
|
||||
if(job_preferences[SSjob.overflow_role] == JP_LOW)
|
||||
HTML += "<font color=green>Yes</font>"
|
||||
else
|
||||
HTML += "<font color=red>No</font>"
|
||||
@@ -1122,61 +1110,17 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
|
||||
/datum/preferences/proc/SetJobPreferenceLevel(datum/job/job, level)
|
||||
if (!job)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if (level == 1) // to high
|
||||
// remove any other job(s) set to high
|
||||
job_civilian_med |= job_civilian_high
|
||||
job_engsec_med |= job_engsec_high
|
||||
job_medsci_med |= job_medsci_high
|
||||
job_civilian_high = 0
|
||||
job_engsec_high = 0
|
||||
job_medsci_high = 0
|
||||
if (level == JP_HIGH) // to high
|
||||
//Set all other high to medium
|
||||
for(var/j in job_preferences)
|
||||
if(job_preferences[j] == JP_HIGH)
|
||||
job_preferences[j] = JP_MEDIUM
|
||||
//technically break here
|
||||
|
||||
if (job.department_flag == CIVILIAN)
|
||||
job_civilian_low &= ~job.flag
|
||||
job_civilian_med &= ~job.flag
|
||||
job_civilian_high &= ~job.flag
|
||||
|
||||
switch(level)
|
||||
if (1)
|
||||
job_civilian_high |= job.flag
|
||||
if (2)
|
||||
job_civilian_med |= job.flag
|
||||
if (3)
|
||||
job_civilian_low |= job.flag
|
||||
|
||||
return 1
|
||||
else if (job.department_flag == ENGSEC)
|
||||
job_engsec_low &= ~job.flag
|
||||
job_engsec_med &= ~job.flag
|
||||
job_engsec_high &= ~job.flag
|
||||
|
||||
switch(level)
|
||||
if (1)
|
||||
job_engsec_high |= job.flag
|
||||
if (2)
|
||||
job_engsec_med |= job.flag
|
||||
if (3)
|
||||
job_engsec_low |= job.flag
|
||||
|
||||
return 1
|
||||
else if (job.department_flag == MEDSCI)
|
||||
job_medsci_low &= ~job.flag
|
||||
job_medsci_med &= ~job.flag
|
||||
job_medsci_high &= ~job.flag
|
||||
|
||||
switch(level)
|
||||
if (1)
|
||||
job_medsci_high |= job.flag
|
||||
if (2)
|
||||
job_medsci_med |= job.flag
|
||||
if (3)
|
||||
job_medsci_low |= job.flag
|
||||
|
||||
return 1
|
||||
|
||||
return 0
|
||||
job_preferences[job.title] = level
|
||||
return TRUE
|
||||
|
||||
/datum/preferences/proc/UpdateJobPreference(mob/user, role, desiredLvl)
|
||||
if(!SSjob || SSjob.occupations.len <= 0)
|
||||
@@ -1193,64 +1137,29 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
ShowChoices(user)
|
||||
return
|
||||
|
||||
if(role == SSjob.overflow_role)
|
||||
if(job_civilian_low & job.flag)
|
||||
job_civilian_low &= ~job.flag
|
||||
else
|
||||
job_civilian_low |= job.flag
|
||||
SetChoices(user)
|
||||
return 1
|
||||
var/jpval = null
|
||||
switch(desiredLvl)
|
||||
if(3)
|
||||
jpval = JP_LOW
|
||||
if(2)
|
||||
jpval = JP_MEDIUM
|
||||
if(1)
|
||||
jpval = JP_HIGH
|
||||
|
||||
SetJobPreferenceLevel(job, desiredLvl)
|
||||
if(role == SSjob.overflow_role)
|
||||
if(job_preferences[job.title] == JP_LOW)
|
||||
jpval = null
|
||||
else
|
||||
jpval = JP_LOW
|
||||
|
||||
SetJobPreferenceLevel(job, jpval)
|
||||
SetChoices(user)
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
/datum/preferences/proc/ResetJobs()
|
||||
|
||||
job_civilian_high = 0
|
||||
job_civilian_med = 0
|
||||
job_civilian_low = 0
|
||||
|
||||
job_medsci_high = 0
|
||||
job_medsci_med = 0
|
||||
job_medsci_low = 0
|
||||
|
||||
job_engsec_high = 0
|
||||
job_engsec_med = 0
|
||||
job_engsec_low = 0
|
||||
|
||||
|
||||
/datum/preferences/proc/GetJobDepartment(datum/job/job, level)
|
||||
if(!job || !level)
|
||||
return 0
|
||||
switch(job.department_flag)
|
||||
if(CIVILIAN)
|
||||
switch(level)
|
||||
if(1)
|
||||
return job_civilian_high
|
||||
if(2)
|
||||
return job_civilian_med
|
||||
if(3)
|
||||
return job_civilian_low
|
||||
if(MEDSCI)
|
||||
switch(level)
|
||||
if(1)
|
||||
return job_medsci_high
|
||||
if(2)
|
||||
return job_medsci_med
|
||||
if(3)
|
||||
return job_medsci_low
|
||||
if(ENGSEC)
|
||||
switch(level)
|
||||
if(1)
|
||||
return job_engsec_high
|
||||
if(2)
|
||||
return job_engsec_med
|
||||
if(3)
|
||||
return job_engsec_low
|
||||
return 0
|
||||
job_preferences = list()
|
||||
|
||||
/datum/preferences/proc/SetQuirks(mob/user)
|
||||
if(!SSquirks)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// You do not need to raise this if you are adding new values that have sane defaults.
|
||||
// Only raise this value when changing the meaning/format/name/layout of an existing value
|
||||
// where you would want the updater procs below to run
|
||||
#define SAVEFILE_VERSION_MAX 21
|
||||
#define SAVEFILE_VERSION_MAX 22
|
||||
|
||||
/*
|
||||
SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn
|
||||
@@ -49,7 +49,60 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
pda_style = "mono"
|
||||
if(current_version < 20)
|
||||
pda_color = "#808000"
|
||||
if((current_version < 21) && features["meat_type"] && (features["meat_type"] == null))
|
||||
if(current_version < 21)
|
||||
job_preferences = list() //It loaded null from nonexistant savefile field.
|
||||
var/job_civilian_high = 0
|
||||
var/job_civilian_med = 0
|
||||
var/job_civilian_low = 0
|
||||
|
||||
var/job_medsci_high = 0
|
||||
var/job_medsci_med = 0
|
||||
var/job_medsci_low = 0
|
||||
|
||||
var/job_engsec_high = 0
|
||||
var/job_engsec_med = 0
|
||||
var/job_engsec_low = 0
|
||||
|
||||
S["job_civilian_high"] >> job_civilian_high
|
||||
S["job_civilian_med"] >> job_civilian_med
|
||||
S["job_civilian_low"] >> job_civilian_low
|
||||
S["job_medsci_high"] >> job_medsci_high
|
||||
S["job_medsci_med"] >> job_medsci_med
|
||||
S["job_medsci_low"] >> job_medsci_low
|
||||
S["job_engsec_high"] >> job_engsec_high
|
||||
S["job_engsec_med"] >> job_engsec_med
|
||||
S["job_engsec_low"] >> job_engsec_low
|
||||
|
||||
//Can't use SSjob here since this happens right away on login
|
||||
for(var/job in subtypesof(/datum/job))
|
||||
var/datum/job/J = job
|
||||
var/new_value
|
||||
var/fval = initial(J.flag)
|
||||
switch(initial(J.department_flag))
|
||||
if(CIVILIAN)
|
||||
if(job_civilian_high & fval)
|
||||
new_value = JP_HIGH
|
||||
else if(job_civilian_med & fval)
|
||||
new_value = JP_MEDIUM
|
||||
else if(job_civilian_low & fval)
|
||||
new_value = JP_LOW
|
||||
if(MEDSCI)
|
||||
if(job_medsci_high & fval)
|
||||
new_value = JP_HIGH
|
||||
else if(job_medsci_med & fval)
|
||||
new_value = JP_MEDIUM
|
||||
else if(job_medsci_low & fval)
|
||||
new_value = JP_LOW
|
||||
if(ENGSEC)
|
||||
if(job_engsec_high & fval)
|
||||
new_value = JP_HIGH
|
||||
else if(job_engsec_med & fval)
|
||||
new_value = JP_MEDIUM
|
||||
else if(job_engsec_low & fval)
|
||||
new_value = JP_LOW
|
||||
if(new_value)
|
||||
job_preferences[initial(J.title)] = new_value
|
||||
if((current_version < 22) && features["meat_type"] && (features["meat_type"] == null))
|
||||
features["meat_type"] = "Mammalian"
|
||||
|
||||
/datum/preferences/proc/load_path(ckey,filename="preferences.sav")
|
||||
@@ -307,15 +360,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
|
||||
//Jobs
|
||||
S["joblessrole"] >> joblessrole
|
||||
S["job_civilian_high"] >> job_civilian_high
|
||||
S["job_civilian_med"] >> job_civilian_med
|
||||
S["job_civilian_low"] >> job_civilian_low
|
||||
S["job_medsci_high"] >> job_medsci_high
|
||||
S["job_medsci_med"] >> job_medsci_med
|
||||
S["job_medsci_low"] >> job_medsci_low
|
||||
S["job_engsec_high"] >> job_engsec_high
|
||||
S["job_engsec_med"] >> job_engsec_med
|
||||
S["job_engsec_low"] >> job_engsec_low
|
||||
//Load prefs
|
||||
S["job_preferences"] >> job_preferences
|
||||
|
||||
//Quirks
|
||||
S["all_quirks"] >> all_quirks
|
||||
@@ -436,18 +482,14 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
features["insect_wings"] = sanitize_inlist(features["insect_wings"], GLOB.insect_wings_list)
|
||||
features["insect_fluff"] = sanitize_inlist(features["insect_fluff"], GLOB.insect_fluffs_list)
|
||||
|
||||
joblessrole = sanitize_integer(joblessrole, 1, 3, initial(joblessrole))
|
||||
job_civilian_high = sanitize_integer(job_civilian_high, 0, 65535, initial(job_civilian_high))
|
||||
job_civilian_med = sanitize_integer(job_civilian_med, 0, 65535, initial(job_civilian_med))
|
||||
job_civilian_low = sanitize_integer(job_civilian_low, 0, 65535, initial(job_civilian_low))
|
||||
job_medsci_high = sanitize_integer(job_medsci_high, 0, 65535, initial(job_medsci_high))
|
||||
job_medsci_med = sanitize_integer(job_medsci_med, 0, 65535, initial(job_medsci_med))
|
||||
job_medsci_low = sanitize_integer(job_medsci_low, 0, 65535, initial(job_medsci_low))
|
||||
job_engsec_high = sanitize_integer(job_engsec_high, 0, 65535, initial(job_engsec_high))
|
||||
job_engsec_med = sanitize_integer(job_engsec_med, 0, 65535, initial(job_engsec_med))
|
||||
job_engsec_low = sanitize_integer(job_engsec_low, 0, 65535, initial(job_engsec_low))
|
||||
joblessrole = sanitize_integer(joblessrole, 1, 3, initial(joblessrole))
|
||||
//Validate job prefs
|
||||
for(var/j in job_preferences)
|
||||
if(job_preferences[j] != JP_LOW && job_preferences[j] != JP_MEDIUM && job_preferences[j] != JP_HIGH)
|
||||
job_preferences -= j
|
||||
|
||||
all_quirks = SANITIZE_LIST(all_quirks)
|
||||
|
||||
all_quirks = SANITIZE_LIST(all_quirks)
|
||||
positive_quirks = SANITIZE_LIST(positive_quirks)
|
||||
negative_quirks = SANITIZE_LIST(negative_quirks)
|
||||
neutral_quirks = SANITIZE_LIST(neutral_quirks)
|
||||
@@ -519,16 +561,9 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
WRITE_FILE(S["prefered_security_department"] , prefered_security_department)
|
||||
|
||||
//Jobs
|
||||
WRITE_FILE(S["joblessrole"] , joblessrole)
|
||||
WRITE_FILE(S["job_civilian_high"] , job_civilian_high)
|
||||
WRITE_FILE(S["job_civilian_med"] , job_civilian_med)
|
||||
WRITE_FILE(S["job_civilian_low"] , job_civilian_low)
|
||||
WRITE_FILE(S["job_medsci_high"] , job_medsci_high)
|
||||
WRITE_FILE(S["job_medsci_med"] , job_medsci_med)
|
||||
WRITE_FILE(S["job_medsci_low"] , job_medsci_low)
|
||||
WRITE_FILE(S["job_engsec_high"] , job_engsec_high)
|
||||
WRITE_FILE(S["job_engsec_med"] , job_engsec_med)
|
||||
WRITE_FILE(S["job_engsec_low"] , job_engsec_low)
|
||||
WRITE_FILE(S["joblessrole"] , joblessrole)
|
||||
//Write prefs
|
||||
WRITE_FILE(S["job_preferences"] , job_preferences)
|
||||
|
||||
//Quirks
|
||||
WRITE_FILE(S["all_quirks"] , all_quirks)
|
||||
|
||||
Reference in New Issue
Block a user