From 58e884d18e0cba18fc12815c3a2ff3f47a547147 Mon Sep 17 00:00:00 2001 From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com> Date: Thu, 5 Nov 2020 21:49:46 +0000 Subject: [PATCH 1/8] fix --- code/controllers/subsystem/mapping.dm | 14 ++++---------- code/modules/awaymissions/zlevel.dm | 8 ++++++++ code/modules/mapping/map_template.dm | 9 +++++++-- .../mapping/space_management/zlevel_manager.dm | 10 ++++++++-- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 1e88d35e7e..0ae179c1ba 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -470,7 +470,6 @@ GLOBAL_LIST_EMPTY(the_station_areas) return var/away_name - var/datum/space_level/away_level var/answer = input("What kind ? ","Away/VR") as null|anything in (possible_options + "Custom") switch(answer) @@ -482,19 +481,14 @@ GLOBAL_LIST_EMPTY(the_station_areas) return away_name = "[mapfile] custom" to_chat(usr,"Loading [away_name]...") - var/datum/map_template/template = new(mapfile, choice, ztraits) - away_level = template.load_new_z(ztraits) + createSpecificZlevel(choice, ztraits, mapfile) else away_name = answer to_chat(usr,"Loading [away_name]...") - var/datum/map_template/template = new(away_name, choice) - away_level = template.load_new_z(ztraits) + createSpecificZlevel(choice, ztraits, away_name) - message_admins("Admin [key_name_admin(usr)] has loaded [away_name] away mission.") - log_admin("Admin [key_name(usr)] has loaded [away_name] away mission.") - if(!away_level) - message_admins("Loading [away_name] failed!") - return + message_admins("Admin [key_name_admin(usr)] has attempted to load [away_name] away mission.") + log_admin("Admin [key_name(usr)] has attempted to load [away_name] away mission.") /datum/controller/subsystem/mapping/proc/RequestBlockReservation(width, height, z, type = /datum/turf_reservation, turf_type_override, border_type_override) UNTIL((!z || reservation_ready["[z]"]) && !clearing_reserved_turfs) diff --git a/code/modules/awaymissions/zlevel.dm b/code/modules/awaymissions/zlevel.dm index 1e2e1fe43c..406e1ced29 100644 --- a/code/modules/awaymissions/zlevel.dm +++ b/code/modules/awaymissions/zlevel.dm @@ -15,6 +15,14 @@ INIT_ANNOUNCE("Loaded [name] in [(REALTIMEOFDAY - start_time)/10]s!") GLOB.random_zlevels_generated[name] = TRUE +/proc/createSpecificZlevel(name = AWAY_MISSION_NAME, list/traits = list(ZTRAIT_AWAY = TRUE), map) + var/start_time = REALTIMEOFDAY + if(!load_new_z_level(map, name, SOUTH, traits)) + INIT_ANNOUNCE("Failed to load [name]! map filepath: [map]!") + return + INIT_ANNOUNCE("Loaded [name] in [(REALTIMEOFDAY - start_time)/10]s!") + GLOB.random_zlevels_generated[name] = TRUE + /obj/effect/landmark/awaystart name = "away mission spawn" desc = "Randomly picked away mission spawn points." diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm index 087552fada..b102abb767 100644 --- a/code/modules/mapping/map_template.dm +++ b/code/modules/mapping/map_template.dm @@ -90,20 +90,25 @@ /datum/map_template/proc/load_new_z(orientation = SOUTH, list/ztraits = src.ztraits || list(ZTRAIT_AWAY = TRUE), centered = TRUE) var/x = centered? max(round((world.maxx - width) / 2), 1) : 1 var/y = centered? max(round((world.maxy - height) / 2), 1) : 1 - + message_admins("d1") var/datum/space_level/level = SSmapping.add_new_zlevel(name, ztraits) + message_admins("d2") var/datum/parsed_map/parsed = load_map(file(mappath), x, y, level.z_value, no_changeturf=(SSatoms.initialized == INITIALIZATION_INSSATOMS), placeOnTop = TRUE, orientation = orientation) + message_admins("d3") var/list/bounds = parsed.bounds if(!bounds) return FALSE repopulate_sorted_areas() - + message_admins("d4") //initialize things that are normally initialized after map load parsed.initTemplateBounds() + message_admins("d5") smooth_zlevel(world.maxz) + message_admins("d6") log_game("Z-level [name] loaded at [x],[y],[world.maxz]") on_map_loaded(world.maxz, parsed.bounds) + message_admins("d7") return level diff --git a/code/modules/mapping/space_management/zlevel_manager.dm b/code/modules/mapping/space_management/zlevel_manager.dm index 6129c5fd2b..c5bd788ecd 100644 --- a/code/modules/mapping/space_management/zlevel_manager.dm +++ b/code/modules/mapping/space_management/zlevel_manager.dm @@ -17,14 +17,20 @@ z_list += S /datum/controller/subsystem/mapping/proc/add_new_zlevel(name, traits = list(), z_type = /datum/space_level) + message_admins("d1_1") SEND_GLOBAL_SIGNAL(COMSIG_GLOB_NEW_Z, args) var/new_z = z_list.len + 1 - if (world.maxz < new_z) + if(world.maxz < new_z) + message_admins("d1_2") world.incrementMaxZ() - CHECK_TICK + message_admins("d1_3") + //CHECK_TICK // TODO: sleep here if the Z level needs to be cleared + message_admins("d1_4") var/datum/space_level/S = new z_type(new_z, name, traits) + message_admins("d1_5") z_list += S + message_admins("d1_6") return S /datum/controller/subsystem/mapping/proc/get_level(z) From e2ca7164b9ddf0dd6a68a70d943a9a2fa7f5002c Mon Sep 17 00:00:00 2001 From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com> Date: Fri, 6 Nov 2020 21:00:14 +0000 Subject: [PATCH 2/8] age verification --- code/__DEFINES/preferences.dm | 4 +- .../configuration/entries/general.dm | 3 + code/modules/client/client_procs.dm | 71 +++++++++++-------- .../modules/mob/dead/new_player/new_player.dm | 20 ++++++ config/config.txt | 3 + 5 files changed, 71 insertions(+), 30 deletions(-) diff --git a/code/__DEFINES/preferences.dm b/code/__DEFINES/preferences.dm index aef77e7b57..cd13510366 100644 --- a/code/__DEFINES/preferences.dm +++ b/code/__DEFINES/preferences.dm @@ -78,7 +78,9 @@ #define EXP_TYPE_ADMIN "Admin" //Flags in the players table in the db -#define DB_FLAG_EXEMPT 1 +#define DB_FLAG_EXEMPT (1<<0) +#define DB_FLAG_AGE_CONFIRMATION_INCOMPLETE (1<<1) +#define DB_FLAG_AGE_CONFIRMATION_COMPLETE (1<<2) #define DEFAULT_CYBORG_NAME "Default Cyborg Name" diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index 48b159baa1..90ec3bc289 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -327,6 +327,9 @@ /datum/config_entry/number/notify_new_player_account_age // how long do we notify admins of a new byond account min_val = 0 +/datum/config_entry/flag/age_verification //are we using the automated age verification which asks users if they're 18+? + config_entry_value = TRUE + /datum/config_entry/flag/irc_first_connection_alert // do we notify the irc channel when somebody is connecting for the first time? /datum/config_entry/flag/check_randomizer diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 7d33a87111..d4d0a48ce1 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -268,7 +268,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( else prefs = new /datum/preferences(src) GLOB.preferences_datums[ckey] = prefs - + addtimer(CALLBACK(src, .proc/ensure_keys_set), 10) //prevents possible race conditions prefs.last_ip = address //these are gonna be used for banning @@ -561,36 +561,49 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( if(!query_client_in_db.Execute()) qdel(query_client_in_db) return - if(!query_client_in_db.NextRow()) - if (CONFIG_GET(flag/panic_bunker) && !holder && !GLOB.deadmins[ckey] && !(ckey in GLOB.bunker_passthrough)) - log_access("Failed Login: [key] - New account attempting to connect during panic bunker") - message_admins("Failed Login: [key] - New account attempting to connect during panic bunker") - to_chat(src, "You must first join the Discord to verify your account before joining this server.
To do so, read the rules and post a request in the #station-access-requests channel under the \"Main server\" category in the Discord server linked here: https://discord.gg/E6SQuhz
If you have already done so, wait a few minutes then try again; sometimes the server needs to fully load before you can join.
") //CIT CHANGE - makes the panic bunker disconnect message point to the discord - var/list/connectiontopic_a = params2list(connectiontopic) - var/list/panic_addr = CONFIG_GET(string/panic_server_address) - if(panic_addr && !connectiontopic_a["redirect"]) - var/panic_name = CONFIG_GET(string/panic_server_name) - to_chat(src, "Sending you to [panic_name ? panic_name : panic_addr].") - winset(src, null, "command=.options") - src << link("[panic_addr]?redirect=1") - qdel(query_client_in_db) - qdel(src) - return + if(!query_client_in_db.NextRow()) //new user detected + if(!holder && !GLOB.deadmins[ckey]) + if(CONFIG_GET(flag/panic_bunker) && !(ckey in GLOB.bunker_passthrough)) + log_access("Failed Login: [key] - New account attempting to connect during panic bunker") + message_admins("Failed Login: [key] - New account attempting to connect during panic bunker") + to_chat(src, "You must first join the Discord to verify your account before joining this server.
To do so, read the rules and post a request in the #station-access-requests channel under the \"Main server\" category in the Discord server linked here: https://discord.gg/E6SQuhz
If you have already done so, wait a few minutes then try again; sometimes the server needs to fully load before you can join.
") //CIT CHANGE - makes the panic bunker disconnect message point to the discord + var/list/connectiontopic_a = params2list(connectiontopic) + var/list/panic_addr = CONFIG_GET(string/panic_server_address) + if(panic_addr && !connectiontopic_a["redirect"]) + var/panic_name = CONFIG_GET(string/panic_server_name) + to_chat(src, "Sending you to [panic_name ? panic_name : panic_addr].") + winset(src, null, "command=.options") + src << link("[panic_addr]?redirect=1") + qdel(query_client_in_db) + qdel(src) + return - new_player = 1 - account_join_date = sanitizeSQL(findJoinDate()) - var/sql_key = sanitizeSQL(key) - var/datum/DBQuery/query_add_player = SSdbcore.NewQuery("INSERT INTO [format_table_name("player")] (`ckey`, `byond_key`, `firstseen`, `firstseen_round_id`, `lastseen`, `lastseen_round_id`, `ip`, `computerid`, `lastadminrank`, `accountjoindate`) VALUES ('[sql_ckey]', '[sql_key]', Now(), '[GLOB.round_id]', Now(), '[GLOB.round_id]', INET_ATON('[sql_ip]'), '[sql_computerid]', '[sql_admin_rank]', [account_join_date ? "'[account_join_date]'" : "NULL"])") - if(!query_add_player.Execute()) - qdel(query_client_in_db) + new_player = 1 + account_join_date = sanitizeSQL(findJoinDate()) + var/sql_key = sanitizeSQL(key) + var/datum/DBQuery/query_add_player = SSdbcore.NewQuery("INSERT INTO [format_table_name("player")] (`ckey`, `byond_key`, `firstseen`, `firstseen_round_id`, `lastseen`, `lastseen_round_id`, `ip`, `computerid`, `lastadminrank`, `accountjoindate`) VALUES ('[sql_ckey]', '[sql_key]', Now(), '[GLOB.round_id]', Now(), '[GLOB.round_id]', INET_ATON('[sql_ip]'), '[sql_computerid]', '[sql_admin_rank]', [account_join_date ? "'[account_join_date]'" : "NULL"])") + if(!query_add_player.Execute()) + qdel(query_client_in_db) + qdel(query_add_player) + return qdel(query_add_player) - return - qdel(query_add_player) - if(!account_join_date) - account_join_date = "Error" - account_age = -1 - else if(ckey in GLOB.bunker_passthrough) - GLOB.bunker_passthrough -= ckey + if(!account_join_date) + account_join_date = "Error" + account_age = -1 + else if(ckey in GLOB.bunker_passthrough) + GLOB.bunker_passthrough -= ckey + if(CONFIG_GET(flag/age_verification)) //setup age verification + if(!C.set_db_player_flags()) + message_admins(usr, "ERROR: Unable to read player flags from database. Please check logs.") + return + else + var/dbflags = C.prefs.db_flags + if(!(dbflags & DB_FLAG_AGE_CONFIRMATION_COMPLETE)) //they have not completed age verification + if((ckey in GLOB.bunker_passthrough)) //they're verified in the panic bunker though + C.update_flag_db(DB_FLAG_AGE_CONFIRMATION_COMPLETE, TRUE) + else + C.update_flag_db(DB_FLAG_AGE_CONFIRMATION_INCOMPLETE, TRUE) + qdel(query_client_in_db) var/datum/DBQuery/query_get_client_age = SSdbcore.NewQuery("SELECT firstseen, DATEDIFF(Now(),firstseen), accountjoindate, DATEDIFF(Now(),accountjoindate) FROM [format_table_name("player")] WHERE ckey = '[sql_ckey]'") if(!query_get_client_age.Execute()) diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index 1fdf3102a9..e156f8904d 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -34,6 +34,26 @@ return /mob/dead/new_player/proc/new_player_panel() + //hold this until we know they passed age verification + if(CONFIG_GET(flag/age_verification)) //make sure they are verified + if(!C.set_db_player_flags()) + message_admins("Blocked [src] from new player panel because age verification could not access player database flags.") + return + else + var/dbflags = C.prefs.db_flags + if(dbflags & DB_FLAG_AGE_CONFIRMATION_INCOMPLETE) //they have not completed age verification + var/age_verification = alert(src, "You must be 18+ to enter this server. Please confirm your age.",, "I am 18+", "I am not 18+") + if(age_verification != "I am 18+") + create_message("note", ckey, "Server - Automated Age Verification", "Failed age verification.", null, null, TRUE, TRUE, null, "9999-01-01", "High") //log this occurence + qdel(client) //kick the user + else + //they claim to be of age, so allow them to continue and update their flags + client.update_flag_db(DB_FLAG_AGE_CONFIRMATION_COMPLETE, TRUE) + client.update_flag_db(DB_FLAG_AGE_CONFIRMATION_INCOMPLETE, FALSE) + //log this + message_admins("[ckey] has joined through the automated age verification process.") + + var/output = "

