Stripping (#1668)
* Start work on stripping. * more strippable work * Stripping works * Nullable * MORE NULLABLE * nullable moment * life is pain * Interaction check. * Update Content.Client/GameObjects/Components/HUD/Inventory/StrippableBoundUserInterface.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Client/GameObjects/Components/HUD/Inventory/StrippableBoundUserInterface.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/HandsComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/HandsComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/HandsComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/StrippableComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/StrippableComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/HandsComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/StrippableComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/StrippableComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Shared/GameObjects/Components/GUI/SharedStrippableComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/StrippableComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Rename InventoryComponent and HandsComponent's OnChanged event to OnItemChanged * Apply suggestions from code review Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Use static EquipmentSlotDefines * Do not expose ContainerSlot on Inventory or Hands. Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
e047262289
commit
c3df108b27
@@ -1,6 +1,11 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.GameObjects;
|
||||
using Content.Server.GameObjects.Components.GUI;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Content.Shared.GameObjects.Components.Inventory;
|
||||
using Content.Shared.GameObjects.Components.Items;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Server.GameObjects.Components.Container;
|
||||
@@ -12,10 +17,20 @@ namespace Content.Server.Interfaces.GameObjects.Components.Items
|
||||
{
|
||||
public interface IHandsComponent : ISharedHandsComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Invoked when the hand contents changes or when a hand is added/removed.
|
||||
/// </summary>
|
||||
event Action? OnItemChanged;
|
||||
|
||||
/// <summary>
|
||||
/// The hands in this component.
|
||||
/// </summary>
|
||||
IEnumerable<string> Hands { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The hand name of the currently active hand.
|
||||
/// </summary>
|
||||
string ActiveHand { get; set; }
|
||||
string? ActiveHand { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates over every held item.
|
||||
@@ -27,12 +42,20 @@ namespace Content.Server.Interfaces.GameObjects.Components.Items
|
||||
/// </summary>
|
||||
/// <param name="handName">The name of the hand to get.</param>
|
||||
/// <returns>The item in the held, null if no item is held</returns>
|
||||
ItemComponent GetItem(string handName);
|
||||
ItemComponent? GetItem(string handName);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to get an item in a hand.
|
||||
/// </summary>
|
||||
/// <param name="handName">The name of the hand to get.</param>
|
||||
/// <param name="item">The item in the held, null if no item is held</param>
|
||||
/// <returns>Whether it was holding an item</returns>
|
||||
bool TryGetItem(string handName, [MaybeNullWhen(false)] out ItemComponent item);
|
||||
|
||||
/// <summary>
|
||||
/// Gets item held by the current active hand
|
||||
/// </summary>
|
||||
ItemComponent GetActiveHand { get; }
|
||||
ItemComponent? GetActiveHand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Puts an item into any empty hand, preferring the active hand.
|
||||
@@ -78,7 +101,7 @@ namespace Content.Server.Interfaces.GameObjects.Components.Items
|
||||
/// <returns>
|
||||
/// true if the entity is held, false otherwise
|
||||
/// </returns>
|
||||
bool TryHand(IEntity entity, out string handName);
|
||||
bool TryHand(IEntity entity, [MaybeNullWhen(false)] out string handName);
|
||||
|
||||
/// <summary>
|
||||
/// Drops the item contained in the slot to the same position as our entity.
|
||||
|
||||
Reference in New Issue
Block a user