mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
- Added a config option that requires players to have played a certain number of days to select some jobs to play. The option is turned off by default and requires the database to work. See screenshot for default age requirement.
- When players connect, the database is polled for their age, accounts matching their ip and computer id. This information is stored in their client datum. Screenshot: http://www.ss13.eu/account%20age%20restriction2.png git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5552 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -94,6 +94,7 @@
|
||||
|
||||
var/admin_legacy_system = 0 //Defines whether the server uses the legacy admin system with admins.txt or the SQL system. Config option in config.txt
|
||||
var/ban_legacy_system = 0 //Defines whether the server uses the legacy banning system with the files in /data or the SQL system. Config option in config.txt
|
||||
var/use_age_restriction_for_jobs = 0 //Do jobs use account age restrictions? --requires database
|
||||
|
||||
var/assistant_maint = 0 //Do assistants get maint access?
|
||||
var/gateway_delay = 18000 //How long the gateway takes before it activates. Default is half an hour.
|
||||
@@ -151,6 +152,9 @@
|
||||
if ("ban_legacy_system")
|
||||
config.ban_legacy_system = 1
|
||||
|
||||
if ("use_age_restriction_for_jobs")
|
||||
config.use_age_restriction_for_jobs = 1
|
||||
|
||||
if ("jobs_have_minimal_access")
|
||||
config.jobs_have_minimal_access = 1
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
req_admin_notify = 1
|
||||
access = list() //See get_access()
|
||||
minimal_access = list() //See get_access()
|
||||
minimal_player_age = 14
|
||||
|
||||
|
||||
equip(var/mob/living/carbon/human/H)
|
||||
@@ -53,6 +54,7 @@
|
||||
selection_color = "#ddddff"
|
||||
idtype = /obj/item/weapon/card/id/silver
|
||||
req_admin_notify = 1
|
||||
minimal_player_age = 10
|
||||
access = list(access_security, access_sec_doors, access_brig, access_court, access_forensics_lockers,
|
||||
access_medical, access_engine, access_change_ids, access_ai_upload, access_eva, access_heads,
|
||||
access_all_personal_lockers, access_maint_tunnels, access_bar, access_janitor, access_construction, access_morgue,
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
access_teleporter, access_external_airlocks, access_atmospherics, access_emergency_storage, access_eva,
|
||||
access_heads, access_construction, access_sec_doors,
|
||||
access_ce, access_RC_announce, access_keycard_auth, access_tcomsat)
|
||||
minimal_player_age = 7
|
||||
|
||||
|
||||
equip(var/mob/living/carbon/human/H)
|
||||
|
||||
@@ -35,6 +35,9 @@
|
||||
//If this is set to 1, a text is printed to the player when jobs are assigned, telling him that he should let admins know that he has to disconnect.
|
||||
var/req_admin_notify
|
||||
|
||||
//If you have use_age_restriction_for_jobs config option enabled and the database set up, this option will add a requirement for players to be at least minimal_player_age days old. (meaning they first signed in at least that many days before.)
|
||||
var/minimal_player_age = 0
|
||||
|
||||
/datum/job/proc/equip(var/mob/living/carbon/human/H)
|
||||
return 1
|
||||
|
||||
@@ -45,4 +48,23 @@
|
||||
if(config.jobs_have_minimal_access)
|
||||
return src.minimal_access
|
||||
else
|
||||
return src.access
|
||||
return src.access
|
||||
|
||||
//If the configuration option is set to require players to be logged as old enough to play certain jobs, then this proc checks that they are, otherwise it just returns 1
|
||||
/datum/job/proc/player_old_enough(client/C)
|
||||
if(available_in_days(C) == 0)
|
||||
return 1 //Available in 0 days = available right now = player is old enough to play.
|
||||
return 0
|
||||
|
||||
|
||||
/datum/job/proc/available_in_days(client/C)
|
||||
if(!C)
|
||||
return 0
|
||||
if(!config.use_age_restriction_for_jobs)
|
||||
return 0
|
||||
if(!isnum(C.player_age))
|
||||
return 0 //This is only a number if the db connection is established, otherwise it is text: "Requires database", meaning these restrictions cannot be enforced
|
||||
if(!isnum(minimal_player_age))
|
||||
return 0
|
||||
|
||||
return max(0, minimal_player_age - C.player_age)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
minimal_access = list(access_medical, access_morgue, access_genetics, access_heads,
|
||||
access_chemistry, access_virology, access_cmo, access_surgery, access_RC_announce,
|
||||
access_keycard_auth, access_sec_doors)
|
||||
|
||||
minimal_player_age = 7
|
||||
|
||||
equip(var/mob/living/carbon/human/H)
|
||||
if(!H) return 0
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
access_tox_storage, access_teleporter, access_sec_doors,
|
||||
access_research, access_robotics, access_xenobiology, access_ai_upload,
|
||||
access_RC_announce, access_keycard_auth, access_tcomsat, access_gateway)
|
||||
|
||||
minimal_player_age = 7
|
||||
|
||||
equip(var/mob/living/carbon/human/H)
|
||||
if(!H) return 0
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
access_forensics_lockers, access_morgue, access_maint_tunnels, access_all_personal_lockers,
|
||||
access_research, access_engine, access_mining, access_medical, access_construction, access_mailsorting,
|
||||
access_heads, access_hos, access_RC_announce, access_keycard_auth, access_gateway)
|
||||
|
||||
minimal_player_age = 14
|
||||
|
||||
equip(var/mob/living/carbon/human/H)
|
||||
if(!H) return 0
|
||||
@@ -57,7 +57,7 @@
|
||||
selection_color = "#ffeeee"
|
||||
access = list(access_security, access_sec_doors, access_brig, access_armory, access_court)
|
||||
minimal_access = list(access_security, access_sec_doors, access_brig, access_armory, access_court)
|
||||
|
||||
minimal_player_age = 7
|
||||
|
||||
equip(var/mob/living/carbon/human/H)
|
||||
if(!H) return 0
|
||||
@@ -97,6 +97,7 @@
|
||||
selection_color = "#ffeeee"
|
||||
access = list(access_sec_doors, access_forensics_lockers, access_morgue, access_maint_tunnels, access_court)
|
||||
minimal_access = list(access_sec_doors, access_forensics_lockers, access_morgue, access_maint_tunnels, access_court)
|
||||
minimal_player_age = 7
|
||||
|
||||
|
||||
equip(var/mob/living/carbon/human/H)
|
||||
@@ -142,6 +143,7 @@
|
||||
selection_color = "#ffeeee"
|
||||
access = list(access_security, access_sec_doors, access_brig, access_court)
|
||||
minimal_access = list(access_security, access_sec_doors, access_brig, access_court)
|
||||
minimal_player_age = 7
|
||||
|
||||
|
||||
equip(var/mob/living/carbon/human/H)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
selection_color = "#ccffcc"
|
||||
supervisors = "your laws"
|
||||
req_admin_notify = 1
|
||||
|
||||
minimal_player_age = 30
|
||||
|
||||
equip(var/mob/living/carbon/human/H)
|
||||
if(!H) return 0
|
||||
@@ -25,6 +25,7 @@
|
||||
spawn_positions = 1
|
||||
supervisors = "your laws and the AI" //Nodrak
|
||||
selection_color = "#ddffdd"
|
||||
minimal_player_age = 21
|
||||
|
||||
equip(var/mob/living/carbon/human/H)
|
||||
if(!H) return 0
|
||||
|
||||
@@ -45,6 +45,7 @@ var/global/datum/controller/occupations/job_master
|
||||
var/datum/job/job = GetJob(rank)
|
||||
if(!job) return 0
|
||||
if(jobban_isbanned(player, rank)) return 0
|
||||
if(!job.player_old_enough(player.client)) return 0
|
||||
var/position_limit = job.total_positions
|
||||
if(!latejoin)
|
||||
position_limit = job.spawn_positions
|
||||
@@ -65,6 +66,9 @@ var/global/datum/controller/occupations/job_master
|
||||
if(jobban_isbanned(player, job.title))
|
||||
Debug("FOC isbanned failed, Player: [player]")
|
||||
continue
|
||||
if(!job.player_old_enough(player.client))
|
||||
Debug("FOC player not old enough, Player: [player]")
|
||||
continue
|
||||
if(flag && (!player.client.prefs.be_special & flag))
|
||||
Debug("FOC flag failed, Player: [player], Flag: [flag], ")
|
||||
continue
|
||||
@@ -74,7 +78,7 @@ var/global/datum/controller/occupations/job_master
|
||||
return candidates
|
||||
|
||||
proc/GiveRandomJob(var/mob/new_player/player)
|
||||
Debug("FOC Giving random job, Player: [player]")
|
||||
Debug("GRJ Giving random job, Player: [player]")
|
||||
for(var/datum/job/job in shuffle(occupations))
|
||||
if(!job)
|
||||
continue
|
||||
@@ -86,11 +90,15 @@ var/global/datum/controller/occupations/job_master
|
||||
continue
|
||||
|
||||
if(jobban_isbanned(player, job.title))
|
||||
Debug("FOC isbanned failed, Player: [player], Job: [job.title]")
|
||||
Debug("GRJ isbanned failed, Player: [player], Job: [job.title]")
|
||||
continue
|
||||
|
||||
if(!job.player_old_enough(player.client))
|
||||
Debug("GRJ player not old enough, Player: [player]")
|
||||
continue
|
||||
|
||||
if((job.current_positions < job.spawn_positions) || job.spawn_positions == -1)
|
||||
Debug("FOC Random job given, Player: [player], Job: [job]")
|
||||
Debug("GRJ Random job given, Player: [player], Job: [job]")
|
||||
AssignRole(player, job.title)
|
||||
unassigned -= player
|
||||
break
|
||||
@@ -233,7 +241,11 @@ var/global/datum/controller/occupations/job_master
|
||||
continue
|
||||
|
||||
if(jobban_isbanned(player, job.title))
|
||||
Debug("FOC isbanned failed, Player: [player], Job:[job.title]")
|
||||
Debug("DO isbanned failed, Player: [player], Job:[job.title]")
|
||||
continue
|
||||
|
||||
if(!job.player_old_enough(player.client))
|
||||
Debug("DO player not old enough, Player: [player], Job:[job.title]")
|
||||
continue
|
||||
|
||||
// If the player wants that job on this level, then try give it to him.
|
||||
@@ -241,7 +253,7 @@ var/global/datum/controller/occupations/job_master
|
||||
|
||||
// If the job isn't filled
|
||||
if((job.current_positions < job.spawn_positions) || job.spawn_positions == -1)
|
||||
Debug("FOC pass, Player: [player], Level:[level], Job:[job.title]")
|
||||
Debug("DO pass, Player: [player], Level:[level], Job:[job.title]")
|
||||
AssignRole(player, job.title)
|
||||
unassigned -= player
|
||||
break
|
||||
@@ -417,12 +429,16 @@ var/global/datum/controller/occupations/job_master
|
||||
var/level3 = 0 //low
|
||||
var/level4 = 0 //never
|
||||
var/level5 = 0 //banned
|
||||
var/level6 = 0 //account too young
|
||||
for(var/mob/new_player/player in player_list)
|
||||
if(!(player.ready && player.mind && !player.mind.assigned_role))
|
||||
continue //This player is not ready
|
||||
if(jobban_isbanned(player, job.title))
|
||||
level5++
|
||||
continue
|
||||
if(!job.player_old_enough(player.client))
|
||||
level6++
|
||||
continue
|
||||
if(player.client.prefs.GetJobDepartment(job, 1) & job.flag)
|
||||
level1++
|
||||
else if(player.client.prefs.GetJobDepartment(job, 2) & job.flag)
|
||||
@@ -431,5 +447,5 @@ var/global/datum/controller/occupations/job_master
|
||||
level3++
|
||||
else level4++ //not selected
|
||||
|
||||
tmp_str += "HIGH=[level1]|MEDIUM=[level2]|LOW=[level3]|NEVER=[level4]|BANNED=[level5]|-"
|
||||
tmp_str += "HIGH=[level1]|MEDIUM=[level2]|LOW=[level3]|NEVER=[level4]|BANNED=[level5]|-|YOUNG=[level6]|-"
|
||||
feedback_add_details("job_preferences",tmp_str)
|
||||
|
||||
@@ -63,4 +63,4 @@
|
||||
H << "You'll have to wait if you want to atone for your sins."
|
||||
spawn(3000)
|
||||
H.miming = 1
|
||||
return
|
||||
return
|
||||
@@ -31,4 +31,9 @@
|
||||
control_freak = 1
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////
|
||||
//things that require the database//
|
||||
////////////////////////////////////
|
||||
var/player_age = "Requires database" //So admins know why it isn't working - Used to determine how old the account is - in days.
|
||||
var/related_accounts_ip = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this ip
|
||||
var/related_accounts_cid = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this computer id
|
||||
|
||||
@@ -157,11 +157,26 @@
|
||||
|
||||
var/sql_ckey = sql_sanitize_text(src.ckey)
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM erro_player WHERE ckey = '[sql_ckey]'")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id, datediff(Now(),firstseen) as age FROM erro_player WHERE ckey = '[sql_ckey]'")
|
||||
query.Execute()
|
||||
var/sql_id = 0
|
||||
while(query.NextRow())
|
||||
sql_id = query.item[1]
|
||||
player_age = text2num(query.item[2])
|
||||
break
|
||||
|
||||
var/DBQuery/query_ip = dbcon.NewQuery("SELECT ckey FROM erro_player WHERE ip = '[address]'")
|
||||
query_ip.Execute()
|
||||
related_accounts_ip = ""
|
||||
while(query_ip.NextRow())
|
||||
related_accounts_ip += "[query_ip.item[1]], "
|
||||
break
|
||||
|
||||
var/DBQuery/query_cid = dbcon.NewQuery("SELECT ckey FROM erro_player WHERE computerid = '[computer_id]'")
|
||||
query_cid.Execute()
|
||||
related_accounts_cid = ""
|
||||
while(query_cid.NextRow())
|
||||
related_accounts_cid += "[query_cid.item[1]], "
|
||||
break
|
||||
|
||||
//Just the standard check to see if it's actually a number
|
||||
@@ -189,6 +204,12 @@
|
||||
var/DBQuery/query_insert = dbcon.NewQuery("INSERT INTO erro_player (id, ckey, firstseen, lastseen, ip, computerid, lastadminrank) VALUES (null, '[sql_ckey]', Now(), Now(), '[sql_ip]', '[sql_computerid]', '[sql_admin_rank]')")
|
||||
query_insert.Execute()
|
||||
|
||||
//Logging player access
|
||||
var/serverip = "[world.internet_address]:[world.port]"
|
||||
var/DBQuery/query_accesslog = dbcon.NewQuery("INSERT INTO `erro_connection_log`(`id`,`datetime`,`serverip`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),'[serverip]','[sql_ckey]','[sql_ip]','[sql_computerid]');")
|
||||
query_accesslog.Execute()
|
||||
|
||||
|
||||
#undef TOPIC_SPAM_DELAY
|
||||
#undef UPLOAD_LIMIT
|
||||
#undef MIN_CLIENT_VERSION
|
||||
|
||||
@@ -247,6 +247,10 @@ datum/preferences
|
||||
if(jobban_isbanned(user, rank))
|
||||
HTML += "<font color=red>[rank]</font></td><td><font color=red><b> \[BANNED]</b></font></td></tr>"
|
||||
continue
|
||||
if(!job.player_old_enough(user.client))
|
||||
var/available_in_days = job.available_in_days(user.client)
|
||||
HTML += "<font color=red>[rank]</font></td><td><font color=red> \[IN [(available_in_days)] DAYS]</font></td></tr>"
|
||||
continue
|
||||
if((job_civilian_low & ASSISTANT) && (rank != "Assistant"))
|
||||
HTML += "<font color=orange>[rank]</font></td><td></td></tr>"
|
||||
continue
|
||||
|
||||
@@ -288,6 +288,3 @@
|
||||
enzymes -= 50
|
||||
new/obj/item/weapon/reagent_containers/food/condiment/enzyme(src.loc)
|
||||
|
||||
// /obj/item/weapon/reagent_containers/food/condiment/enzyme
|
||||
|
||||
|
||||
|
||||
@@ -239,6 +239,7 @@
|
||||
if(!job) return 0
|
||||
if((job.current_positions >= job.total_positions) && job.total_positions != -1) return 0
|
||||
if(jobban_isbanned(src,rank)) return 0
|
||||
if(!job.player_old_enough(src.client)) return 0
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@ BAN_LEGACY_SYSTEM
|
||||
## Add a # here if you wish to use the setup where jobs have more access. This is intended for servers with low populations - where there are not enough players to fill all roles, so players need to do more than just one job. Also for servers where they don't want people to hide in their own departments.
|
||||
JOBS_HAVE_MINIMAL_ACCESS
|
||||
|
||||
## Unhash this entry to have certain jobs require your account to be at least a certain number of days old to select. You can configure the exact age requirement for different jobs by editing
|
||||
## the minimal_player_age variable in the files in folder /code/game/jobs/job/.. for the job you want to edit. Set minimal_player_age to 0 to disable age requirement for that job.
|
||||
## REQUIRES the database set up to work. Keep it hashed if you don't have a database set up.
|
||||
## NOTE: If you have just set-up the database keep this DISABLED, as player age is determined from the first time they connect to the server with the database up. If you just set it up, it means
|
||||
## you have noone older than 0 days, since noone has been logged yet. Only turn this on once you have had the database up for 30 days.
|
||||
#USE_AGE_RESTRICTION_FOR_JOBS
|
||||
|
||||
## log OOC channel
|
||||
LOG_OOC
|
||||
|
||||
|
||||
Reference in New Issue
Block a user