Skip to content

Commit

Permalink
Ui system update
Browse files Browse the repository at this point in the history
  • Loading branch information
SleepyScarecrow committed Oct 25, 2024
1 parent 85a770c commit 74f91bd
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Content.Server/Medical/PenLightSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,18 @@ public bool TryStartExam(EntityUid uid, EntityUid target, EntityUid user, PenLig
}
private void OpenUserInterface(EntityUid user, EntityUid penlight)
{
if (!TryComp<ActorComponent>(user, out var actor)
|| !_uiSystem.TryGetOpenUi(penlight, PenLightUiKey.Key, out var ui))
if (!_uiSystem.HasUi(penlight, PenLightUiKey.Key))
return;

_uiSystem.OpenUi(ui.Owner, ui.UiKey, actor.PlayerSession);
_uiSystem.OpenUi(penlight, PenLightUiKey.Key, user);
}

/// <summary>
/// Runs the checks for the different types of eye damage
/// </summary>
private void Diagnose(EntityUid penlight, EntityUid target)
{
if (!_uiSystem.TryGetOpenUi(penlight, PenLightUiKey.Key, out var ui)
if (!_uiSystem.HasUi(penlight, PenLightUiKey.Key)
|| !HasComp<EyeComponent>(target)
|| !HasComp<DamageableComponent>(target))
return;
Expand All @@ -136,8 +135,8 @@ private void Diagnose(EntityUid penlight, EntityUid target)
var healthy = !(blind || drunk || eyeDamage || seeingRainbows);

_uiSystem.ServerSendUiMessage(
ui.Owner,
ui.UiKey,
penlight,
PenLightUiKey.Key,
new PenLightUserMessage(GetNetEntity(target),
blind,
drunk,
Expand Down

0 comments on commit 74f91bd

Please sign in to comment.