Skip to content

Commit

Permalink
Add hotbar indicator to surgery cleanliness
Browse files Browse the repository at this point in the history
  • Loading branch information
sowelipililimute committed Feb 22, 2025
1 parent c21c268 commit b8f4071
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Content.Client/_DV/Surgery/SurgeryCleanSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Client.Items;
using Content.Shared._DV.Surgery;

namespace Content.Client._DV.Surgery;
Expand All @@ -7,6 +8,11 @@ namespace Content.Client._DV.Surgery;
/// </summary>
public sealed class SurgeryCleanSystem : SharedSurgeryCleanSystem
{
public override void Initialize()
{
base.Initialize();
Subs.ItemStatus<SurgeryDirtinessComponent>(ent => new SurgeryDirtinessItemStatus(ent, EntityManager));
}
public override bool RequiresCleaning(EntityUid target)
{
// Predict that it can be cleaned if it has dirt on it
Expand Down
41 changes: 41 additions & 0 deletions Content.Client/_DV/Surgery/SurgeryDirtinessItemStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using Content.Client.UserInterface.Controls;
using Content.Shared._DV.Surgery;
using Content.Shared.FixedPoint;
using Robust.Shared.Timing;

namespace Content.Client._DV.Surgery;

public sealed class SurgeryDirtinessItemStatus : SplitBar
{
private readonly IEntityManager _entManager;
private readonly EntityUid _uid;
private FixedPoint2? _dirtiness = null;

public SurgeryDirtinessItemStatus(EntityUid uid, IEntityManager entManager)
{
_uid = uid;
_entManager = entManager;
}

protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);
if (!_entManager.TryGetComponent<SurgeryDirtinessComponent>(_uid, out var dirtiness))
return;

if (_dirtiness == dirtiness.Dirtiness)
return;
_dirtiness = dirtiness.Dirtiness;

Clear();

var amount = FixedPoint2.Min(_dirtiness.Value / 100, 1);
var remaining = 1 - amount;

if (amount != FixedPoint2.Zero)
AddEntry(amount.Float(), amount < 0.5 ? Color.RosyBrown : Color.Red);

if (remaining != FixedPoint2.Zero)
AddEntry(remaining.Float(), Color.SlateGray);
}
}
2 changes: 2 additions & 0 deletions Resources/Prototypes/Entities/Clothing/Hands/gloves.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
- type: Fiber
fiberMaterial: fibers-latex
- type: FingerprintMask
- type: SurgeryDirtiness # DeltaV: gloves that are likely to be used for surgery should have their bar visible from the getgo

- type: entity
parent: ClothingHandsButcherable
Expand All @@ -156,6 +157,7 @@
- type: Fiber
fiberMaterial: fibers-nitrile
- type: FingerprintMask
- type: SurgeryDirtiness # DeltaV: gloves that are likely to be used for surgery should have their bar visible from the getgo
####
- type: entity
parent: ClothingHandsButcherable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
tags:
- SurgeryTool
- type: SurgeryTool
- type: SurgeryDirtiness # DeltaV: make sure surgery tools start with surgery dirtiness component

# Cautery

Expand Down

0 comments on commit b8f4071

Please sign in to comment.