From e0d2b72cb96dc8d04ac117e89e8d4a2f15def182 Mon Sep 17 00:00:00 2001 From: SleepyScarecrow <136123749+SleepyScarecrow@users.noreply.github.com> Date: Tue, 10 Sep 2024 12:14:48 -0400 Subject: [PATCH 1/5] Changed Text and fixed interaction --- Content.Server/Medical/PenLightSystem.cs | 22 ++++++++++++------- .../en-US/medical/components/penlight.ftl | 4 ++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Content.Server/Medical/PenLightSystem.cs b/Content.Server/Medical/PenLightSystem.cs index f48a84d0476..43829d409ea 100644 --- a/Content.Server/Medical/PenLightSystem.cs +++ b/Content.Server/Medical/PenLightSystem.cs @@ -7,6 +7,7 @@ using Content.Shared.Eye.Blinding.Components; using Content.Shared.Interaction; using Content.Shared.Medical; +using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Systems; using Content.Shared.Traits.Assorted.Components; using Robust.Server.GameObjects; @@ -30,20 +31,21 @@ public override void Initialize() SubscribeLocalEvent(OnDoAfter); } - private void OnAfterInteract(EntityUid uid, PenLightComponent component, AfterInteractEvent args) + private void OnAfterInteract(EntityUid uid, PenLightComponent component, ref AfterInteractEvent args) { - if (args.Handled - || args.Target is not { } target) + if (args.Handled + || args.Target is not {} target) + return; + if (target == null || !args.CanReach || !HasComp(target) || !_powerCell.HasDrawCharge(uid, user: args.User)) return; - args.Handled = TryStartExam(uid, target, args.User, component); } private void OnDoAfter(Entity uid, ref PenLightDoAfterEvent args) { - if (args.Handled - || args.Cancelled - || args.Target == null + if (args.Handled + || args.Cancelled + || args.Target == null || !_powerCell.HasDrawCharge(uid, user: args.User)) return; @@ -73,7 +75,7 @@ public bool TryStartExam(EntityUid uid, EntityUid target, EntityUid user, PenLig } private void OpenUserInterface(EntityUid user, EntityUid penlight) { - if (!TryComp(user, out var actor) + if (!TryComp(user, out var actor) || !_uiSystem.TryGetUi(penlight, PenLightUiKey.Key, out var ui)) return; @@ -88,6 +90,10 @@ private void Diagnose(EntityUid penlight, EntityUid target) if (!_uiSystem.TryGetUi(penlight, PenLightUiKey.Key, out var ui) || !HasComp(target)) return; + + if (!HasComp(target)) + return; + // Blind var blind = _entityManager.HasComponent(target); diff --git a/Resources/Locale/en-US/medical/components/penlight.ftl b/Resources/Locale/en-US/medical/components/penlight.ftl index f0639ad7381..103c4a29478 100644 --- a/Resources/Locale/en-US/medical/components/penlight.ftl +++ b/Resources/Locale/en-US/medical/components/penlight.ftl @@ -5,7 +5,7 @@ pen-light-window-no-patient-data-text = No patient data. pen-light-window-entity-unknown-text = unknown pen-light-exam-blind-text = The patient's eyes are glassy and unfocused. They can't follow the light at all. -pen-light-exam-drunk-text = The patient's eyes are slow to follow the light, droopy. -pen-light-exam-eyedamage-text = The patient's eyes are partially focused, though they struggle to look at the light for too long. +pen-light-exam-drunk-text = There's a clear delay between moving the light and the patient's eyes following. +pen-light-exam-eyedamage-text = The patient's eyes have dark spots within the pupil, evident when the light is shone in them. pen-light-exam-hallucinating-text = The patient's eyes are wandering around, with dilated pupils. They don't focus on the light. pen-light-exam-healthy-text = The patient follows the light perfectly with no stuttering. \ No newline at end of file From 24fd446f200ee93b52e4b58f13574c4af1fb5d1c Mon Sep 17 00:00:00 2001 From: SleepyScarecrow <136123749+SleepyScarecrow@users.noreply.github.com> Date: Tue, 10 Sep 2024 12:54:10 -0400 Subject: [PATCH 2/5] made it so the light needs to be on --- Content.Server/Medical/PenLightSystem.cs | 18 +++++++++++++++++- Content.Shared/Medical/PenLightComponent.cs | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Content.Server/Medical/PenLightSystem.cs b/Content.Server/Medical/PenLightSystem.cs index 43829d409ea..ed6deb40c19 100644 --- a/Content.Server/Medical/PenLightSystem.cs +++ b/Content.Server/Medical/PenLightSystem.cs @@ -1,4 +1,5 @@ using Content.Server.DoAfter; +using Content.Server.Popups; using Content.Server.PowerCell; using Content.Shared.Damage; using Content.Shared.DoAfter; @@ -23,7 +24,9 @@ public sealed class PenLightSystem : EntitySystem [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly DoAfterSystem _doAfter = default!; [Dependency] private readonly PowerCellSystem _powerCell = default!; + [Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; + /// public override void Initialize() { @@ -54,7 +57,13 @@ private void OnDoAfter(Entity uid, ref PenLightDoAfterEvent a args.Handled = true; } - + /// + /// Checks if the PointLight component is enabled. + /// + private bool IsLightEnabled(EntityUid uid) + { + return TryComp(uid, out var pointLight) && pointLight.Enabled; + } /// /// Actually handles the exam interaction. /// @@ -63,6 +72,13 @@ public bool TryStartExam(EntityUid uid, EntityUid target, EntityUid user, PenLig if (!Resolve(uid, ref component)) return false; + if (!IsLightEnabled(uid)) + { + if (user != null) + _popup.PopupEntity(Loc.GetString("penlight-off"), uid, user); + return false; + } + return _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, component.ExamSpeed, new PenLightDoAfterEvent(), uid, target, uid) { diff --git a/Content.Shared/Medical/PenLightComponent.cs b/Content.Shared/Medical/PenLightComponent.cs index 50dacae3dc8..770e8af7e9e 100644 --- a/Content.Shared/Medical/PenLightComponent.cs +++ b/Content.Shared/Medical/PenLightComponent.cs @@ -9,6 +9,7 @@ namespace Content.Shared.Medical; [RegisterComponent, NetworkedComponent, AutoGenerateComponentPause] public sealed partial class PenLightComponent : Component { + /// /// Cooldown Time, exams take a bit /// From d1296e7db8e14a598e2b387f9ff10fcb04a0ff86 Mon Sep 17 00:00:00 2001 From: SleepyScarecrow <136123749+SleepyScarecrow@users.noreply.github.com> Date: Tue, 10 Sep 2024 13:01:49 -0400 Subject: [PATCH 3/5] can't examine your own eyes --- Content.Server/Medical/PenLightSystem.cs | 22 ++++++++++++------- .../en-US/medical/components/penlight.ftl | 1 + 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Content.Server/Medical/PenLightSystem.cs b/Content.Server/Medical/PenLightSystem.cs index ed6deb40c19..ce0401a92ae 100644 --- a/Content.Server/Medical/PenLightSystem.cs +++ b/Content.Server/Medical/PenLightSystem.cs @@ -57,13 +57,14 @@ private void OnDoAfter(Entity uid, ref PenLightDoAfterEvent a args.Handled = true; } - /// - /// Checks if the PointLight component is enabled. - /// - private bool IsLightEnabled(EntityUid uid) - { - return TryComp(uid, out var pointLight) && pointLight.Enabled; - } + /// + /// Checks if the PointLight component is enabled. + /// + private bool IsLightEnabled(EntityUid uid) + { + return TryComp(uid, out var pointLight) && pointLight.Enabled; + } + /// /// Actually handles the exam interaction. /// @@ -78,7 +79,12 @@ public bool TryStartExam(EntityUid uid, EntityUid target, EntityUid user, PenLig _popup.PopupEntity(Loc.GetString("penlight-off"), uid, user); return false; } - + // can't examine your own eyes, dingus + if (user == target) + { + _popup.PopupEntity(Loc.GetString("penlight-cannot-examine-self"), uid, user); + return false; + } return _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, component.ExamSpeed, new PenLightDoAfterEvent(), uid, target, uid) { diff --git a/Resources/Locale/en-US/medical/components/penlight.ftl b/Resources/Locale/en-US/medical/components/penlight.ftl index 103c4a29478..c8a5d66f5d5 100644 --- a/Resources/Locale/en-US/medical/components/penlight.ftl +++ b/Resources/Locale/en-US/medical/components/penlight.ftl @@ -1,4 +1,5 @@ penlight-off = The pen light is off. +penlight-cannot-examine-self = You cannot examine your own eyes. pen-light-exam-title = Pen Light pen-light-window-entity-eyes-text = {$entityName}'s conditions: pen-light-window-no-patient-data-text = No patient data. From a48a605bc98ee76eeba1182a210e34764c97bbb5 Mon Sep 17 00:00:00 2001 From: SleepyScarecrow <136123749+SleepyScarecrow@users.noreply.github.com> Date: Wed, 11 Sep 2024 13:57:49 -0400 Subject: [PATCH 4/5] Update Content.Server/Medical/PenLightSystem.cs Co-authored-by: VMSolidus Signed-off-by: SleepyScarecrow <136123749+SleepyScarecrow@users.noreply.github.com> --- Content.Server/Medical/PenLightSystem.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Content.Server/Medical/PenLightSystem.cs b/Content.Server/Medical/PenLightSystem.cs index ce0401a92ae..8a9b05bfb79 100644 --- a/Content.Server/Medical/PenLightSystem.cs +++ b/Content.Server/Medical/PenLightSystem.cs @@ -37,9 +37,11 @@ public override void Initialize() private void OnAfterInteract(EntityUid uid, PenLightComponent component, ref AfterInteractEvent args) { if (args.Handled - || args.Target is not {} target) - return; - if (target == null || !args.CanReach || !HasComp(target) || !_powerCell.HasDrawCharge(uid, user: args.User)) + || args.Target is not {} target + || target == null + || !args.CanReach + || !HasComp(target) + || !_powerCell.HasDrawCharge(uid, user: args.User)) return; args.Handled = TryStartExam(uid, target, args.User, component); } From 26c02e5eefdf9aeb5a011e66f5394ce8977bc08e Mon Sep 17 00:00:00 2001 From: SleepyScarecrow <136123749+SleepyScarecrow@users.noreply.github.com> Date: Wed, 11 Sep 2024 13:58:00 -0400 Subject: [PATCH 5/5] Update Content.Server/Medical/PenLightSystem.cs Co-authored-by: VMSolidus Signed-off-by: SleepyScarecrow <136123749+SleepyScarecrow@users.noreply.github.com> --- Content.Server/Medical/PenLightSystem.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Content.Server/Medical/PenLightSystem.cs b/Content.Server/Medical/PenLightSystem.cs index 8a9b05bfb79..0e0f22684a7 100644 --- a/Content.Server/Medical/PenLightSystem.cs +++ b/Content.Server/Medical/PenLightSystem.cs @@ -112,10 +112,8 @@ private void OpenUserInterface(EntityUid user, EntityUid penlight) private void Diagnose(EntityUid penlight, EntityUid target) { if (!_uiSystem.TryGetUi(penlight, PenLightUiKey.Key, out var ui) - || !HasComp(target)) - return; - - if (!HasComp(target)) + || !HasComp(target) + || !HasComp(target)) return; // Blind