Holy crap auth works (#2099)

* Holy crap auth works

* Fix some usages of UserID instead of UserName

* Refactor preferences.

They be non-async now. Also faster.

* Rename DbContext.

* Guest username assignment.

* Fix saving of profiles.

* Don't store data for guests.

* Fix generating invalid random colors.

* Don't allow dumb garbage for char preferences.

* Bans.

* Lol forgot to fill out the command description.

* Connection log.

* Rename all the tables and columns to be snake_case.

* Re-do migrations.

* Fixing tests and warnings.

* Update submodule
This commit is contained in:
Pieter-Jan Briers
2020-09-29 14:26:00 +02:00
committed by GitHub
parent 8a33e0a9bd
commit 66c8a68891
72 changed files with 4144 additions and 2642 deletions

View File

@@ -28,7 +28,7 @@ namespace Content.Client.GameTicking
[ViewVariables] public string ServerInfoBlob { get; private set; }
[ViewVariables] public DateTime StartTime { get; private set; }
[ViewVariables] public bool Paused { get; private set; }
[ViewVariables] public Dictionary<NetSessionId, PlayerStatus> Status { get; private set; }
[ViewVariables] public Dictionary<NetUserId, PlayerStatus> Status { get; private set; }
public event Action InfoBlobUpdated;
public event Action LobbyStatusUpdated;
@@ -52,7 +52,7 @@ namespace Content.Client.GameTicking
});
_netManager.RegisterNetMessage<MsgTickerLateJoinStatus>(nameof(MsgTickerLateJoinStatus), LateJoinStatus);
Status = new Dictionary<NetSessionId, PlayerStatus>();
Status = new Dictionary<NetUserId, PlayerStatus>();
_initialized = true;
}

View File

@@ -13,7 +13,7 @@ namespace Content.Client.Interfaces
bool DisallowedLateJoin { get; }
DateTime StartTime { get; }
bool Paused { get; }
Dictionary<NetSessionId, PlayerStatus> Status { get; }
Dictionary<NetUserId, PlayerStatus> Status { get; }
void Initialize();
event Action InfoBlobUpdated;

View File

@@ -220,10 +220,10 @@ namespace Content.Client.State
if (!_clientGameTicker.IsGameStarted)
{
var status = PlayerStatus.NotReady;
if (session.SessionId == _playerManager.LocalPlayer.SessionId)
if (session.UserId == _playerManager.LocalPlayer.UserId)
status = _clientGameTicker.AreWeReady ? PlayerStatus.Ready : PlayerStatus.NotReady;
else
_clientGameTicker.Status.TryGetValue(session.SessionId, out status);
_clientGameTicker.Status.TryGetValue(session.UserId, out status);
readyState = status switch
{

View File

@@ -1,8 +1,10 @@
using System.Linq;
using System;
using System.Linq;
using Content.Shared.Preferences;
using Content.Shared.Preferences.Appearance;
using Content.Shared.Text;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.Maths;
using Robust.Shared.Random;
namespace Content.Client.UserInterface
@@ -51,9 +53,9 @@ namespace Content.Client.UserInterface
var newHairColor = _random.Pick(HairStyles.RealisticHairColors);
newHairColor = newHairColor
.WithRed(newHairColor.R + _random.Next(-25, 25) / 100f)
.WithGreen(newHairColor.G + _random.Next(-25, 25) / 100f)
.WithBlue(newHairColor.B + _random.Next(-25, 25) / 100f);
.WithRed(RandomizeColor(newHairColor.R))
.WithGreen(RandomizeColor(newHairColor.G))
.WithBlue(RandomizeColor(newHairColor.B));
Profile = Profile.WithCharacterAppearance(
Profile.Appearance
@@ -62,6 +64,11 @@ namespace Content.Client.UserInterface
.WithHairColor(newHairColor)
.WithFacialHairColor(newHairColor));
UpdateHairPickers();
float RandomizeColor(float channel)
{
return MathHelper.Clamp01(channel + _random.Next(-25, 25) / 100f);
}
}
}
}