From 553ab65bf16f590d7529f1a42d225b044abc985e Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Fri, 13 May 2016 22:01:52 -0400 Subject: [PATCH 1/3] Adds job whitelist --- code/game/jobs/job/job_vr.dm | 2 ++ code/game/jobs/job_controller.dm | 13 ++++++++++ code/game/jobs/whitelist_vr.dm | 31 +++++++++++++++++++++++ code/modules/mob/new_player/new_player.dm | 1 + vorestation.dme | 2 ++ 5 files changed, 49 insertions(+) create mode 100644 code/game/jobs/job/job_vr.dm create mode 100644 code/game/jobs/whitelist_vr.dm diff --git a/code/game/jobs/job/job_vr.dm b/code/game/jobs/job/job_vr.dm new file mode 100644 index 0000000000..11bbc02830 --- /dev/null +++ b/code/game/jobs/job/job_vr.dm @@ -0,0 +1,2 @@ +/datum/job + var/whitelist_only = 0 \ No newline at end of file diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index adf5e2ab45..932dcf11d1 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 0000000000..9ef8d1bba7 --- /dev/null +++ b/code/game/jobs/whitelist_vr.dm @@ -0,0 +1,31 @@ +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 \ No newline at end of file diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index ae89a67366..53927668f8 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 8e1dcf3b70..717aa4dfb9 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" From 5484b227f36e9d3013989016ee34c0c1bbb1122f Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Sat, 14 May 2016 14:07:26 -0400 Subject: [PATCH 2/3] Update job_vr.dm --- code/game/jobs/job/job_vr.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/game/jobs/job/job_vr.dm b/code/game/jobs/job/job_vr.dm index 11bbc02830..ee6a2049c3 100644 --- a/code/game/jobs/job/job_vr.dm +++ b/code/game/jobs/job/job_vr.dm @@ -1,2 +1,3 @@ /datum/job - var/whitelist_only = 0 \ No newline at end of file + var/whitelist_only = 0 + From f6e26bd512874c1d3a2e28dcef617f36c0e950a8 Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Sat, 14 May 2016 14:07:50 -0400 Subject: [PATCH 3/3] Update whitelist_vr.dm --- code/game/jobs/whitelist_vr.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/game/jobs/whitelist_vr.dm b/code/game/jobs/whitelist_vr.dm index 9ef8d1bba7..f9180a9d25 100644 --- a/code/game/jobs/whitelist_vr.dm +++ b/code/game/jobs/whitelist_vr.dm @@ -28,4 +28,5 @@ var/list/job_whitelist = list() return 1 if(findtext(s,"[M.ckey] - All")) return 1 - return 0 \ No newline at end of file + return 0 +