Skip to content

Commit

Permalink
Holy crap auth works (#2099)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
PJB3005 authored Sep 29, 2020
1 parent 8a33e0a commit 66c8a68
Show file tree
Hide file tree
Showing 72 changed files with 4,140 additions and 2,638 deletions.
4 changes: 2 additions & 2 deletions Content.Client/GameTicking/ClientGameTicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class ClientGameTicker : SharedGameTicker, IClientGameTicker
[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;
Expand All @@ -52,7 +52,7 @@ public void Initialize()
});
_netManager.RegisterNetMessage<MsgTickerLateJoinStatus>(nameof(MsgTickerLateJoinStatus), LateJoinStatus);

Status = new Dictionary<NetSessionId, PlayerStatus>();
Status = new Dictionary<NetUserId, PlayerStatus>();
_initialized = true;
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Interfaces/IClientGameTicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface IClientGameTicker
bool DisallowedLateJoin { get; }
DateTime StartTime { get; }
bool Paused { get; }
Dictionary<NetSessionId, PlayerStatus> Status { get; }
Dictionary<NetUserId, PlayerStatus> Status { get; }

void Initialize();
event Action InfoBlobUpdated;
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/State/LobbyState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ private void UpdatePlayerList()
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
{
Expand Down
15 changes: 11 additions & 4 deletions Content.Client/UserInterface/HumanoidProfileEditor.Random.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -51,9 +53,9 @@ private void RandomizeAppearance()

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
Expand All @@ -62,6 +64,11 @@ private void RandomizeAppearance()
.WithHairColor(newHairColor)
.WithFacialHairColor(newHairColor));
UpdateHairPickers();

float RandomizeColor(float channel)
{
return MathHelper.Clamp01(channel + _random.Next(-25, 25) / 100f);
}
}
}
}
6 changes: 3 additions & 3 deletions Content.IntegrationTests/Tests/MindEntityDeletionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public async Task TestDeleteVisiting()
playerEnt = entMgr.SpawnEntity(null, MapCoordinates.Nullspace);
visitEnt = entMgr.SpawnEntity(null, MapCoordinates.Nullspace);

mind = new Mind(player.SessionId);
mind = new Mind(player.UserId);
player.ContentData().Mind = mind;

mind.TransferTo(playerEnt);
Expand Down Expand Up @@ -81,7 +81,7 @@ public async Task TestGhostOnDelete()

playerEnt = entMgr.SpawnEntity(null, MapCoordinates.Nullspace);

mind = new Mind(player.SessionId);
mind = new Mind(player.UserId);
player.ContentData().Mind = mind;

mind.TransferTo(playerEnt);
Expand Down Expand Up @@ -130,7 +130,7 @@ public async Task TestGhostOnDeleteMap()

playerEnt = entMgr.SpawnEntity(null, grid.ToCoordinates());

mind = new Mind(player.SessionId);
mind = new Mind(player.UserId);
player.ContentData().Mind = mind;

mind.TransferTo(playerEnt);
Expand Down
85 changes: 0 additions & 85 deletions Content.Server.Database/Configuration.cs

This file was deleted.

5 changes: 5 additions & 0 deletions Content.Server.Database/Content.Server.Database.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.4" />
</ItemGroup>

<ItemGroup>
<Folder Include="Migrations\Postgres" />
<Folder Include="Migrations\Sqlite" />
</ItemGroup>

</Project>

This file was deleted.

Loading

0 comments on commit 66c8a68

Please sign in to comment.