mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
[READY TO MERGE] Port's RS's anti job camping to Anomoly (#8618)
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
var/discord_ahelps_disabled = 0 //Turn this off if you don't want the TGS bot sending you messages whenever an ahelp ticket is created.
|
||||
var/discord_ahelps_all = 0 //Turn this on if you want all admin-PMs to go to be sent to discord, and not only the first message of a ticket.
|
||||
|
||||
|
||||
var/list/ip_whitelist = list()
|
||||
|
||||
/hook/startup/proc/read_ch_config()
|
||||
@@ -102,6 +103,8 @@
|
||||
config.role_request_id_expedition = value
|
||||
if ("role_request_id_silicon")
|
||||
config.role_request_id_silicon = value
|
||||
if("job_camp_time_limit")
|
||||
config.job_camp_time_limit = value MINUTES
|
||||
|
||||
|
||||
var/list/ip_whitelist_lines = file2list("config/ip_whitelist.txt")
|
||||
|
||||
@@ -65,3 +65,6 @@
|
||||
|
||||
/datum/config_entry/str_list/ip_whitelist
|
||||
protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN
|
||||
|
||||
/datum/config_entry/number/job_camp_time_limit
|
||||
default = 10 MINUTES
|
||||
|
||||
@@ -10,12 +10,20 @@ SUBSYSTEM_DEF(job)
|
||||
var/list/department_datums = list()
|
||||
var/debug_messages = FALSE
|
||||
|
||||
var/savepath = "data/job_camp_list.json" // CHOMPadd
|
||||
var/list/shift_keys = list() // CHOMPadd
|
||||
var/list/restricted_keys = list() // CHOMPadd
|
||||
|
||||
|
||||
/datum/controller/subsystem/job/Initialize() // CHOMPEdit
|
||||
if(!department_datums.len)
|
||||
setup_departments()
|
||||
if(!occupations.len)
|
||||
setup_occupations()
|
||||
//CHOMPadd begin
|
||||
if(CONFIG_GET(number/job_camp_time_limit))
|
||||
load_camp_lists()
|
||||
//CHOMPadd end
|
||||
return SS_INIT_SUCCESS // CHOMPEdit
|
||||
|
||||
/datum/controller/subsystem/job/proc/setup_occupations(faction = "Station")
|
||||
@@ -141,3 +149,24 @@ SUBSYSTEM_DEF(job)
|
||||
/datum/controller/subsystem/job/proc/job_debug_message(message)
|
||||
if(debug_messages)
|
||||
log_debug("JOB DEBUG: [message]")
|
||||
|
||||
//CHOMPadd start
|
||||
/datum/controller/subsystem/job/proc/load_camp_lists()
|
||||
if(fexists(savepath))
|
||||
restricted_keys = json_decode(file2text(savepath))
|
||||
fdel(savepath)
|
||||
|
||||
/datum/controller/subsystem/job/Shutdown(Addr, Natural)
|
||||
. = ..()
|
||||
if(fexists(savepath))
|
||||
fdel(savepath)
|
||||
var/json_to_file = json_encode(shift_keys)
|
||||
if(!json_to_file)
|
||||
log_debug("Saving: [savepath] failed jsonencode")
|
||||
return
|
||||
|
||||
//Write it out
|
||||
rustg_file_write(json_to_file, savepath)
|
||||
if(!fexists(savepath))
|
||||
log_debug("Saving: failed to save [savepath]")
|
||||
//CHOMPadd end
|
||||
|
||||
@@ -39,6 +39,10 @@
|
||||
// Description of the job's role and minimum responsibilities.
|
||||
var/job_description = "This Job doesn't have a description! Please report it!"
|
||||
|
||||
var/camp_protection = FALSE //CHOMPadd
|
||||
var/list/restricted_keys = list() //CHOMPadd
|
||||
var/list/shift_keys = list() //CHOMPadd
|
||||
|
||||
/datum/job/New()
|
||||
. = ..()
|
||||
department_accounts = department_accounts || departments_managed
|
||||
@@ -189,6 +193,13 @@
|
||||
return TRUE
|
||||
*/
|
||||
|
||||
//CHOMPadd start
|
||||
/datum/job/proc/register_shift_key(key)
|
||||
if(key)
|
||||
var/list/keylist = list(key)
|
||||
SSjob.shift_keys[title] += keylist
|
||||
//CHOMPadd end
|
||||
|
||||
//CHOMPAdd Start
|
||||
/datum/job/proc/update_limit(var/comperator)
|
||||
return
|
||||
|
||||
@@ -72,6 +72,10 @@ var/global/datum/controller/occupations/job_master
|
||||
player.mind.role_alt_title = GetPlayerAltTitle(player, rank)
|
||||
unassigned -= player
|
||||
job.current_positions++
|
||||
//CHOMPadd START
|
||||
if(job.camp_protection && round_duration_in_ds < transfer_controller.shift_hard_end - 30 MINUTES)
|
||||
job.register_shift_key(player.client.ckey)
|
||||
//CHOMPadd END
|
||||
return 1
|
||||
Debug("AR has failed, Player: [player], Rank: [rank]")
|
||||
return 0
|
||||
|
||||
@@ -177,7 +177,17 @@
|
||||
return
|
||||
if(newassignment != newjob.title && !(newassignment in newjob.alt_titles))
|
||||
return
|
||||
//CHOMPadd START
|
||||
if(newjob.camp_protection && round_duration_in_ds < CONFIG_GET(number/job_camp_time_limit))
|
||||
if(SSjob.restricted_keys.len)
|
||||
var/list/check = SSjob.restricted_keys[newjob.title]
|
||||
if(usr.client.ckey in check)
|
||||
to_chat(usr,span_danger("[newjob.title] is not presently selectable because you played as it last round. It will become available to you in [round((CONFIG_GET(number/job_camp_time_limit) - round_duration_in_ds) / 600)] minutes, if slots remain open."))
|
||||
return
|
||||
//CHOMPadd END
|
||||
|
||||
if(newjob)
|
||||
newjob.register_shift_key(usr.client.ckey)//CHOMPadd
|
||||
card.access = newjob.get_access()
|
||||
card.rank = newjob.title
|
||||
card.assignment = newassignment
|
||||
|
||||
@@ -74,6 +74,14 @@
|
||||
if(points_left < 0 || traits_left < 0)
|
||||
pass = FALSE
|
||||
to_chat(src,"<span class='warning'>Your custom species is not playable. Reconfigure your traits on the VORE tab.</span>")
|
||||
//CHOMPadd start
|
||||
if(J.camp_protection && round_duration_in_ds < CONFIG_GET(number/job_camp_time_limit))
|
||||
if(SSjob.restricted_keys.len)
|
||||
var/list/check = SSjob.restricted_keys[J.title]
|
||||
if(client.ckey in check)
|
||||
to_chat(client,span_danger("[J.title] is not presently selectable because you played as it last round. It will become available to you in [round(CONFIG_GET(number/job_camp_time_limit - round_duration_in_ds) / 600)] minutes, if slots remain open."))
|
||||
pass = FALSE
|
||||
//CHOMPadd end
|
||||
|
||||
//CHOMP Addition Begin
|
||||
if(client?.prefs?.neu_traits)
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
assignable = FALSE
|
||||
account_allowed = 0
|
||||
offmap_spawn = TRUE
|
||||
camp_protection = TRUE //So far leave this for shadekin
|
||||
|
||||
outfit_type = /decl/hierarchy/outfit/noncrew
|
||||
job_description = {"Players taking a role of an outsider not employed by NT with no special mechanics. One superpose pod is provided.
|
||||
|
||||
Reference in New Issue
Block a user