Add ItemStatus for mopping (#13745)
* Add ItemStatus for mopping Big QOL feature * a
This commit is contained in:
20
Content.Client/Fluids/MoppingSystem.cs
Normal file
20
Content.Client/Fluids/MoppingSystem.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Content.Client.Fluids.UI;
|
||||
using Content.Client.Items;
|
||||
using Content.Shared.Fluids;
|
||||
using Robust.Client.UserInterface;
|
||||
|
||||
namespace Content.Client.Fluids;
|
||||
|
||||
public sealed class MoppingSystem : SharedMoppingSystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
Subs.ItemStatus<AbsorbentComponent>(GetAbsorbent);
|
||||
}
|
||||
|
||||
private Control GetAbsorbent(EntityUid arg)
|
||||
{
|
||||
return new AbsorbentItemStatus(arg, EntityManager);
|
||||
}
|
||||
}
|
||||
13
Content.Client/Fluids/UI/AbsorbentItemStatus.xaml
Normal file
13
Content.Client/Fluids/UI/AbsorbentItemStatus.xaml
Normal file
@@ -0,0 +1,13 @@
|
||||
<Control xmlns="https://spacestation14.io">
|
||||
<BoxContainer Orientation="Horizontal">
|
||||
<ProgressBar
|
||||
HorizontalExpand="True"
|
||||
Name="PercentBar"
|
||||
MinSize="20 20"
|
||||
VerticalAlignment="Center"
|
||||
Margin="2 8 4 2"
|
||||
MaxValue="1.0"
|
||||
MinValue="0.0">
|
||||
</ProgressBar>
|
||||
</BoxContainer>
|
||||
</Control>
|
||||
31
Content.Client/Fluids/UI/AbsorbentItemStatus.xaml.cs
Normal file
31
Content.Client/Fluids/UI/AbsorbentItemStatus.xaml.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Content.Shared.Fluids;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Client.Fluids.UI
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class AbsorbentItemStatus : Control
|
||||
{
|
||||
private readonly IEntityManager _entManager;
|
||||
private readonly EntityUid _uid;
|
||||
|
||||
public AbsorbentItemStatus(EntityUid uid, IEntityManager entManager)
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
_uid = uid;
|
||||
_entManager = entManager;
|
||||
}
|
||||
|
||||
protected override void FrameUpdate(FrameEventArgs args)
|
||||
{
|
||||
base.FrameUpdate(args);
|
||||
if (!_entManager.TryGetComponent<AbsorbentComponent>(_uid, out var absorbent))
|
||||
return;
|
||||
|
||||
PercentBar.Value = absorbent.Progress;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user