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:
committed by
GitHub
parent
8a33e0a9bd
commit
66c8a68891
@@ -22,6 +22,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -144,7 +145,7 @@ namespace Content.Server.GameObjects.Components.Medical
|
||||
UserInterface?.Open(actor.playerSession);
|
||||
}
|
||||
|
||||
private async void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
|
||||
private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
|
||||
{
|
||||
if (!(obj.Message is CloningPodUiButtonPressedMessage message)) return;
|
||||
|
||||
@@ -167,11 +168,10 @@ namespace Content.Server.GameObjects.Components.Medical
|
||||
|
||||
|
||||
var mob = _entityManager.SpawnEntity("HumanMob_Content", Owner.Transform.MapPosition);
|
||||
var client = _playerManager
|
||||
.GetPlayersBy(x => x.SessionId == mind.SessionId).First();
|
||||
mob.GetComponent<HumanoidAppearanceComponent>()
|
||||
.UpdateFromProfile(GetPlayerProfileAsync(client.Name).Result);
|
||||
mob.Name = GetPlayerProfileAsync(client.Name).Result.Name;
|
||||
var client = _playerManager.GetSessionByUserId(mind.UserId!.Value);
|
||||
var profile = GetPlayerProfileAsync(client.UserId);
|
||||
mob.GetComponent<HumanoidAppearanceComponent>().UpdateFromProfile(profile);
|
||||
mob.Name = profile.Name;
|
||||
|
||||
_bodyContainer.Insert(mob);
|
||||
_capturedMind = mind;
|
||||
@@ -209,10 +209,9 @@ namespace Content.Server.GameObjects.Components.Medical
|
||||
}
|
||||
|
||||
|
||||
private async Task<HumanoidCharacterProfile> GetPlayerProfileAsync(string username)
|
||||
private HumanoidCharacterProfile GetPlayerProfileAsync(NetUserId userId)
|
||||
{
|
||||
return (HumanoidCharacterProfile) (await _prefsManager.GetPreferencesAsync(username))
|
||||
.SelectedCharacter;
|
||||
return (HumanoidCharacterProfile) _prefsManager.GetPreferences(userId).SelectedCharacter;
|
||||
}
|
||||
|
||||
private void HandleGhostReturn(GhostComponent.GhostReturnMessage message)
|
||||
|
||||
@@ -16,16 +16,16 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
public class SignalLinkerSystem : EntitySystem
|
||||
{
|
||||
private Dictionary<NetSessionId, SignalTransmitterComponent> _transmitters;
|
||||
private Dictionary<NetUserId, SignalTransmitterComponent> _transmitters;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
_transmitters = new Dictionary<NetSessionId, SignalTransmitterComponent>();
|
||||
_transmitters = new Dictionary<NetUserId, SignalTransmitterComponent>();
|
||||
}
|
||||
|
||||
public void SignalLinkerKeybind(NetSessionId id, bool? enable)
|
||||
public void SignalLinkerKeybind(NetUserId id, bool? enable)
|
||||
{
|
||||
if (enable == null)
|
||||
{
|
||||
@@ -66,7 +66,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
|
||||
private bool HandleUse(ICommonSession session, EntityCoordinates coords, EntityUid uid)
|
||||
{
|
||||
if (!_transmitters.TryGetValue(session.SessionId, out var signalTransmitter))
|
||||
if (!_transmitters.TryGetValue(session.UserId, out var signalTransmitter))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
|
||||
if (entity.TryGetComponent<SignalTransmitterComponent>(out var transmitter))
|
||||
{
|
||||
_transmitters[session.SessionId] = transmitter.GetSignal(session.AttachedEntity);
|
||||
_transmitters[session.UserId] = transmitter.GetSignal(session.AttachedEntity);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
return;
|
||||
}
|
||||
|
||||
system.SignalLinkerKeybind(player.SessionId, enable);
|
||||
system.SignalLinkerKeybind(player.UserId, enable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user