Welcome, [client ? client.prefs.real_name : "Unknown User"]

" output += "

Setup Character

" diff --git a/config/config.txt b/config/config.txt index 7e2ff5da41..5be76972ab 100644 --- a/config/config.txt +++ b/config/config.txt @@ -375,6 +375,9 @@ NOTIFY_NEW_PLAYER_ACCOUNT_AGE 1 ##Name of the place to send people rejected by the bunker #PANIC_SERVER_NAME [Put the name here] +##Automated age verification, comment this out to not ask new users if they are 18+ +AGE_VERIFICATION + ## Uncomment to have the changelog file automatically open when a user connects and hasn't seen the latest changelog #AGGRESSIVE_CHANGELOG From fdd7cc9843c290de84ae2632a4510686dc7eb8d2 Mon Sep 17 00:00:00 2001 From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com> Date: Fri, 6 Nov 2020 21:45:47 +0000 Subject: [PATCH 3/8] Revert "fix" This reverts commit 58e884d18e0cba18fc12815c3a2ff3f47a547147. --- code/controllers/subsystem/mapping.dm | 14 ++++++++++---- code/modules/awaymissions/zlevel.dm | 8 -------- code/modules/mapping/map_template.dm | 9 ++------- .../mapping/space_management/zlevel_manager.dm | 10 ++-------- 4 files changed, 14 insertions(+), 27 deletions(-) diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 0ae179c1ba..1e88d35e7e 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -470,6 +470,7 @@ GLOBAL_LIST_EMPTY(the_station_areas) return var/away_name + var/datum/space_level/away_level var/answer = input("What kind ? ","Away/VR") as null|anything in (possible_options + "Custom") switch(answer) @@ -481,14 +482,19 @@ GLOBAL_LIST_EMPTY(the_station_areas) return away_name = "[mapfile] custom" to_chat(usr,"Loading [away_name]...") - createSpecificZlevel(choice, ztraits, mapfile) + var/datum/map_template/template = new(mapfile, choice, ztraits) + away_level = template.load_new_z(ztraits) else away_name = answer to_chat(usr,"Loading [away_name]...") - createSpecificZlevel(choice, ztraits, away_name) + var/datum/map_template/template = new(away_name, choice) + away_level = template.load_new_z(ztraits) - message_admins("Admin [key_name_admin(usr)] has attempted to load [away_name] away mission.") - log_admin("Admin [key_name(usr)] has attempted to load [away_name] away mission.") + message_admins("Admin [key_name_admin(usr)] has loaded [away_name] away mission.") + log_admin("Admin [key_name(usr)] has loaded [away_name] away mission.") + if(!away_level) + message_admins("Loading [away_name] failed!") + return /datum/controller/subsystem/mapping/proc/RequestBlockReservation(width, height, z, type = /datum/turf_reservation, turf_type_override, border_type_override) UNTIL((!z || reservation_ready["[z]"]) && !clearing_reserved_turfs) diff --git a/code/modules/awaymissions/zlevel.dm b/code/modules/awaymissions/zlevel.dm index 406e1ced29..1e2e1fe43c 100644 --- a/code/modules/awaymissions/zlevel.dm +++ b/code/modules/awaymissions/zlevel.dm @@ -15,14 +15,6 @@ INIT_ANNOUNCE("Loaded [name] in [(REALTIMEOFDAY - start_time)/10]s!") GLOB.random_zlevels_generated[name] = TRUE -/proc/createSpecificZlevel(name = AWAY_MISSION_NAME, list/traits = list(ZTRAIT_AWAY = TRUE), map) - var/start_time = REALTIMEOFDAY - if(!load_new_z_level(map, name, SOUTH, traits)) - INIT_ANNOUNCE("Failed to load [name]! map filepath: [map]!") - return - INIT_ANNOUNCE("Loaded [name] in [(REALTIMEOFDAY - start_time)/10]s!") - GLOB.random_zlevels_generated[name] = TRUE - /obj/effect/landmark/awaystart name = "away mission spawn" desc = "Randomly picked away mission spawn points." diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm index b102abb767..087552fada 100644 --- a/code/modules/mapping/map_template.dm +++ b/code/modules/mapping/map_template.dm @@ -90,25 +90,20 @@ /datum/map_template/proc/load_new_z(orientation = SOUTH, list/ztraits = src.ztraits || list(ZTRAIT_AWAY = TRUE), centered = TRUE) var/x = centered? max(round((world.maxx - width) / 2), 1) : 1 var/y = centered? max(round((world.maxy - height) / 2), 1) : 1 - message_admins("d1") + var/datum/space_level/level = SSmapping.add_new_zlevel(name, ztraits) - message_admins("d2") var/datum/parsed_map/parsed = load_map(file(mappath), x, y, level.z_value, no_changeturf=(SSatoms.initialized == INITIALIZATION_INSSATOMS), placeOnTop = TRUE, orientation = orientation) - message_admins("d3") var/list/bounds = parsed.bounds if(!bounds) return FALSE repopulate_sorted_areas() - message_admins("d4") + //initialize things that are normally initialized after map load parsed.initTemplateBounds() - message_admins("d5") smooth_zlevel(world.maxz) - message_admins("d6") log_game("Z-level [name] loaded at [x],[y],[world.maxz]") on_map_loaded(world.maxz, parsed.bounds) - message_admins("d7") return level diff --git a/code/modules/mapping/space_management/zlevel_manager.dm b/code/modules/mapping/space_management/zlevel_manager.dm index c5bd788ecd..6129c5fd2b 100644 --- a/code/modules/mapping/space_management/zlevel_manager.dm +++ b/code/modules/mapping/space_management/zlevel_manager.dm @@ -17,20 +17,14 @@ z_list += S /datum/controller/subsystem/mapping/proc/add_new_zlevel(name, traits = list(), z_type = /datum/space_level) - message_admins("d1_1") SEND_GLOBAL_SIGNAL(COMSIG_GLOB_NEW_Z, args) var/new_z = z_list.len + 1 - if(world.maxz < new_z) - message_admins("d1_2") + if (world.maxz < new_z) world.incrementMaxZ() - message_admins("d1_3") - //CHECK_TICK + CHECK_TICK // TODO: sleep here if the Z level needs to be cleared - message_admins("d1_4") var/datum/space_level/S = new z_type(new_z, name, traits) - message_admins("d1_5") z_list += S - message_admins("d1_6") return S /datum/controller/subsystem/mapping/proc/get_level(z) From 1993364ce0352d9b3e8363ec9f8fd304f8e4a4ab Mon Sep 17 00:00:00 2001 From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com> Date: Fri, 6 Nov 2020 21:45:52 +0000 Subject: [PATCH 4/8] Revert "deletes one word" This reverts commit 8b7fd151afd0841854607f6fb4f2fc6a10a189ec. --- code/controllers/subsystem/mapping.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 1e88d35e7e..2ea3b29c91 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -472,7 +472,7 @@ GLOBAL_LIST_EMPTY(the_station_areas) var/away_name var/datum/space_level/away_level - var/answer = input("What kind ? ","Away/VR") as null|anything in (possible_options + "Custom") + var/answer = input("What kind ? ","Away/VR") as null|anything in list(possible_options + "Custom") switch(answer) if(null) return From 82e561675c5aa1266ab109496bb874e058e008b8 Mon Sep 17 00:00:00 2001 From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com> Date: Fri, 6 Nov 2020 21:47:22 +0000 Subject: [PATCH 5/8] yes --- code/modules/client/client_procs.dm | 8 ++++---- code/modules/mob/dead/new_player/new_player.dm | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index d4d0a48ce1..c581e402a6 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -593,16 +593,16 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( else if(ckey in GLOB.bunker_passthrough) GLOB.bunker_passthrough -= ckey if(CONFIG_GET(flag/age_verification)) //setup age verification - if(!C.set_db_player_flags()) + if(!set_db_player_flags()) message_admins(usr, "ERROR: Unable to read player flags from database. Please check logs.") return else - var/dbflags = C.prefs.db_flags + var/dbflags = prefs.db_flags if(!(dbflags & DB_FLAG_AGE_CONFIRMATION_COMPLETE)) //they have not completed age verification if((ckey in GLOB.bunker_passthrough)) //they're verified in the panic bunker though - C.update_flag_db(DB_FLAG_AGE_CONFIRMATION_COMPLETE, TRUE) + update_flag_db(DB_FLAG_AGE_CONFIRMATION_COMPLETE, TRUE) else - C.update_flag_db(DB_FLAG_AGE_CONFIRMATION_INCOMPLETE, TRUE) + update_flag_db(DB_FLAG_AGE_CONFIRMATION_INCOMPLETE, TRUE) qdel(query_client_in_db) var/datum/DBQuery/query_get_client_age = SSdbcore.NewQuery("SELECT firstseen, DATEDIFF(Now(),firstseen), accountjoindate, DATEDIFF(Now(),accountjoindate) FROM [format_table_name("player")] WHERE ckey = '[sql_ckey]'") diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index e156f8904d..aeb849a24c 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -36,11 +36,11 @@ /mob/dead/new_player/proc/new_player_panel() //hold this until we know they passed age verification if(CONFIG_GET(flag/age_verification)) //make sure they are verified - if(!C.set_db_player_flags()) + if(!client.set_db_player_flags()) message_admins("Blocked [src] from new player panel because age verification could not access player database flags.") return else - var/dbflags = C.prefs.db_flags + var/dbflags = client.prefs.db_flags if(dbflags & DB_FLAG_AGE_CONFIRMATION_INCOMPLETE) //they have not completed age verification var/age_verification = alert(src, "You must be 18+ to enter this server. Please confirm your age.",, "I am 18+", "I am not 18+") if(age_verification != "I am 18+") From 68c0caf4fa8d5aeae8ca20db24a2b4f7fa6a8a15 Mon Sep 17 00:00:00 2001 From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com> Date: Sat, 7 Nov 2020 19:32:23 +0000 Subject: [PATCH 6/8] better verification --- .../modules/mob/dead/new_player/new_player.dm | 45 ++++++++++--------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index aeb849a24c..7a3bfbf988 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -34,26 +34,6 @@ return /mob/dead/new_player/proc/new_player_panel() - //hold this until we know they passed age verification - if(CONFIG_GET(flag/age_verification)) //make sure they are verified - if(!client.set_db_player_flags()) - message_admins("Blocked [src] from new player panel because age verification could not access player database flags.") - return - else - var/dbflags = client.prefs.db_flags - if(dbflags & DB_FLAG_AGE_CONFIRMATION_INCOMPLETE) //they have not completed age verification - var/age_verification = alert(src, "You must be 18+ to enter this server. Please confirm your age.",, "I am 18+", "I am not 18+") - if(age_verification != "I am 18+") - create_message("note", ckey, "Server - Automated Age Verification", "Failed age verification.", null, null, TRUE, TRUE, null, "9999-01-01", "High") //log this occurence - qdel(client) //kick the user - else - //they claim to be of age, so allow them to continue and update their flags - client.update_flag_db(DB_FLAG_AGE_CONFIRMATION_COMPLETE, TRUE) - client.update_flag_db(DB_FLAG_AGE_CONFIRMATION_INCOMPLETE, FALSE) - //log this - message_admins("[ckey] has joined through the automated age verification process.") - - var/output = "

