diff --git a/code/game/jobs/job/job_vr.dm b/code/game/jobs/job/job_vr.dm new file mode 100644 index 00000000000..ee6a2049c36 --- /dev/null +++ b/code/game/jobs/job/job_vr.dm @@ -0,0 +1,3 @@ +/datum/job + var/whitelist_only = 0 + diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index adf5e2ab451..932dcf11d17 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -57,6 +57,8 @@ var/global/datum/controller/occupations/job_master return 0 if(!job.player_old_enough(player.client)) return 0 + if(!is_job_whitelisted(player, rank)) //VOREStation Code + return 0 var/position_limit = job.total_positions if(!latejoin) @@ -91,6 +93,11 @@ var/global/datum/controller/occupations/job_master if(job.minimum_character_age && (player.client.prefs.age < job.minimum_character_age)) Debug("FOC character not old enough, Player: [player]") continue + //VOREStation Code Start + if(!is_job_whitelisted(player, job.title)) + Debug("FOC is_job_whitelisted failed, Player: [player]") + continue + //VOREStation Code End if(flag && (!player.client.prefs.be_special & flag)) Debug("FOC flag failed, Player: [player], Flag: [flag], ") continue @@ -122,6 +129,12 @@ var/global/datum/controller/occupations/job_master Debug("GRJ player not old enough, Player: [player]") continue + //VOREStation Code Start + if(!is_job_whitelisted(player, job.title)) + Debug("GRJ player not whitelisted for this job, Player: [player], Job: [job.title]") + continue + //VOREStation Code End + if((job.current_positions < job.spawn_positions) || job.spawn_positions == -1) Debug("GRJ Random job given, Player: [player], Job: [job]") AssignRole(player, job.title) diff --git a/code/game/jobs/whitelist_vr.dm b/code/game/jobs/whitelist_vr.dm new file mode 100644 index 00000000000..f9180a9d256 --- /dev/null +++ b/code/game/jobs/whitelist_vr.dm @@ -0,0 +1,32 @@ +var/list/job_whitelist = list() + +/hook/startup/proc/loadJobWhitelist() + if(config.usewhitelist) + load_jobwhitelist() + return 1 + +/proc/load_jobwhitelist() + var/text = file2text("config/jobwhitelist.txt") + if (!text) + log_misc("Failed to load config/jobwhitelist.txt") + else + job_whitelist = splittext(text, "\n") + +/proc/is_job_whitelisted(mob/M, var/rank) + var/datum/job/job = job_master.GetJob(rank) + if(!job.whitelist_only) + return 1 + if(rank == "assistant" || rank == "Assistant") + return 1 + if(check_rights(R_ADMIN, 0)) + return 1 + if(!job_whitelist) + return 0 + if(M && rank) + for (var/s in job_whitelist) + if(findtext(s,"[M.ckey] - [rank]")) + return 1 + if(findtext(s,"[M.ckey] - All")) + return 1 + return 0 + diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index ae89a67366a..53927668f80 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -287,6 +287,7 @@ if(!job.is_position_available()) return 0 if(jobban_isbanned(src,rank)) return 0 if(!job.player_old_enough(src.client)) return 0 + if(!is_job_whitelisted(src,rank)) return 0 //VOREStation Code return 1 diff --git a/vorestation.dme b/vorestation.dme index 8e1dcf3b708..717aa4dfb9a 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -366,12 +366,14 @@ #include "code\game\jobs\job_controller.dm" #include "code\game\jobs\jobs.dm" #include "code\game\jobs\whitelist.dm" +#include "code\game\jobs\whitelist_vr.dm" #include "code\game\jobs\job\assistant.dm" #include "code\game\jobs\job\captain.dm" #include "code\game\jobs\job\civilian.dm" #include "code\game\jobs\job\civilian_chaplain.dm" #include "code\game\jobs\job\engineering.dm" #include "code\game\jobs\job\job.dm" +#include "code\game\jobs\job\job_vr.dm" #include "code\game\jobs\job\medical.dm" #include "code\game\jobs\job\science.dm" #include "code\game\jobs\job\security.dm"