Toggleable Hardsuit Helmets (#7559)

This commit is contained in:
Leon Friedrich
2022-04-23 15:31:45 +12:00
committed by GitHub
parent 83b47c43c0
commit 1141c19d76
34 changed files with 449 additions and 49 deletions

View File

@@ -37,6 +37,20 @@ namespace Content.Shared.Item
[DataField("clothingVisuals")]
public Dictionary<string, List<PrototypeLayerData>> ClothingVisuals = new();
/// <summary>
/// Whether or not this item can be picked up.
/// </summary>
/// <remarks>
/// This should almost always be true for items. But in some special cases, an item can be equipped but not
/// picked up. E.g., hardsuit helmets are attached to the suit, so we want to disable things like the pickup
/// verb.
/// </remarks>
[DataField("canPickup")]
public bool CanPickup = true;
[DataField("quickEquip")]
public bool QuickEquip = true;
/// <summary>
/// Part of the state of the sprite shown on the player when this item is in their hands or inventory.
/// </summary>
@@ -61,9 +75,12 @@ namespace Content.Shared.Item
[DataField("Slots")]
public SlotFlags SlotFlags = SlotFlags.PREVENTEQUIP; //Different from None, NONE allows equips if no slot flags are required
[DataField("EquipSound")]
[DataField("equipSound")]
public SoundSpecifier? EquipSound { get; set; } = default!;
[DataField("unequipSound")]
public SoundSpecifier? UnequipSound = default!;
/// <summary>
/// Rsi of the sprite shown on the player when this item is in their hands. Used to generate a default entry for <see cref="InhandVisuals"/>
/// </summary>

View File

@@ -1,4 +1,3 @@
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction;
using Content.Shared.Inventory.Events;
@@ -27,7 +26,7 @@ namespace Content.Shared.Item
private void OnHandInteract(EntityUid uid, SharedItemComponent component, InteractHandEvent args)
{
if (args.Handled)
if (args.Handled || !component.CanPickup)
return;
args.Handled = _handsSystem.TryPickup(args.User, uid, animateUser: false);
@@ -68,6 +67,7 @@ namespace Content.Shared.Item
args.Using != null ||
!args.CanAccess ||
!args.CanInteract ||
!component.CanPickup ||
!_handsSystem.CanPickupAnyHand(args.User, args.Target, handsComp: args.Hands, item: component))
return;