Skip to content

Age Gate#399

Open
0x6273 wants to merge 12 commits intoCitadel-Station-13:take2from
0x6273:agegate
Open

Age Gate#399
0x6273 wants to merge 12 commits intoCitadel-Station-13:take2from
0x6273:agegate

Conversation

@0x6273
Copy link
Contributor

@0x6273 0x6273 commented Sep 28, 2025

TODO

  • Integration tests need fixing. (Fixed in c9040da)
  • The texts in the UI and ban message could probably be improved I think.
  • Write integration tests for passing age gate and rules, and for getting banned by the age gate.
  • Merge upstream into take2 and rebase this again once upstream updates its engine (needed for DateOnly)

About the PR

Adds an age gate, requiring players to enter their date of birth before being let into the server.

Why / Balance

To deter minors from playing on 18+ server. It won't stop all minors, but I think if it stops even a single one, it will be worth the slight inconvenience of people having to enter their DoB once before joining.

Technical details

  • Add a PreJoinManager that performs actions before a player has joined the game. It's similar to what's described in Login flow (+ Agegate) #390, but no prototypes and instead a cvar list of actions to perform in order (right now just Rules and AgeGate).
  • Change RulesManager to make use of the PreJoinManager. It's no longer technically possible to join the game without having accepted the rules.
  • Add the age gate, consisting of a manager, UI and UI controller, network messages, and a change to the Player DB model to add a boolean if the player has passed the age gate.
  • Fix a bug that caused an exception to be thrown on the server if the client disconnects just after connecting, before joining the game.

Media

image

Requirements

@0x6273
Copy link
Contributor Author

0x6273 commented Sep 28, 2025

Test fail isn't my fault, it's because pyyaml made a breaking change in a patch version...

It's fixed upstream space-wizards/RobustToolbox@c8db7f9...784a02c

...actually the failing integration tests are my fault, gonna have to figure out what to do about those.

Fix an issue where if a client disconnects right after connecting, before
UserDbDataManager has had time to load the user data, it would throw an
exception.
Add a manager that is responsible for making the player join the game
after connecting. It checks if there are any "prejoin actions" that need
to be performed first, such as presenting the player with a rules popup
or age gate.
Add an age gate popup that requires the player to enter their date of
birth, checking that they are 18+ before letting them in.

This adds a boolean to the Player DB model, so running the EF Core
migrations script is required after applying the patch.
Copy link
Contributor

@moonheart08 moonheart08 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these new files need to go into _Citadel folders (with explicit MIT header) or your own folder (without it, if you want) if possible please.

AcceptButton.OnPressed += OnAcceptButtonPressed;
QuitButton.OnPressed += OnQuitButtonPressed;

DobMonthOptionButton.AddItem(Loc.GetString("datepicker-month"), 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this entire DoB selector needs to be leapyear aware (yeaaaa i knowwwww.... time is a pain.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the issue with leapyears? I'm using DateTime which should be leapyear aware.

@0x6273
Copy link
Contributor Author

0x6273 commented Sep 30, 2025

All of these new files need to go into _Citadel folders (with explicit MIT header) or your own folder (without it, if you want) if possible please.

Yeah I think its own folder would be best. If every server that uses the age gate puts it in their specific folder it would make it difficult to share patches.

@0x6273
Copy link
Contributor Author

0x6273 commented Oct 2, 2025

All of these new files need to go into _Citadel folders (with explicit MIT header) or your own folder (without it, if you want) if possible please.

I skipped the DatePicker since that should be upstreamed, but everything else has been moved to a _Common folder/namespace.

- Now uses `DateOnly` (currently fails sandbox, but PJB has promised to add
it in engine)
- Add MinDate and MaxDate fields
- Use constructor instead of parsing date string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants