Improve hands & pulling (#4389)
This commit is contained in:
committed by
GitHub
parent
73e4946e27
commit
632e72b817
32
Content.Client/Items/ItemStatusMessages.cs
Normal file
32
Content.Client/Items/ItemStatusMessages.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.Items
|
||||
{
|
||||
public sealed class ItemStatusCollectMessage : EntityEventArgs
|
||||
{
|
||||
public List<Control> Controls = new();
|
||||
}
|
||||
|
||||
public static class ItemStatusRegisterExt
|
||||
{
|
||||
/// <summary>
|
||||
/// Register an item status control for a component.
|
||||
/// </summary>
|
||||
/// <param name="subs">The <see cref="EntitySystem.Subs"/> handle from within entity system initialize.</param>
|
||||
/// <param name="createControl">A delegate to create the actual control.</param>
|
||||
/// <typeparam name="TComp">The type of component for which this control should be made.</typeparam>
|
||||
public static void ItemStatus<TComp>(
|
||||
this EntitySystem.Subscriptions subs,
|
||||
Func<EntityUid, Control> createControl)
|
||||
where TComp : IComponent
|
||||
{
|
||||
subs.SubscribeLocalEvent<TComp, ItemStatusCollectMessage>((uid, _, args) =>
|
||||
{
|
||||
args.Controls.Add(createControl(uid));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user