mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-30 07:28:53 +01:00
Merge pull request #57 from VOREStation/jobwhitelist
Adds job whitelist
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
/datum/job
|
||||
var/whitelist_only = 0
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user