From cf63dda6314fb23bc375f7edc3de112f723ba39b Mon Sep 17 00:00:00 2001 From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Date: Fri, 25 Feb 2022 09:42:15 +0000 Subject: [PATCH] Refactors job EXP to allow for multiple departments in restrictions (#17442) --- code/__DEFINES/preferences.dm | 1 - code/controllers/subsystem/jobs.dm | 26 +++---- code/game/jobs/job/engineering.dm | 9 +-- code/game/jobs/job/job.dm | 4 +- code/game/jobs/job/medical.dm | 21 ++---- code/game/jobs/job/science.dm | 9 +-- code/game/jobs/job/security.dm | 12 ++-- code/game/jobs/job/silicon.dm | 6 +- code/game/jobs/job/supervisor.dm | 12 ++-- code/game/jobs/job_exp.dm | 75 ++++++++++++--------- code/game/jobs/jobs.dm | 1 - code/modules/client/preference/character.dm | 6 +- code/modules/mob/new_player/new_player.dm | 22 +++--- 13 files changed, 100 insertions(+), 104 deletions(-) diff --git a/code/__DEFINES/preferences.dm b/code/__DEFINES/preferences.dm index 6e85ef5ba14..75a617fa663 100644 --- a/code/__DEFINES/preferences.dm +++ b/code/__DEFINES/preferences.dm @@ -85,7 +85,6 @@ #define EXP_TYPE_CREW "Crew" #define EXP_TYPE_SPECIAL "Special" #define EXP_TYPE_GHOST "Ghost" -#define EXP_TYPE_EXEMPT "Exempt" #define EXP_TYPE_COMMAND "Command" #define EXP_TYPE_ENGINEERING "Engineering" #define EXP_TYPE_MEDICAL "Medical" diff --git a/code/controllers/subsystem/jobs.dm b/code/controllers/subsystem/jobs.dm index e0c201e8730..329976afa52 100644 --- a/code/controllers/subsystem/jobs.dm +++ b/code/controllers/subsystem/jobs.dm @@ -72,17 +72,17 @@ SUBSYSTEM_DEF(jobs) if(player && player.mind && rank) var/datum/job/job = GetJob(rank) if(!job) - return 0 + return FALSE if(jobban_isbanned(player, rank)) - return 0 + return FALSE if(!job.player_old_enough(player.client)) - return 0 - if(job.available_in_playtime(player.client)) - return 0 + return FALSE + if(job.get_exp_restrictions(player.client)) + return FALSE if(job.barred_by_disability(player.client)) - return 0 + return FALSE if(!is_job_whitelisted(player, rank)) - return 0 + return FALSE var/position_limit = job.total_positions if(!latejoin) @@ -121,14 +121,14 @@ SUBSYSTEM_DEF(jobs) Debug("Running FOC, Job: [job], Level: [level], Flag: [flag]") var/list/candidates = list() for(var/mob/new_player/player in unassigned) - Debug(" - Player: [player] Banned: [jobban_isbanned(player, job.title)] Old Enough: [!job.player_old_enough(player.client)] AvInPlaytime: [job.available_in_playtime(player.client)] Flag && Be Special: [flag] && [player.client.prefs.be_special] Job Department: [player.client.prefs.active_character.GetJobDepartment(job, level)] Job Flag: [job.flag] Job Department Flag = [job.department_flag]") + Debug(" - Player: [player] Banned: [jobban_isbanned(player, job.title)] Old Enough: [!job.player_old_enough(player.client)] AvInPlaytime: [job.get_exp_restrictions(player.client)] Flag && Be Special: [flag] && [player.client.prefs.be_special] Job Department: [player.client.prefs.active_character.GetJobDepartment(job, level)] Job Flag: [job.flag] Job Department Flag = [job.department_flag]") if(jobban_isbanned(player, job.title)) Debug("FOC isbanned failed, Player: [player]") continue if(!job.player_old_enough(player.client)) Debug("FOC player not old enough, Player: [player]") continue - if(job.available_in_playtime(player.client)) + if(job.get_exp_restrictions(player.client)) Debug("FOC player not enough playtime, Player: [player]") continue if(job.barred_by_disability(player.client)) @@ -171,7 +171,7 @@ SUBSYSTEM_DEF(jobs) Debug("GRJ player not old enough, Player: [player]") continue - if(job.available_in_playtime(player.client)) + if(job.get_exp_restrictions(player.client)) Debug("GRJ player not enough playtime, Player: [player]") continue @@ -348,7 +348,7 @@ SUBSYSTEM_DEF(jobs) Debug("DO player not old enough, Player: [player], Job:[job.title]") continue - if(job.available_in_playtime(player.client)) + if(job.get_exp_restrictions(player.client)) Debug("DO player not enough playtime, Player: [player], Job:[job.title]") continue @@ -559,7 +559,7 @@ SUBSYSTEM_DEF(jobs) if(!job.player_old_enough(player.client)) young++ continue - if(job.available_in_playtime(player.client)) + if(job.get_exp_restrictions(player.client)) young++ continue if(job.barred_by_disability(player.client)) @@ -623,7 +623,7 @@ SUBSYSTEM_DEF(jobs) jobs_to_formats[job.title] = "grey" else if(!job.would_accept_job_transfer_from_player(M)) jobs_to_formats[job.title] = "grey" // jobs which are karma-locked and not unlocked for this player are discouraged - else if((job.title in GLOB.command_positions) && istype(M) && M.client && job.available_in_playtime(M.client)) + else if((job.title in GLOB.command_positions) && istype(M) && M.client && job.get_exp_restrictions(M.client)) jobs_to_formats[job.title] = "grey" // command jobs which are playtime-locked and not unlocked for this player are discouraged else if(job.total_positions && !job.current_positions && job.title != "Assistant") jobs_to_formats[job.title] = "teal" // jobs with nobody doing them at all are encouraged diff --git a/code/game/jobs/job/engineering.dm b/code/game/jobs/job/engineering.dm index b73a15314d8..f19ff1b43fb 100644 --- a/code/game/jobs/job/engineering.dm +++ b/code/game/jobs/job/engineering.dm @@ -18,8 +18,7 @@ ACCESS_HEADS, ACCESS_CONSTRUCTION, ACCESS_SEC_DOORS, ACCESS_CE, ACCESS_RC_ANNOUNCE, ACCESS_KEYCARD_AUTH, ACCESS_TCOMSAT, ACCESS_MINISAT, ACCESS_MINERAL_STOREROOM) minimal_player_age = 21 - exp_requirements = 1200 - exp_type = EXP_TYPE_ENGINEERING + exp_map = list(EXP_TYPE_ENGINEERING = 1200) outfit = /datum/outfit/job/chief_engineer /datum/outfit/job/chief_engineer @@ -59,8 +58,7 @@ minimal_access = list(ACCESS_EVA, ACCESS_ENGINE, ACCESS_ENGINE_EQUIP, ACCESS_TECH_STORAGE, ACCESS_MAINT_TUNNELS, ACCESS_EXTERNAL_AIRLOCKS, ACCESS_CONSTRUCTION, ACCESS_MINERAL_STOREROOM) alt_titles = list("Maintenance Technician","Engine Technician","Electrician") minimal_player_age = 7 - exp_requirements = 300 - exp_type = EXP_TYPE_CREW + exp_map = list(EXP_TYPE_CREW = 300) outfit = /datum/outfit/job/engineer /datum/outfit/job/engineer @@ -97,8 +95,7 @@ minimal_access = list(ACCESS_EVA, ACCESS_ATMOSPHERICS, ACCESS_MAINT_TUNNELS, ACCESS_EXTERNAL_AIRLOCKS, ACCESS_EMERGENCY_STORAGE, ACCESS_CONSTRUCTION, ACCESS_MINERAL_STOREROOM, ACCESS_TECH_STORAGE) alt_titles = list("Atmospheric Technician") minimal_player_age = 7 - exp_requirements = 300 - exp_type = EXP_TYPE_CREW + exp_map = list(EXP_TYPE_CREW = 300) outfit = /datum/outfit/job/atmos /datum/outfit/job/atmos diff --git a/code/game/jobs/job/job.dm b/code/game/jobs/job/job.dm index 922f5441478..54ca2a6f0f7 100644 --- a/code/game/jobs/job/job.dm +++ b/code/game/jobs/job/job.dm @@ -46,8 +46,8 @@ //If you have use_age_restriction_for_jobs config option enabled and the database set up, this option will add a requirement for players to be at least minimal_player_age days old. (meaning they first signed in at least that many days before.) var/minimal_player_age = 0 - var/exp_requirements = 0 - var/exp_type = "" + // Assoc list of EXP_TYPE_ defines and the amount of time needed in those departments + var/list/exp_map = list() var/disabilities_allowed = 1 var/transfer_allowed = TRUE // If false, ID computer will always discourage transfers to this job, even if player is eligible diff --git a/code/game/jobs/job/medical.dm b/code/game/jobs/job/medical.dm index b1b81e0b849..1a9a7a4e0e6 100644 --- a/code/game/jobs/job/medical.dm +++ b/code/game/jobs/job/medical.dm @@ -16,8 +16,7 @@ ACCESS_CHEMISTRY, ACCESS_VIROLOGY, ACCESS_CMO, ACCESS_SURGERY, ACCESS_RC_ANNOUNCE, ACCESS_KEYCARD_AUTH, ACCESS_SEC_DOORS, ACCESS_PSYCHIATRIST, ACCESS_MAINT_TUNNELS, ACCESS_PARAMEDIC, ACCESS_MINERAL_STOREROOM) minimal_player_age = 21 - exp_requirements = 1200 - exp_type = EXP_TYPE_MEDICAL + exp_map = list(EXP_TYPE_MEDICAL = 1200) outfit = /datum/outfit/job/cmo /datum/outfit/job/cmo @@ -54,8 +53,7 @@ minimal_access = list(ACCESS_MEDICAL, ACCESS_MORGUE, ACCESS_SURGERY, ACCESS_MAINT_TUNNELS) alt_titles = list("Surgeon","Nurse") minimal_player_age = 3 - exp_requirements = 180 - exp_type = EXP_TYPE_CREW + exp_map = list(EXP_TYPE_CREW = 180) outfit = /datum/outfit/job/doctor /datum/outfit/job/doctor @@ -88,8 +86,7 @@ access = list(ACCESS_MEDICAL, ACCESS_MORGUE, ACCESS_SURGERY, ACCESS_CHEMISTRY, ACCESS_VIROLOGY, ACCESS_GENETICS, ACCESS_MINERAL_STOREROOM) minimal_access = list(ACCESS_MEDICAL, ACCESS_MORGUE, ACCESS_MAINT_TUNNELS) minimal_player_age = 3 - exp_requirements = 180 - exp_type = EXP_TYPE_CREW + exp_map = list(EXP_TYPE_CREW = 180) outfit = /datum/outfit/job/coroner /datum/outfit/job/coroner @@ -151,8 +148,7 @@ minimal_access = list(ACCESS_MEDICAL, ACCESS_CHEMISTRY, ACCESS_MAINT_TUNNELS, ACCESS_MINERAL_STOREROOM) alt_titles = list("Pharmacist","Pharmacologist") minimal_player_age = 7 - exp_requirements = 300 - exp_type = EXP_TYPE_CREW + exp_map = list(EXP_TYPE_CREW = 300) outfit = /datum/outfit/job/chemist /datum/outfit/job/chemist @@ -184,8 +180,7 @@ access = list(ACCESS_MEDICAL, ACCESS_MORGUE, ACCESS_SURGERY, ACCESS_CHEMISTRY, ACCESS_VIROLOGY, ACCESS_GENETICS, ACCESS_RESEARCH, ACCESS_MINERAL_STOREROOM) minimal_access = list(ACCESS_MEDICAL, ACCESS_MORGUE, ACCESS_GENETICS, ACCESS_RESEARCH, ACCESS_MAINT_TUNNELS) minimal_player_age = 3 - exp_requirements = 180 - exp_type = EXP_TYPE_CREW + exp_map = list(EXP_TYPE_CREW = 180) outfit = /datum/outfit/job/geneticist /datum/outfit/job/geneticist @@ -219,8 +214,7 @@ minimal_access = list(ACCESS_MEDICAL, ACCESS_VIROLOGY, ACCESS_MAINT_TUNNELS, ACCESS_MINERAL_STOREROOM) alt_titles = list("Pathologist","Microbiologist") minimal_player_age = 7 - exp_requirements = 300 - exp_type = EXP_TYPE_CREW + exp_map = list(EXP_TYPE_CREW = 300) outfit = /datum/outfit/job/virologist /datum/outfit/job/virologist @@ -291,8 +285,7 @@ access = list(ACCESS_PARAMEDIC, ACCESS_MEDICAL, ACCESS_MAINT_TUNNELS, ACCESS_EXTERNAL_AIRLOCKS, ACCESS_MORGUE) minimal_access=list(ACCESS_PARAMEDIC, ACCESS_MEDICAL, ACCESS_MAINT_TUNNELS, ACCESS_EXTERNAL_AIRLOCKS, ACCESS_MORGUE) minimal_player_age = 3 - exp_requirements = 180 - exp_type = EXP_TYPE_CREW + exp_map = list(EXP_TYPE_CREW = 180) outfit = /datum/outfit/job/paramedic /datum/outfit/job/paramedic diff --git a/code/game/jobs/job/science.dm b/code/game/jobs/job/science.dm index f6fdb02477b..9e9025a1a34 100644 --- a/code/game/jobs/job/science.dm +++ b/code/game/jobs/job/science.dm @@ -18,8 +18,7 @@ ACCESS_RESEARCH, ACCESS_ROBOTICS, ACCESS_XENOBIOLOGY, ACCESS_AI_UPLOAD, ACCESS_RC_ANNOUNCE, ACCESS_KEYCARD_AUTH, ACCESS_TCOMSAT, ACCESS_GATEWAY, ACCESS_XENOARCH, ACCESS_MINISAT, ACCESS_MAINT_TUNNELS, ACCESS_MINERAL_STOREROOM, ACCESS_NETWORK) minimal_player_age = 21 - exp_requirements = 1200 - exp_type = EXP_TYPE_SCIENCE + exp_map = list(EXP_TYPE_SCIENCE = 1200) // All science-y guys get bonuses for maxing out their tech. required_objectives = list( /datum/job_objective/further_research @@ -61,8 +60,7 @@ minimal_access = list(ACCESS_TOX, ACCESS_TOX_STORAGE, ACCESS_RESEARCH, ACCESS_XENOBIOLOGY, ACCESS_XENOARCH, ACCESS_MAINT_TUNNELS, ACCESS_MINERAL_STOREROOM) alt_titles = list("Xenoarcheologist", "Anomalist", "Plasma Researcher", "Xenobiologist", "Chemical Researcher") minimal_player_age = 3 - exp_requirements = 300 - exp_type = EXP_TYPE_CREW + exp_map = list(EXP_TYPE_CREW = 300) // All science-y guys get bonuses for maxing out their tech. required_objectives = list( /datum/job_objective/further_research @@ -100,8 +98,7 @@ minimal_access = list(ACCESS_ROBOTICS, ACCESS_TECH_STORAGE, ACCESS_MORGUE, ACCESS_RESEARCH, ACCESS_MAINT_TUNNELS, ACCESS_MINERAL_STOREROOM) //As a job that handles so many corpses, it makes sense for them to have morgue access. alt_titles = list("Biomechanical Engineer","Mechatronic Engineer") minimal_player_age = 3 - exp_requirements = 180 - exp_type = EXP_TYPE_CREW + exp_map = list(EXP_TYPE_CREW = 180) required_objectives = list( /datum/job_objective/make_cyborg, diff --git a/code/game/jobs/job/security.dm b/code/game/jobs/job/security.dm index 548cdf9b149..528eb50e375 100644 --- a/code/game/jobs/job/security.dm +++ b/code/game/jobs/job/security.dm @@ -18,8 +18,7 @@ ACCESS_RESEARCH, ACCESS_ENGINE, ACCESS_MINING, ACCESS_MEDICAL, ACCESS_CONSTRUCTION, ACCESS_MAILSORTING, ACCESS_HEADS, ACCESS_HOS, ACCESS_RC_ANNOUNCE, ACCESS_KEYCARD_AUTH, ACCESS_GATEWAY, ACCESS_WEAPONS) minimal_player_age = 21 - exp_requirements = 1200 - exp_type = EXP_TYPE_SECURITY + exp_map = list(EXP_TYPE_SECURITY = 1200) disabilities_allowed = 0 outfit = /datum/outfit/job/hos @@ -63,8 +62,7 @@ access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_COURT, ACCESS_MAINT_TUNNELS, ACCESS_MORGUE, ACCESS_WEAPONS) minimal_access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_COURT, ACCESS_MAINT_TUNNELS, ACCESS_WEAPONS) minimal_player_age = 21 - exp_requirements = 600 - exp_type = EXP_TYPE_SECURITY + exp_map = list(EXP_TYPE_SECURITY = 600) outfit = /datum/outfit/job/warden /datum/outfit/job/warden @@ -109,8 +107,7 @@ minimal_access = list(ACCESS_SEC_DOORS, ACCESS_FORENSICS_LOCKERS, ACCESS_MORGUE, ACCESS_MAINT_TUNNELS, ACCESS_COURT, ACCESS_WEAPONS) alt_titles = list("Forensic Technician") minimal_player_age = 14 - exp_requirements = 600 - exp_type = EXP_TYPE_CREW + exp_map = list(EXP_TYPE_CREW = 600) outfit = /datum/outfit/job/detective /datum/outfit/job/detective @@ -165,8 +162,7 @@ access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_COURT, ACCESS_MAINT_TUNNELS, ACCESS_MORGUE, ACCESS_WEAPONS) minimal_access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_COURT, ACCESS_MAINT_TUNNELS, ACCESS_WEAPONS) minimal_player_age = 14 - exp_requirements = 600 - exp_type = EXP_TYPE_CREW + exp_map = list(EXP_TYPE_CREW = 600) outfit = /datum/outfit/job/officer /datum/outfit/job/officer diff --git a/code/game/jobs/job/silicon.dm b/code/game/jobs/job/silicon.dm index fef9c2302b3..039d2fe6901 100644 --- a/code/game/jobs/job/silicon.dm +++ b/code/game/jobs/job/silicon.dm @@ -9,8 +9,7 @@ department_head = list("Captain") req_admin_notify = 1 minimal_player_age = 30 - exp_requirements = 300 - exp_type = EXP_TYPE_SILICON + exp_map = list(EXP_TYPE_SILICON = 300) /datum/job/ai/equip(mob/living/carbon/human/H) if(!H) @@ -30,8 +29,7 @@ department_head = list("AI") selection_color = "#ddffdd" minimal_player_age = 21 - exp_requirements = 300 - exp_type = EXP_TYPE_CREW + exp_map = list(EXP_TYPE_CREW = 300) alt_titles = list("Robot") /datum/job/cyborg/equip(mob/living/carbon/human/H) diff --git a/code/game/jobs/job/supervisor.dm b/code/game/jobs/job/supervisor.dm index 0d9e7fba744..2060d22c8f4 100644 --- a/code/game/jobs/job/supervisor.dm +++ b/code/game/jobs/job/supervisor.dm @@ -13,8 +13,7 @@ GLOBAL_DATUM_INIT(captain_announcement, /datum/announcement/minor, new(do_newsca access = list() //See get_access() minimal_access = list() //See get_access() minimal_player_age = 30 - exp_requirements = 1200 - exp_type = EXP_TYPE_COMMAND + exp_map = list(EXP_TYPE_COMMAND = 1200) disabilities_allowed = 0 outfit = /datum/outfit/job/captain @@ -67,8 +66,7 @@ GLOBAL_DATUM_INIT(captain_announcement, /datum/announcement/minor, new(do_newsca req_admin_notify = 1 is_command = 1 minimal_player_age = 21 - exp_requirements = 1200 - exp_type = EXP_TYPE_COMMAND + exp_map = list(EXP_TYPE_COMMAND = 1200) access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_COURT, ACCESS_FORENSICS_LOCKERS, ACCESS_MEDICAL, ACCESS_ENGINE, ACCESS_CHANGE_IDS, ACCESS_AI_UPLOAD, ACCESS_EVA, ACCESS_HEADS, ACCESS_ALL_PERSONAL_LOCKERS, ACCESS_MAINT_TUNNELS, ACCESS_BAR, ACCESS_JANITOR, ACCESS_CONSTRUCTION, ACCESS_MORGUE, @@ -204,8 +202,7 @@ GLOBAL_DATUM_INIT(captain_announcement, /datum/announcement/minor, new(do_newsca is_legal = TRUE transfer_allowed = FALSE minimal_player_age = 30 - exp_requirements = 6000 // 100 hours baby - exp_type = EXP_TYPE_SECURITY + exp_map = list(EXP_TYPE_SECURITY = 6000) // 100 hours baby access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_COURT, ACCESS_FORENSICS_LOCKERS, ACCESS_MEDICAL, ACCESS_ENGINE, ACCESS_CHANGE_IDS, ACCESS_EVA, ACCESS_HEADS, ACCESS_ALL_PERSONAL_LOCKERS, ACCESS_MAINT_TUNNELS, ACCESS_BAR, ACCESS_JANITOR, ACCESS_CONSTRUCTION, ACCESS_MORGUE, @@ -253,8 +250,7 @@ GLOBAL_DATUM_INIT(captain_announcement, /datum/announcement/minor, new(do_newsca minimal_access = list(ACCESS_LAWYER, ACCESS_COURT, ACCESS_SEC_DOORS, ACCESS_MAINT_TUNNELS, ACCESS_RESEARCH, ACCESS_MEDICAL, ACCESS_CONSTRUCTION, ACCESS_MAILSORTING) alt_titles = list("Human Resources Agent") minimal_player_age = 30 - exp_requirements = 600 - exp_type = EXP_TYPE_CREW + exp_map = list(EXP_TYPE_CREW = 600) outfit = /datum/outfit/job/lawyer /datum/outfit/job/lawyer diff --git a/code/game/jobs/job_exp.dm b/code/game/jobs/job_exp.dm index 89148d88557..fc9401a0588 100644 --- a/code/game/jobs/job_exp.dm +++ b/code/game/jobs/job_exp.dm @@ -109,9 +109,6 @@ GLOBAL_LIST_INIT(role_playtime_requirements, list( if(GLOB.configuration.jobs.enable_exp_admin_bypass && check_rights(R_ADMIN, 0, C.mob)) return 0 var/list/play_records = params2list(C.prefs.exp) - var/isexempt = text2num(play_records[EXP_TYPE_EXEMPT]) - if(isexempt) - return 0 var/minimal_player_hrs = GLOB.role_playtime_requirements[role] if(!minimal_player_hrs) return 0 @@ -122,31 +119,52 @@ GLOBAL_LIST_INIT(role_playtime_requirements, list( return max(0, req_mins - my_exp) -/datum/job/proc/available_in_playtime(client/C) +/datum/job/proc/is_playable(client/C) if(!C) - return 0 - if(!exp_requirements || !exp_type) - return 0 + return FALSE // No client + if(!length(exp_map)) + return TRUE // No EXP map, playable if(!GLOB.configuration.jobs.enable_exp_restrictions) - return 0 - if(GLOB.configuration.jobs.enable_exp_admin_bypass && check_rights(R_ADMIN, 0, C.mob)) - return 0 + return TRUE // No restrictions, playable + if(GLOB.configuration.jobs.enable_exp_admin_bypass && check_rights(R_ADMIN, FALSE, C.mob)) + return TRUE // Admin user, playable + + // Now look through their EXP var/list/play_records = params2list(C.prefs.exp) - var/isexempt = text2num(play_records[EXP_TYPE_EXEMPT]) - if(isexempt) - return 0 - var/my_exp = text2num(play_records[get_exp_req_type()]) - var/job_requirement = text2num(get_exp_req_amount()) - if(my_exp >= job_requirement) - return 0 - else - return (job_requirement - my_exp) + var/success = TRUE -/datum/job/proc/get_exp_req_amount() - return exp_requirements + // Check their requirements + for(var/exp_type in exp_map) + if(!(exp_type in play_records)) + success = FALSE + continue + if(text2num(exp_map[exp_type]) > text2num(play_records[exp_type])) + success = FALSE -/datum/job/proc/get_exp_req_type() - return exp_type + return success + +/datum/job/proc/get_exp_restrictions(client/C) + // Its playable. There are no restrictions! + if(is_playable(C)) + return null + + var/list/play_records = params2list(C.prefs.exp) + var/list/innertext = list() + + for(var/exp_type in exp_map) + if(!(exp_type in play_records)) + innertext += "[get_exp_format(exp_map[exp_type])] as [exp_type]" + continue + // You may be saying "Jeez why so many text2num()" + // The DB loads these as strings for some reason, and I also dont trust coders to use ints in the job lists properly + if(text2num(exp_map[exp_type]) > text2num(play_records[exp_type])) + var/diff = text2num(exp_map[exp_type]) - text2num(play_records[exp_type]) + innertext += "[get_exp_format(diff)] as [exp_type]" + + if(length(innertext)) + return innertext.Join(", ") + + return null /mob/proc/get_exp_report() if(client) @@ -169,9 +187,7 @@ GLOBAL_LIST_INIT(role_playtime_requirements, list( exp_data[category] = 0 for(var/dep in exp_data) if(exp_data[dep] > 0) - if(dep == EXP_TYPE_EXEMPT) - return_text += "
  • Exempt (all jobs auto-unlocked)
  • " - else if(exp_data[EXP_TYPE_LIVING] > 0) + if(exp_data[EXP_TYPE_LIVING] > 0) return_text += "
  • [dep]: [get_exp_format(exp_data[dep])]
  • " if(GLOB.configuration.jobs.enable_exp_admin_bypass && check_rights(R_ADMIN, 0, mob)) return_text += "
  • Admin
  • " @@ -180,12 +196,11 @@ GLOBAL_LIST_INIT(role_playtime_requirements, list( var/list/jobs_locked = list() var/list/jobs_unlocked = list() for(var/datum/job/job in SSjobs.occupations) - if(job.exp_requirements && job.exp_type) - if(!job.available_in_playtime(mob.client)) + if(length(job.exp_map)) + if(job.is_playable(mob.client)) jobs_unlocked += job.title else - var/xp_req = job.get_exp_req_amount() - jobs_locked += "[job.title] ([get_exp_format(text2num(play_records[job.get_exp_req_type()]))] / [get_exp_format(xp_req)] as [job.get_exp_req_type()])" + jobs_locked += "[job.title] - [job.get_exp_restrictions(mob.client)]" if(jobs_unlocked.len) return_text += "

    Jobs Unlocked: