Remove IUse (#7074)
This commit is contained in:
@@ -11,6 +11,7 @@ using Content.Shared.Database;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
using Content.Server.Hands.Components;
|
||||
using Content.Shared.Clothing;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Item;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Clothing.Components
|
||||
{
|
||||
@@ -20,53 +11,12 @@ namespace Content.Server.Clothing.Components
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent]
|
||||
[ComponentReference(typeof(SharedItemComponent))]
|
||||
public sealed class ClothingComponent : ItemComponent, IUse
|
||||
public sealed class ClothingComponent : ItemComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entities = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
|
||||
[DataField("QuickEquip")]
|
||||
private bool _quickEquipEnabled = true;
|
||||
|
||||
[DataField("HeatResistance")]
|
||||
private int _heatResistance = 323;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public int HeatResistance => _heatResistance;
|
||||
|
||||
bool IUse.UseEntity(UseEntityEventArgs eventArgs)
|
||||
{
|
||||
if (!_quickEquipEnabled) return false;
|
||||
|
||||
var invSystem = EntitySystem.Get<InventorySystem>();
|
||||
if (!_entities.TryGetComponent(eventArgs.User, out InventoryComponent? inv)
|
||||
|| !_entities.TryGetComponent(eventArgs.User, out HandsComponent? hands) || !_prototype.TryIndex<InventoryTemplatePrototype>(inv.TemplateId, out var prototype)) return false;
|
||||
|
||||
foreach (var slotDef in prototype.Slots)
|
||||
{
|
||||
if(!invSystem.CanEquip(eventArgs.User, Owner, slotDef.Name, out _, slotDef, inv))
|
||||
continue;
|
||||
|
||||
if (invSystem.TryGetSlotEntity(eventArgs.User, slotDef.Name, out var slotEntity, inv))
|
||||
{
|
||||
if(!invSystem.TryUnequip(eventArgs.User, slotDef.Name, true, inventory: inv))
|
||||
continue;
|
||||
|
||||
if (!invSystem.TryEquip(eventArgs.User, Owner, slotDef.Name, true, inventory: inv))
|
||||
continue;
|
||||
|
||||
hands.PutInHandOrDrop(slotEntity.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!invSystem.TryEquip(eventArgs.User, Owner, slotDef.Name, true, inventory: inv))
|
||||
continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Shared.Crayon;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Decals;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
@@ -2,7 +2,7 @@ using System;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Throwing;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Flash.Components;
|
||||
using Content.Server.Throwing;
|
||||
using Content.Shared.Explosion;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using Content.Server.Explosion.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Trigger;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ using Content.Shared.CharacterAppearance.Systems;
|
||||
using Content.Shared.Extinguisher;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Weapon.Melee;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Flash;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Popups;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Server.Clothing.Components;
|
||||
using Content.Server.Light.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Light.Component;
|
||||
using Content.Shared.Verbs;
|
||||
|
||||
@@ -8,6 +8,7 @@ using Content.Shared.Audio;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
@@ -15,6 +15,7 @@ using Content.Shared.Database;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Throwing;
|
||||
|
||||
@@ -21,6 +21,7 @@ using Robust.Shared.Player;
|
||||
using Robust.Shared.Utility;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Interaction.Events;
|
||||
|
||||
namespace Content.Server.Nutrition.EntitySystems
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.PAI;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Instruments;
|
||||
@@ -14,6 +13,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Player;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Interaction.Events;
|
||||
|
||||
namespace Content.Server.PAI
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Content.Shared.Interaction.Events;
|
||||
|
||||
namespace Content.Server.PDA
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Server.RCD.Components;
|
||||
using Content.Shared.Coordinates;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Popups;
|
||||
|
||||
@@ -11,6 +11,7 @@ using Content.Shared.Physics;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Server.Doors.Systems;
|
||||
using Content.Server.Doors.Components;
|
||||
using Content.Shared.Interaction.Events;
|
||||
|
||||
namespace Content.Server.Remotes
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Sound.Components;
|
||||
using Content.Server.Throwing;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Throwing;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
@@ -8,7 +8,7 @@ using Content.Server.Weapon.Melee;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Jittering;
|
||||
using Content.Shared.Popups;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.Actions;
|
||||
using Content.Shared.Actions.ActionTypes;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Verbs;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Tools.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Weapons.Melee;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Server.Weapon.Ranged.Ammunition.Components;
|
||||
using Content.Server.Weapon.Ranged.Barrels.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Weapon.Ranged.Ammunition.Components;
|
||||
using Content.Server.Weapon.Ranged.Barrels.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Server.Weapon.Ranged.Ammunition.Components;
|
||||
using Content.Server.Weapon.Ranged.Barrels.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Weapons.Ranged;
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Weapon.Ranged.Ammunition.Components;
|
||||
using Content.Server.Weapon.Ranged.Barrels.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Weapon.Ranged.Ammunition.Components;
|
||||
using Content.Server.Weapon.Ranged.Barrels.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using Content.Server.Weapon.Ranged.Ammunition.Components;
|
||||
using Content.Server.Weapon.Ranged.Barrels.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Hands.Components;
|
||||
using Content.Server.Weapon.Ranged.Ammunition.Components;
|
||||
using Content.Server.Weapon.Ranged.Barrels.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
@@ -12,6 +12,7 @@ using Content.Shared.Camera;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.PowerCell.Components;
|
||||
using Content.Shared.Verbs;
|
||||
|
||||
@@ -4,7 +4,7 @@ using Content.Server.Hands.Systems;
|
||||
using Content.Server.Weapon.Melee;
|
||||
using Content.Server.Wieldable.Components;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Verbs;
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Acts;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Sound;
|
||||
using Content.Shared.Verbs;
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Interaction.Events
|
||||
namespace Content.Shared.Interaction.Events;
|
||||
|
||||
public sealed class ChangeDirectionAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public sealed class ChangeDirectionAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public ChangeDirectionAttemptEvent(EntityUid uid)
|
||||
{
|
||||
Uid = uid;
|
||||
}
|
||||
|
||||
public EntityUid Uid { get; }
|
||||
}
|
||||
}
|
||||
|
||||
20
Content.Shared/Interaction/Events/UseInHandEvent.cs
Normal file
20
Content.Shared/Interaction/Events/UseInHandEvent.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Shared.Interaction.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when using the entity in your hands.
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public sealed class UseInHandEvent : HandledEntityEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Entity holding the item in their hand.
|
||||
/// </summary>
|
||||
public EntityUid User { get; }
|
||||
|
||||
public UseInHandEvent(EntityUid user)
|
||||
{
|
||||
User = user;
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Interaction
|
||||
{
|
||||
/// <summary>
|
||||
/// This interface gives components behavior when using the entity in your active hand
|
||||
/// (done by clicking the entity in the active hand or pressing the keybind that defaults to Z).
|
||||
/// </summary>
|
||||
[RequiresExplicitImplementation]
|
||||
public interface IUse
|
||||
{
|
||||
/// <summary>
|
||||
/// Called when we activate an object we are holding to use it
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Obsolete("Use UseInHandMessage instead")]
|
||||
bool UseEntity(UseEntityEventArgs eventArgs);
|
||||
}
|
||||
|
||||
public sealed class UseEntityEventArgs : EventArgs
|
||||
{
|
||||
public UseEntityEventArgs(EntityUid user)
|
||||
{
|
||||
User = user;
|
||||
}
|
||||
|
||||
public EntityUid User { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raised when using the entity in your hands.
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public sealed class UseInHandEvent : HandledEntityEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Entity holding the item in their hand.
|
||||
/// </summary>
|
||||
public EntityUid User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Item that was used.
|
||||
/// </summary>
|
||||
public EntityUid Used { get; }
|
||||
|
||||
public UseInHandEvent(EntityUid user, EntityUid used)
|
||||
{
|
||||
User = user;
|
||||
Used = used;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.CombatMode;
|
||||
@@ -26,6 +24,7 @@ using Content.Shared.Item;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Timing;
|
||||
using Content.Shared.Interaction.Events;
|
||||
|
||||
#pragma warning disable 618
|
||||
|
||||
@@ -786,7 +785,7 @@ namespace Content.Shared.Interaction
|
||||
if (checkCanUse && !_actionBlockerSystem.CanUseHeldEntity(user))
|
||||
return false;
|
||||
|
||||
var useMsg = new UseInHandEvent(user, used);
|
||||
var useMsg = new UseInHandEvent(user);
|
||||
RaiseLocalEvent(used, useMsg);
|
||||
if (useMsg.Handled)
|
||||
{
|
||||
@@ -794,19 +793,6 @@ namespace Content.Shared.Interaction
|
||||
return true;
|
||||
}
|
||||
|
||||
var uses = AllComps<IUse>(used).ToList();
|
||||
|
||||
// Try to use item on any components which have the interface
|
||||
foreach (var use in uses)
|
||||
{
|
||||
// If a Use returns a status completion we finish our interaction
|
||||
if (use.UseEntity(new UseEntityEventArgs(user)))
|
||||
{
|
||||
_useDelay.BeginDelay(used, delayComponent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// else, default to activating the item
|
||||
return InteractionActivate(user, used, false, false, false);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Movement.EntitySystems;
|
||||
@@ -10,9 +9,6 @@ using Content.Shared.Popups;
|
||||
using Content.Shared.Strip.Components;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -33,9 +29,47 @@ public abstract partial class InventorySystem
|
||||
SubscribeLocalEvent<InventoryComponent, EntInsertedIntoContainerMessage>(OnEntInserted);
|
||||
SubscribeLocalEvent<InventoryComponent, EntRemovedFromContainerMessage>(OnEntRemoved);
|
||||
|
||||
SubscribeLocalEvent<SharedItemComponent, UseInHandEvent>(OnUseInHand);
|
||||
|
||||
SubscribeAllEvent<UseSlotNetworkMessage>(OnUseSlot);
|
||||
}
|
||||
|
||||
private void OnUseInHand(EntityUid uid, SharedItemComponent component, UseInHandEvent args)
|
||||
{
|
||||
if (args.Handled || !component.QuickEquip)
|
||||
return;
|
||||
|
||||
if (!TryComp(args.User, out InventoryComponent? inv)
|
||||
|| !TryComp(args.User, out SharedHandsComponent? hands)
|
||||
|| !_prototypeManager.TryIndex<InventoryTemplatePrototype>(inv.TemplateId, out var prototype))
|
||||
return;
|
||||
|
||||
foreach (var slotDef in prototype.Slots)
|
||||
{
|
||||
if (!CanEquip(args.User, uid, slotDef.Name, out _, slotDef, inv))
|
||||
continue;
|
||||
|
||||
if (TryGetSlotEntity(args.User, slotDef.Name, out var slotEntity, inv))
|
||||
{
|
||||
if (!TryUnequip(args.User, slotDef.Name, true, inventory: inv))
|
||||
continue;
|
||||
|
||||
if (!TryEquip(args.User, uid, slotDef.Name, true, inventory: inv))
|
||||
continue;
|
||||
|
||||
hands.PutInHandOrDrop(slotEntity.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!TryEquip(args.User, uid, slotDef.Name, true, inventory: inv))
|
||||
continue;
|
||||
}
|
||||
|
||||
args.Handled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEntRemoved(EntityUid uid, InventoryComponent component, EntRemovedFromContainerMessage args)
|
||||
{
|
||||
if(!TryGetSlot(uid, args.Container.ID, out var slotDef, inventory: component))
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Sound;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using static Robust.Shared.GameObjects.SharedSpriteComponent;
|
||||
|
||||
namespace Content.Shared.Item
|
||||
@@ -24,6 +15,9 @@ namespace Content.Shared.Item
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
[DataField("quickEquip")]
|
||||
public bool QuickEquip = true;
|
||||
|
||||
/// <summary>
|
||||
/// How much big this item is.
|
||||
/// </summary>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
state: icon
|
||||
- type: Clothing
|
||||
size: 9999
|
||||
QuickEquip: false
|
||||
quickEquip: false
|
||||
Slots:
|
||||
- back
|
||||
sprite: Clothing/Back/Backpacks/backpack.rsi
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
- type: Clothing
|
||||
sprite: Clothing/Back/Duffels/duffel.rsi
|
||||
size: 9999
|
||||
QuickEquip: false
|
||||
quickEquip: false
|
||||
Slots:
|
||||
- back
|
||||
- type: Storage
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
state: icon
|
||||
- type: Clothing
|
||||
size: 9999
|
||||
QuickEquip: false
|
||||
quickEquip: false
|
||||
Slots:
|
||||
- back
|
||||
sprite: Clothing/Back/Satchels/satchel.rsi
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
- type: Clothing
|
||||
Slots: [belt]
|
||||
size: 50
|
||||
QuickEquip: false
|
||||
quickEquip: false
|
||||
EquipSound:
|
||||
path: /Audio/Items/belt_equip.ogg
|
||||
|
||||
@@ -422,7 +422,7 @@
|
||||
sprite: Clothing/Belt/champion.rsi
|
||||
- type: Clothing
|
||||
sprite: Clothing/Belt/champion.rsi
|
||||
QuickEquip: true
|
||||
quickEquip: true
|
||||
|
||||
- type: entity
|
||||
parent: ClothingBeltBase
|
||||
@@ -474,4 +474,4 @@
|
||||
state: icon
|
||||
- type: Clothing
|
||||
sprite: Clothing/Belt/suspenders.rsi
|
||||
QuickEquip: true
|
||||
quickEquip: true
|
||||
|
||||
Reference in New Issue
Block a user