mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-31 12:33:08 +00:00
chance of breaking is directly proportional to their frequency of use (ranges from 0% to 5%, used to be a blanket 2%). Their capacitor recharges one charge every 60 seconds. Once their 6 charges are used up, they temporarily stop working whilst their capacitor recharges. This should mean that flashes will last a long time with light use (defence/rev), but not for spamming (shitcurity). Can now job-ban people from entire departments through the jobban panel. Can now job-ban people even if they log out. Job-ban panel now informs you why people were banned from each job. Runtime fixes for some old jobban code that was preventing the above stuff. Committing some fixes Nodrak pointed out. Credits go to Nodrak for a lot of this. Revision: r3285 Author: elly1...@rocketmail.com
98 lines
2.6 KiB
Plaintext
98 lines
2.6 KiB
Plaintext
var
|
|
jobban_runonce // Updates legacy bans with new info
|
|
jobban_keylist[0] //to store the keys & ranks
|
|
|
|
/proc/jobban_fullban(mob/M, rank, reason)
|
|
if (!M || !M.key) return
|
|
jobban_keylist.Add(text("[M.ckey] - [rank] ## [reason]"))
|
|
jobban_savebanfile()
|
|
|
|
/proc/jobban_client_fullban(ckey, rank)
|
|
if (!ckey || !rank) return
|
|
jobban_keylist.Add(text("[ckey] - [rank]"))
|
|
jobban_savebanfile()
|
|
|
|
//returns a reason if M is banned from rank, returns 0 otherwise
|
|
/proc/jobban_isbanned(mob/M, rank)
|
|
if(M && rank)
|
|
if(_jobban_isbanned(M, rank)) return "Reason Unspecified" //for old jobban
|
|
if (guest_jobbans(rank))
|
|
if(config.guest_jobban && IsGuestKey(M.key))
|
|
return "Guest Job-ban"
|
|
if(config.usewhitelist && !check_whitelist(M))
|
|
return "Whitelisted Job"
|
|
|
|
for (var/s in jobban_keylist)
|
|
if( findtext(s,"[M.ckey] - [rank]") )
|
|
var/startpos = findtext(s, "## ")+3
|
|
if(startpos && startpos<length(s))
|
|
var/text = copytext(s, startpos, 0)
|
|
if(text)
|
|
return text
|
|
return "Reason Unspecified"
|
|
return 0
|
|
|
|
/*
|
|
DEBUG
|
|
/mob/verb/list_all_jobbans()
|
|
set name = "list all jobbans"
|
|
|
|
for(var/s in jobban_keylist)
|
|
world << s
|
|
|
|
/mob/verb/reload_jobbans()
|
|
set name = "reload jobbans"
|
|
|
|
jobban_loadbanfile()
|
|
*/
|
|
|
|
/proc/jobban_loadbanfile()
|
|
var/savefile/S=new("data/job_full.ban")
|
|
S["keys[0]"] >> jobban_keylist
|
|
log_admin("Loading jobban_rank")
|
|
S["runonce"] >> jobban_runonce
|
|
|
|
/*
|
|
for(var/i = 1; i <= length(jobban_keylist); i++)
|
|
if( findtext(jobban_keylist[i],"##") )
|
|
var/index = findtext(jobban_keylist[i],"##")
|
|
var/s = jobban_keylist[i]
|
|
s = copytext( s , 1 , index ) //Removes the reason for the ban from this list
|
|
jobban_keylist[i] = s
|
|
world << "DEBUG: index: [index] - s: [s] - jobban_keylist\[[i]\] = [jobban_keylist[i]]"*/
|
|
|
|
if (!length(jobban_keylist))
|
|
jobban_keylist=list()
|
|
log_admin("jobban_keylist was empty")
|
|
|
|
|
|
/proc/jobban_savebanfile()
|
|
var/savefile/S=new("data/job_full.ban")
|
|
S["keys[0]"] << jobban_keylist
|
|
|
|
/proc/jobban_unban(mob/M, rank)
|
|
jobban_remove("[M.ckey] - [rank]")
|
|
jobban_savebanfile()
|
|
|
|
|
|
/proc/ban_unban_log_save(var/formatted_log)
|
|
text2file(formatted_log,"data/ban_unban_log.txt")
|
|
|
|
|
|
/proc/jobban_updatelegacybans()
|
|
if(!jobban_runonce)
|
|
log_admin("Updating jobbanfile!")
|
|
// Updates bans.. Or fixes them. Either way.
|
|
for(var/T in jobban_keylist)
|
|
if(!T) continue
|
|
jobban_runonce++ //don't run this update again
|
|
|
|
|
|
/proc/jobban_remove(X)
|
|
for (var/i = 1; i <= length(jobban_keylist); i++)
|
|
if( findtext(jobban_keylist[i], "[X]") )
|
|
jobban_keylist.Remove(jobban_keylist[i])
|
|
jobban_savebanfile()
|
|
return 1
|
|
return 0
|