Welcome, [client ? client.prefs.real_name : "Unknown User"]

" output += "

Setup Character

" @@ -98,6 +78,28 @@ popup.set_content(output) popup.open(FALSE) +/mob/dead/new_player/proc/age_verify() + if(CONFIG_GET(flag/age_verification)) //make sure they are verified + if(!client.set_db_player_flags()) + message_admins("Blocked [src] from new player panel because age verification could not access player database flags.") + return FALSE + else + var/dbflags = client.prefs.db_flags + if(dbflags & DB_FLAG_AGE_CONFIRMATION_INCOMPLETE) //they have not completed age verification + var/age_verification = alert(src, "You must be 18+ to enter this server. Please confirm your age.",, "I am 18+", "I am not 18+") + if(age_verification != "I am 18+") + create_message("note", ckey, "Server - Automated Age Verification", "Failed age verification.", null, null, TRUE, TRUE, null, "9999-01-01", "High") //log this occurence + qdel(client) //kick the user + return FALSE + else + //they claim to be of age, so allow them to continue and update their flags + client.update_flag_db(DB_FLAG_AGE_CONFIRMATION_COMPLETE, TRUE) + client.update_flag_db(DB_FLAG_AGE_CONFIRMATION_INCOMPLETE, FALSE) + //log this + message_admins("[ckey] has joined through the automated age verification process.") + return TRUE + return TRUE + /mob/dead/new_player/Topic(href, href_list[]) if(src != usr) return 0 @@ -105,6 +107,9 @@ if(!client) return 0 + if(!age_verify()) + return + //Determines Relevent Population Cap var/relevant_cap var/hpc = CONFIG_GET(number/hard_popcap) From 5eaac21127939976e6b39a98e8b3256304474ea3 Mon Sep 17 00:00:00 2001 From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com> Date: Sat, 7 Nov 2020 19:44:06 +0000 Subject: [PATCH 7/8] okay --- code/modules/mob/dead/new_player/new_player.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index 7a3bfbf988..3296885bb6 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -86,8 +86,8 @@ else var/dbflags = client.prefs.db_flags if(dbflags & DB_FLAG_AGE_CONFIRMATION_INCOMPLETE) //they have not completed age verification - var/age_verification = alert(src, "You must be 18+ to enter this server. Please confirm your age.",, "I am 18+", "I am not 18+") - if(age_verification != "I am 18+") + var/age_verification = askuser(src, "Age Verification", "I am 18+", "I am not 18+", null, TRUE, null) + if(age_verification != "1") create_message("note", ckey, "Server - Automated Age Verification", "Failed age verification.", null, null, TRUE, TRUE, null, "9999-01-01", "High") //log this occurence qdel(client) //kick the user return FALSE From 29f1132d36d962d272793f83692051f3439b08f4 Mon Sep 17 00:00:00 2001 From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com> Date: Sun, 8 Nov 2020 02:25:53 +0000 Subject: [PATCH 8/8] Update new_player.dm --- code/modules/mob/dead/new_player/new_player.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index 3296885bb6..28b7bbbe09 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -86,7 +86,7 @@ else var/dbflags = client.prefs.db_flags if(dbflags & DB_FLAG_AGE_CONFIRMATION_INCOMPLETE) //they have not completed age verification - var/age_verification = askuser(src, "Age Verification", "I am 18+", "I am not 18+", null, TRUE, null) + var/age_verification = askuser(src, "Are you 18+", "Age Verification", "I am 18+", "I am not 18+", null, TRUE, null) if(age_verification != "1") create_message("note", ckey, "Server - Automated Age Verification", "Failed age verification.", null, null, TRUE, TRUE, null, "9999-01-01", "High") //log this occurence qdel(client) //kick the user