From d3ad0928693f19e373dee0ea09f377656e3cacc8 Mon Sep 17 00:00:00 2001
From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com>
Date: Tue, 8 Dec 2020 22:23:58 +0000
Subject: [PATCH 1/6] new proc
---
.../modules/mob/dead/new_player/new_player.dm | 22 ++++++++++++++++++-
1 file changed, 21 insertions(+), 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 91123c0c7f..a9be76494b 100644
--- a/code/modules/mob/dead/new_player/new_player.dm
+++ b/code/modules/mob/dead/new_player/new_player.dm
@@ -78,6 +78,26 @@
popup.set_content(output)
popup.open(FALSE)
+/proc/age_gate(/mob/dead/new_player/plr)
+ var/list/dat = list("
")
+ dat += "Enter your date of birth here, to confirm that you are over 18. "
+ dat += "Your date of birth is not saved, only the fact that you are over/under 18 is. "
+ dat += " "
+
+ dat += " "
+
+ output += " "
+
+ plr << browse(dat,"window=playerpoll;size=500x250")
+
/mob/dead/new_player/proc/age_verify()
if(CONFIG_GET(flag/age_verification) && !check_rights_for(client, R_ADMIN) && !(client.ckey in GLOB.bunker_passthrough)) //make sure they are verified
if(!client.set_db_player_flags())
@@ -86,7 +106,7 @@
else
var/dbflags = client.prefs.db_flags
if(dbflags & DB_FLAG_AGE_CONFIRMATION_INCOMPLETE) //they have not completed age gate
- var/age_verification = askuser(src, "Are you 18+", "Age Gate", "I am 18+", "I am not 18+", null, TRUE, null)
+ var/age_verification = age_gate(src)
if(age_verification != 1)
client.add_system_note("Automated-Age-Gate", "Failed automatic age gate process")
qdel(client) //kick the user
From 264b72f91d9c4da2f176a5ef17603b8115b3e025 Mon Sep 17 00:00:00 2001
From: timothyteakettle <59849408+timothyteakettle@users.noreply.github.com>
Date: Wed, 9 Dec 2020 02:01:37 +0000
Subject: [PATCH 2/6] better verification
---
.../modules/mob/dead/new_player/new_player.dm | 77 ++++++++++++++++---
1 file changed, 68 insertions(+), 9 deletions(-)
diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm
index a9be76494b..2fdbf01382 100644
--- a/code/modules/mob/dead/new_player/new_player.dm
+++ b/code/modules/mob/dead/new_player/new_player.dm
@@ -16,6 +16,9 @@
//Used to make sure someone doesn't get spammed with messages if they're ineligible for roles
var/ineligible_for_roles = FALSE
+ //is there a result we want to read from the age gate
+ var/age_gate_result
+
/mob/dead/new_player/Initialize()
if(client && SSticker.state == GAME_STATE_STARTUP)
var/obj/screen/splash/S = new(client, TRUE, TRUE)
@@ -78,25 +81,42 @@
popup.set_content(output)
popup.open(FALSE)
-/proc/age_gate(/mob/dead/new_player/plr)
+/mob/dead/new_player/proc/age_gate()
var/list/dat = list("
")
dat += "Enter your date of birth here, to confirm that you are over 18. "
dat += "Your date of birth is not saved, only the fact that you are over/under 18 is. "
dat += " "
- dat += ""
- output += " "
+ winshow(src, "age_gate", TRUE)
+ var/datum/browser/popup = new(src, "age_gate", "
Age Gate
", 400, 250)
+ popup.set_content(dat.Join())
+ popup.open(FALSE)
+ onclose(src, "age_gate")
- plr << browse(dat,"window=playerpoll;size=500x250")
+ while(!age_gate_result)
+ stoplag(1)
+
+ popup.close()
+
+ return age_gate_result
/mob/dead/new_player/proc/age_verify()
if(CONFIG_GET(flag/age_verification) && !check_rights_for(client, R_ADMIN) && !(client.ckey in GLOB.bunker_passthrough)) //make sure they are verified
@@ -106,7 +126,7 @@
else
var/dbflags = client.prefs.db_flags
if(dbflags & DB_FLAG_AGE_CONFIRMATION_INCOMPLETE) //they have not completed age gate
- var/age_verification = age_gate(src)
+ var/age_verification = age_gate()
if(age_verification != 1)
client.add_system_note("Automated-Age-Gate", "Failed automatic age gate process")
qdel(client) //kick the user
@@ -127,6 +147,45 @@
if(!client)
return 0
+ if(href_list["Month"])
+ var/player_month = href_list["Month"]
+ var/player_year = href_list["Year"]
+
+ var/current_time = world.realtime
+ var/current_month = text2num(time2text(current_time, "MM"))
+ var/current_year = text2num(time2text(current_time, "YYYY"))
+
+ var/player_total_months = (player_year * 12) + player_month
+
+ var/current_total_months = (current_year * 12) + current_month
+
+ var/months_in_eighteen_years = 18 * 12
+
+ var/month_difference = player_total_months - current_total_months
+ if(month_difference > months_in_eighteen_years)
+ age_gate_result = TRUE // they're fine
+ else if(month_difference < months_in_eighteen_years)
+ age_gate_result = FALSE
+ else
+ //they could be 17 or 18 depending on the /day/ they were born in
+ var/current_day = text2num(time2text(current_time, "DD"))
+ var/days_in_months = list(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
+ if((player_year % 4) == 0) // leap year so february actually has 29 days
+ days_in_months[2] = 29
+ var/total_days_in_player_month = days_in_months[player_month]
+ var/list/days
+ for(var/number in 1 to total_days_in_player_month)
+ days += number
+ var/player_day = input(src, "What day of the month were you born in.", 1) in days
+ if(player_day <= current_day)
+ //their birthday has not passed
+ age_gate_result = FALSE
+ else
+ //it has been their 18th birthday this month
+ age_gate_result = TRUE
+ else
+ return
+
if(!age_verify())
return
From 73542f6688c9dc427159de3b026e6bb332b63bb2 Mon Sep 17 00:00:00 2001
From: timothyteakettle <59849408+timothyteakettle@users.noreply.github.com>
Date: Wed, 9 Dec 2020 17:49:52 +0000
Subject: [PATCH 3/6] Update new_player.dm
---
code/modules/mob/dead/new_player/new_player.dm | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm
index 2fdbf01382..d87391beda 100644
--- a/code/modules/mob/dead/new_player/new_player.dm
+++ b/code/modules/mob/dead/new_player/new_player.dm
@@ -91,7 +91,7 @@
dat += " "
dat += HrefTokenFormField()
dat += ""
- var/monthList = list("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
+ var/monthList = list("January" = 1, "February" = 2, "March" = 3, "April" = 4, "May" = 5, "June" = 6, "July" = 7, "August" = 8, "September" = 9, "October" = 10, "November" = 11, "December" = 12)
for(var/month in monthList)
dat += "[month] "
dat += " "
@@ -111,7 +111,7 @@
popup.open(FALSE)
onclose(src, "age_gate")
- while(!age_gate_result)
+ while(age_gate_result == null)
stoplag(1)
popup.close()
@@ -147,9 +147,11 @@
if(!client)
return 0
+ //don't let people get to this unless they are specifically not verified
+ //if(href_list["Month"] && (CONFIG_GET(flag/age_verification) && !check_rights_for(client, R_ADMIN) && !(client.ckey in GLOB.bunker_passthrough)))
if(href_list["Month"])
- var/player_month = href_list["Month"]
- var/player_year = href_list["Year"]
+ var/player_month = text2num(href_list["Month"])
+ var/player_year = text2num(href_list["Year"])
var/current_time = world.realtime
var/current_month = text2num(time2text(current_time, "MM"))
@@ -161,7 +163,7 @@
var/months_in_eighteen_years = 18 * 12
- var/month_difference = player_total_months - current_total_months
+ var/month_difference = current_total_months - player_total_months
if(month_difference > months_in_eighteen_years)
age_gate_result = TRUE // they're fine
else if(month_difference < months_in_eighteen_years)
@@ -183,8 +185,6 @@
else
//it has been their 18th birthday this month
age_gate_result = TRUE
- else
- return
if(!age_verify())
return
From 62b54309859675a75a46fdd249e6ac3af93a6459 Mon Sep 17 00:00:00 2001
From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com>
Date: Thu, 10 Dec 2020 21:53:20 +0000
Subject: [PATCH 4/6] yes
---
.../modules/mob/dead/new_player/new_player.dm | 36 ++++++++++---------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm
index d87391beda..4019f7f293 100644
--- a/code/modules/mob/dead/new_player/new_player.dm
+++ b/code/modules/mob/dead/new_player/new_player.dm
@@ -129,7 +129,8 @@
var/age_verification = age_gate()
if(age_verification != 1)
client.add_system_note("Automated-Age-Gate", "Failed automatic age gate process")
- qdel(client) //kick the user
+ //ban them and kick them
+ qdel(client)
return FALSE
else
//they claim to be of age, so allow them to continue and update their flags
@@ -166,25 +167,26 @@
var/month_difference = current_total_months - player_total_months
if(month_difference > months_in_eighteen_years)
age_gate_result = TRUE // they're fine
- else if(month_difference < months_in_eighteen_years)
- age_gate_result = FALSE
else
- //they could be 17 or 18 depending on the /day/ they were born in
- var/current_day = text2num(time2text(current_time, "DD"))
- var/days_in_months = list(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
- if((player_year % 4) == 0) // leap year so february actually has 29 days
- days_in_months[2] = 29
- var/total_days_in_player_month = days_in_months[player_month]
- var/list/days
- for(var/number in 1 to total_days_in_player_month)
- days += number
- var/player_day = input(src, "What day of the month were you born in.", 1) in days
- if(player_day <= current_day)
- //their birthday has not passed
+ if(month_difference < months_in_eighteen_years)
age_gate_result = FALSE
else
- //it has been their 18th birthday this month
- age_gate_result = TRUE
+ //they could be 17 or 18 depending on the /day/ they were born in
+ var/current_day = text2num(time2text(current_time, "DD"))
+ var/days_in_months = list(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
+ if((player_year % 4) == 0) // leap year so february actually has 29 days
+ days_in_months[2] = 29
+ var/total_days_in_player_month = days_in_months[player_month]
+ var/list/days
+ for(var/number in 1 to total_days_in_player_month)
+ days += number
+ var/player_day = input(src, "What day of the month were you born in.", 1) in days
+ if(player_day <= current_day)
+ //their birthday has not passed
+ age_gate_result = FALSE
+ else
+ //it has been their 18th birthday this month
+ age_gate_result = TRUE
if(!age_verify())
return
From d1003c206a1c9cf79716c102a8633535ea88c886 Mon Sep 17 00:00:00 2001
From: timothyteakettle <59849408+timothyteakettle@users.noreply.github.com>
Date: Fri, 11 Dec 2020 01:57:09 +0000
Subject: [PATCH 5/6] debug
---
code/modules/mob/dead/new_player/new_player.dm | 4 +++-
1 file changed, 3 insertions(+), 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 4019f7f293..f4cd5e0cfa 100644
--- a/code/modules/mob/dead/new_player/new_player.dm
+++ b/code/modules/mob/dead/new_player/new_player.dm
@@ -165,12 +165,14 @@
var/months_in_eighteen_years = 18 * 12
var/month_difference = current_total_months - player_total_months
+ message_admins("one: [month_difference] two: [months_in_eighteen_years]")
if(month_difference > months_in_eighteen_years)
age_gate_result = TRUE // they're fine
else
if(month_difference < months_in_eighteen_years)
age_gate_result = FALSE
else
+ message_admins("broken")
//they could be 17 or 18 depending on the /day/ they were born in
var/current_day = text2num(time2text(current_time, "DD"))
var/days_in_months = list(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
@@ -180,7 +182,7 @@
var/list/days
for(var/number in 1 to total_days_in_player_month)
days += number
- var/player_day = input(src, "What day of the month were you born in.", 1) in days
+ var/player_day = input(src, "What day of the month were you born in.") as anything in days
if(player_day <= current_day)
//their birthday has not passed
age_gate_result = FALSE
From 45b22b28551797520db9e52c5aab29cc70467e9d Mon Sep 17 00:00:00 2001
From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com>
Date: Fri, 11 Dec 2020 19:41:56 +0000
Subject: [PATCH 6/6] final touches
---
code/modules/mob/dead/new_player/new_player.dm | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm
index f4cd5e0cfa..35cf9f9440 100644
--- a/code/modules/mob/dead/new_player/new_player.dm
+++ b/code/modules/mob/dead/new_player/new_player.dm
@@ -130,6 +130,7 @@
if(age_verification != 1)
client.add_system_note("Automated-Age-Gate", "Failed automatic age gate process")
//ban them and kick them
+ AddBan(client.ckey, client.computer_id, "SYSTEM BAN - Inputted date during join verification was under 18 years of age. Contact administration on discord for verification.", "SYSTEM", FALSE, null, client.address)
qdel(client)
return FALSE
else
@@ -149,8 +150,7 @@
return 0
//don't let people get to this unless they are specifically not verified
- //if(href_list["Month"] && (CONFIG_GET(flag/age_verification) && !check_rights_for(client, R_ADMIN) && !(client.ckey in GLOB.bunker_passthrough)))
- if(href_list["Month"])
+ if(href_list["Month"] && (CONFIG_GET(flag/age_verification) && !check_rights_for(client, R_ADMIN) && !(client.ckey in GLOB.bunker_passthrough)))
var/player_month = text2num(href_list["Month"])
var/player_year = text2num(href_list["Year"])
@@ -165,30 +165,28 @@
var/months_in_eighteen_years = 18 * 12
var/month_difference = current_total_months - player_total_months
- message_admins("one: [month_difference] two: [months_in_eighteen_years]")
if(month_difference > months_in_eighteen_years)
age_gate_result = TRUE // they're fine
else
if(month_difference < months_in_eighteen_years)
age_gate_result = FALSE
else
- message_admins("broken")
//they could be 17 or 18 depending on the /day/ they were born in
var/current_day = text2num(time2text(current_time, "DD"))
var/days_in_months = list(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
if((player_year % 4) == 0) // leap year so february actually has 29 days
days_in_months[2] = 29
var/total_days_in_player_month = days_in_months[player_month]
- var/list/days
+ var/list/days = list()
for(var/number in 1 to total_days_in_player_month)
days += number
var/player_day = input(src, "What day of the month were you born in.") as anything in days
if(player_day <= current_day)
- //their birthday has not passed
- age_gate_result = FALSE
- else
- //it has been their 18th birthday this month
+ //their birthday has passed
age_gate_result = TRUE
+ else
+ //it has NOT been their 18th birthday yet
+ age_gate_result = FALSE
if(!age_verify())
return