@@ -26,6 +26,7 @@ public abstract partial class SharedMindSystem : EntitySystem
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
[Dependency] private readonly SharedObjectivesSystem _objectives = default!;
|
||||
[Dependency] private readonly SharedPlayerSystem _player = default!;
|
||||
[Dependency] private readonly ISharedPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metadata = default!;
|
||||
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!;
|
||||
|
||||
@@ -153,23 +154,31 @@ public abstract partial class SharedMindSystem : EntitySystem
|
||||
if (!mindContainer.ShowExamineInfo || !args.IsInDetailsRange)
|
||||
return;
|
||||
|
||||
// TODO predict we can't right now because session stuff isnt networked
|
||||
// TODO: Move this out of the SharedMindSystem into its own comp and predict it
|
||||
if (_net.IsClient)
|
||||
return;
|
||||
|
||||
var dead = _mobState.IsDead(uid);
|
||||
var hasUserId = CompOrNull<MindComponent>(mindContainer.Mind)?.UserId;
|
||||
var hasSession = CompOrNull<MindComponent>(mindContainer.Mind)?.Session;
|
||||
var mind = CompOrNull<MindComponent>(mindContainer.Mind);
|
||||
var hasUserId = mind?.UserId;
|
||||
var hasActiveSession = hasUserId != null && _playerManager.ValidSessionId(hasUserId.Value);
|
||||
|
||||
// Scenarios:
|
||||
// 1. Dead + No User ID: Entity is permanently dead with no player ever attached
|
||||
// 2. Dead + Has User ID + No Session: Player died and disconnected
|
||||
// 3. Dead + Has Session: Player is dead but still connected
|
||||
// 4. Alive + No User ID: Entity was never controlled by a player
|
||||
// 5. Alive + No Session: Player disconnected while alive (SSD)
|
||||
|
||||
if (dead && hasUserId == null)
|
||||
args.PushMarkup($"[color=mediumpurple]{Loc.GetString("comp-mind-examined-dead-and-irrecoverable", ("ent", uid))}[/color]");
|
||||
else if (dead && hasSession == null)
|
||||
else if (dead && !hasActiveSession)
|
||||
args.PushMarkup($"[color=yellow]{Loc.GetString("comp-mind-examined-dead-and-ssd", ("ent", uid))}[/color]");
|
||||
else if (dead)
|
||||
args.PushMarkup($"[color=red]{Loc.GetString("comp-mind-examined-dead", ("ent", uid))}[/color]");
|
||||
else if (hasUserId == null)
|
||||
args.PushMarkup($"[color=mediumpurple]{Loc.GetString("comp-mind-examined-catatonic", ("ent", uid))}[/color]");
|
||||
else if (hasSession == null)
|
||||
else if (!hasActiveSession)
|
||||
args.PushMarkup($"[color=yellow]{Loc.GetString("comp-mind-examined-ssd", ("ent", uid))}[/color]");
|
||||
}
|
||||
|
||||
@@ -460,12 +469,6 @@ public abstract partial class SharedMindSystem : EntitySystem
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetSession(EntityUid? mindId, [NotNullWhen(true)] out ICommonSession? session)
|
||||
{
|
||||
session = null;
|
||||
return TryComp(mindId, out MindComponent? mind) && (session = mind.Session) != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a mind from uid and/or MindContainerComponent. Used for null checks.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user