-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add hotbar indicator to surgery cleanliness
- Loading branch information
1 parent
c21c268
commit b8f4071
Showing
4 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters