Remove inventory component references (#15249)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Client.Inventory;
|
||||
using Content.Client.Humanoid;
|
||||
using Content.Shared.Clothing;
|
||||
using Content.Shared.Clothing.Components;
|
||||
using Content.Shared.Clothing.EntitySystems;
|
||||
@@ -53,12 +52,12 @@ public sealed class ClientClothingSystem : ClothingSystem
|
||||
|
||||
SubscribeLocalEvent<ClothingComponent, GetEquipmentVisualsEvent>(OnGetVisuals);
|
||||
|
||||
SubscribeLocalEvent<ClientInventoryComponent, VisualsChangedEvent>(OnVisualsChanged);
|
||||
SubscribeLocalEvent<InventoryComponent, VisualsChangedEvent>(OnVisualsChanged);
|
||||
SubscribeLocalEvent<SpriteComponent, DidUnequipEvent>(OnDidUnequip);
|
||||
SubscribeLocalEvent<ClientInventoryComponent, AppearanceChangeEvent>(OnAppearanceUpdate);
|
||||
SubscribeLocalEvent<InventoryComponent, AppearanceChangeEvent>(OnAppearanceUpdate);
|
||||
}
|
||||
|
||||
private void OnAppearanceUpdate(EntityUid uid, ClientInventoryComponent component, ref AppearanceChangeEvent args)
|
||||
private void OnAppearanceUpdate(EntityUid uid, InventoryComponent component, ref AppearanceChangeEvent args)
|
||||
{
|
||||
// May need to update jumpsuit stencils if the sex changed. Also required to properly set the stencil on init
|
||||
// when sex is first loaded from the profile.
|
||||
@@ -85,7 +84,7 @@ public sealed class ClientClothingSystem : ClothingSystem
|
||||
|
||||
private void OnGetVisuals(EntityUid uid, ClothingComponent item, GetEquipmentVisualsEvent args)
|
||||
{
|
||||
if (!TryComp(args.Equipee, out ClientInventoryComponent? inventory))
|
||||
if (!TryComp(args.Equipee, out InventoryComponent? inventory))
|
||||
return;
|
||||
|
||||
List<PrototypeLayerData>? layers = null;
|
||||
@@ -170,7 +169,7 @@ public sealed class ClientClothingSystem : ClothingSystem
|
||||
return true;
|
||||
}
|
||||
|
||||
private void OnVisualsChanged(EntityUid uid, ClientInventoryComponent component, VisualsChangedEvent args)
|
||||
private void OnVisualsChanged(EntityUid uid, InventoryComponent component, VisualsChangedEvent args)
|
||||
{
|
||||
if (!TryComp(args.Item, out ClothingComponent? clothing) || clothing.InSlot == null)
|
||||
return;
|
||||
@@ -180,22 +179,22 @@ public sealed class ClientClothingSystem : ClothingSystem
|
||||
|
||||
private void OnDidUnequip(EntityUid uid, SpriteComponent component, DidUnequipEvent args)
|
||||
{
|
||||
if (!TryComp(uid, out ClientInventoryComponent? inventory) || !TryComp(uid, out SpriteComponent? sprite))
|
||||
if (!TryComp(uid, out InventoryComponent? inventory) || !TryComp(uid, out InventorySlotsComponent? inventorySlots))
|
||||
return;
|
||||
|
||||
if (!inventory.VisualLayerKeys.TryGetValue(args.Slot, out var revealedLayers))
|
||||
if (!inventorySlots.VisualLayerKeys.TryGetValue(args.Slot, out var revealedLayers))
|
||||
return;
|
||||
|
||||
// Remove old layers. We could also just set them to invisible, but as items may add arbitrary layers, this
|
||||
// may eventually bloat the player with lots of invisible layers.
|
||||
foreach (var layer in revealedLayers)
|
||||
{
|
||||
sprite.RemoveLayer(layer);
|
||||
component.RemoveLayer(layer);
|
||||
}
|
||||
revealedLayers.Clear();
|
||||
}
|
||||
|
||||
public void InitClothing(EntityUid uid, ClientInventoryComponent? component = null, SpriteComponent? sprite = null)
|
||||
public void InitClothing(EntityUid uid, InventoryComponent? component = null, SpriteComponent? sprite = null)
|
||||
{
|
||||
if (!Resolve(uid, ref sprite, ref component) || !_inventorySystem.TryGetSlots(uid, out var slots, component))
|
||||
return;
|
||||
@@ -217,10 +216,14 @@ public sealed class ClientClothingSystem : ClothingSystem
|
||||
}
|
||||
|
||||
private void RenderEquipment(EntityUid equipee, EntityUid equipment, string slot,
|
||||
ClientInventoryComponent? inventory = null, SpriteComponent? sprite = null, ClothingComponent? clothingComponent = null)
|
||||
InventoryComponent? inventory = null, SpriteComponent? sprite = null, ClothingComponent? clothingComponent = null,
|
||||
InventorySlotsComponent? inventorySlots = null)
|
||||
{
|
||||
if (!Resolve(equipee, ref inventory, ref sprite, ref inventorySlots) ||
|
||||
!Resolve(equipment, ref clothingComponent, false))
|
||||
{
|
||||
if(!Resolve(equipee, ref inventory, ref sprite) || !Resolve(equipment, ref clothingComponent, false))
|
||||
return;
|
||||
}
|
||||
|
||||
if (slot == "jumpsuit" && sprite.LayerMapTryGet(HumanoidVisualLayers.StencilMask, out var suitLayer))
|
||||
{
|
||||
@@ -243,7 +246,7 @@ public sealed class ClientClothingSystem : ClothingSystem
|
||||
|
||||
// Remove old layers. We could also just set them to invisible, but as items may add arbitrary layers, this
|
||||
// may eventually bloat the player with lots of invisible layers.
|
||||
if (inventory.VisualLayerKeys.TryGetValue(slot, out var revealedLayers))
|
||||
if (inventorySlots.VisualLayerKeys.TryGetValue(slot, out var revealedLayers))
|
||||
{
|
||||
foreach (var key in revealedLayers)
|
||||
{
|
||||
@@ -254,11 +257,11 @@ public sealed class ClientClothingSystem : ClothingSystem
|
||||
else
|
||||
{
|
||||
revealedLayers = new();
|
||||
inventory.VisualLayerKeys[slot] = revealedLayers;
|
||||
inventorySlots.VisualLayerKeys[slot] = revealedLayers;
|
||||
}
|
||||
|
||||
var ev = new GetEquipmentVisualsEvent(equipee, slot);
|
||||
RaiseLocalEvent(equipment, ev, false);
|
||||
RaiseLocalEvent(equipment, ev);
|
||||
|
||||
if (ev.Layers.Count == 0)
|
||||
{
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
using Content.Shared.Inventory;
|
||||
|
||||
namespace Content.Client.Inventory
|
||||
{
|
||||
/// <summary>
|
||||
/// A character UI which shows items the user has equipped within his inventory
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(InventoryComponent))]
|
||||
[Access(typeof(ClientInventorySystem))]
|
||||
public sealed class ClientInventoryComponent : InventoryComponent
|
||||
{
|
||||
[DataField("speciesId")] public string? SpeciesId { get; set; }
|
||||
[ViewVariables]
|
||||
public readonly Dictionary<string, ClientInventorySystem.SlotData> SlotData = new ();
|
||||
/// <summary>
|
||||
/// Data about the current layers that have been added to the players sprite due to the items in each equipment slot.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[Access(typeof(ClientInventorySystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
|
||||
public readonly Dictionary<string, HashSet<string>> VisualLayerKeys = new();
|
||||
}
|
||||
}
|
||||
@@ -32,25 +32,25 @@ namespace Content.Client.Inventory
|
||||
public Action<SlotData>? EntitySlotUpdate = null;
|
||||
public Action<SlotData>? OnSlotAdded = null;
|
||||
public Action<SlotData>? OnSlotRemoved = null;
|
||||
public Action<ClientInventoryComponent>? OnLinkInventory = null;
|
||||
public Action<InventorySlotsComponent>? OnLinkInventorySlots = null;
|
||||
public Action? OnUnlinkInventory = null;
|
||||
public Action<SlotSpriteUpdate>? OnSpriteUpdate = null;
|
||||
|
||||
private readonly Queue<(ClientInventoryComponent comp, EntityEventArgs args)> _equipEventsQueue = new();
|
||||
private readonly Queue<(InventorySlotsComponent comp, EntityEventArgs args)> _equipEventsQueue = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
UpdatesOutsidePrediction = true;
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<ClientInventoryComponent, PlayerAttachedEvent>(OnPlayerAttached);
|
||||
SubscribeLocalEvent<ClientInventoryComponent, PlayerDetachedEvent>(OnPlayerDetached);
|
||||
SubscribeLocalEvent<InventorySlotsComponent, PlayerAttachedEvent>(OnPlayerAttached);
|
||||
SubscribeLocalEvent<InventorySlotsComponent, PlayerDetachedEvent>(OnPlayerDetached);
|
||||
|
||||
SubscribeLocalEvent<ClientInventoryComponent, ComponentShutdown>(OnShutdown);
|
||||
SubscribeLocalEvent<InventoryComponent, ComponentShutdown>(OnShutdown);
|
||||
|
||||
SubscribeLocalEvent<ClientInventoryComponent, DidEquipEvent>((_, comp, args) =>
|
||||
SubscribeLocalEvent<InventorySlotsComponent, DidEquipEvent>((_, comp, args) =>
|
||||
_equipEventsQueue.Enqueue((comp, args)));
|
||||
SubscribeLocalEvent<ClientInventoryComponent, DidUnequipEvent>((_, comp, args) =>
|
||||
SubscribeLocalEvent<InventorySlotsComponent, DidUnequipEvent>((_, comp, args) =>
|
||||
_equipEventsQueue.Enqueue((comp, args)));
|
||||
|
||||
SubscribeLocalEvent<ClothingComponent, UseInHandEvent>(OnUseInHand);
|
||||
@@ -86,7 +86,7 @@ namespace Content.Client.Inventory
|
||||
QuickEquip(uid, component, args);
|
||||
}
|
||||
|
||||
private void OnDidUnequip(ClientInventoryComponent component, DidUnequipEvent args)
|
||||
private void OnDidUnequip(InventorySlotsComponent component, DidUnequipEvent args)
|
||||
{
|
||||
UpdateSlot(args.Equipee, component, args.Slot);
|
||||
if (args.Equipee != _playerManager.LocalPlayer?.ControlledEntity)
|
||||
@@ -95,7 +95,7 @@ namespace Content.Client.Inventory
|
||||
OnSpriteUpdate?.Invoke(update);
|
||||
}
|
||||
|
||||
private void OnDidEquip(ClientInventoryComponent component, DidEquipEvent args)
|
||||
private void OnDidEquip(InventorySlotsComponent component, DidEquipEvent args)
|
||||
{
|
||||
UpdateSlot(args.Equipee, component, args.Slot);
|
||||
if (args.Equipee != _playerManager.LocalPlayer?.ControlledEntity)
|
||||
@@ -106,7 +106,7 @@ namespace Content.Client.Inventory
|
||||
OnSpriteUpdate?.Invoke(update);
|
||||
}
|
||||
|
||||
private void OnShutdown(EntityUid uid, ClientInventoryComponent component, ComponentShutdown args)
|
||||
private void OnShutdown(EntityUid uid, InventoryComponent component, ComponentShutdown args)
|
||||
{
|
||||
if (component.Owner != _playerManager.LocalPlayer?.ControlledEntity)
|
||||
return;
|
||||
@@ -114,18 +114,18 @@ namespace Content.Client.Inventory
|
||||
OnUnlinkInventory?.Invoke();
|
||||
}
|
||||
|
||||
private void OnPlayerDetached(EntityUid uid, ClientInventoryComponent component, PlayerDetachedEvent args)
|
||||
private void OnPlayerDetached(EntityUid uid, InventorySlotsComponent component, PlayerDetachedEvent args)
|
||||
{
|
||||
OnUnlinkInventory?.Invoke();
|
||||
}
|
||||
|
||||
private void OnPlayerAttached(EntityUid uid, ClientInventoryComponent component, PlayerAttachedEvent args)
|
||||
private void OnPlayerAttached(EntityUid uid, InventorySlotsComponent component, PlayerAttachedEvent args)
|
||||
{
|
||||
if (TryGetSlots(uid, out var definitions))
|
||||
{
|
||||
foreach (var definition in definitions)
|
||||
{
|
||||
if (!TryGetSlotContainer(uid, definition.Name, out var container, out _, component))
|
||||
if (!TryGetSlotContainer(uid, definition.Name, out var container, out _))
|
||||
continue;
|
||||
|
||||
if (!component.SlotData.TryGetValue(definition.Name, out var data))
|
||||
@@ -138,7 +138,7 @@ namespace Content.Client.Inventory
|
||||
}
|
||||
}
|
||||
|
||||
OnLinkInventory?.Invoke(component);
|
||||
OnLinkInventorySlots?.Invoke(component);
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
@@ -150,18 +150,21 @@ namespace Content.Client.Inventory
|
||||
protected override void OnInit(EntityUid uid, InventoryComponent component, ComponentInit args)
|
||||
{
|
||||
base.OnInit(uid, component, args);
|
||||
_clothingVisualsSystem.InitClothing(uid, (ClientInventoryComponent) component);
|
||||
_clothingVisualsSystem.InitClothing(uid, component);
|
||||
|
||||
if (!_prototypeManager.TryIndex(component.TemplateId, out InventoryTemplatePrototype? invTemplate))
|
||||
if (!_prototypeManager.TryIndex(component.TemplateId, out InventoryTemplatePrototype? invTemplate) ||
|
||||
!TryComp(uid, out InventorySlotsComponent? inventorySlots))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var slot in invTemplate.Slots)
|
||||
{
|
||||
TryAddSlotDef(uid, (ClientInventoryComponent)component, slot);
|
||||
TryAddSlotDef(uid, inventorySlots, slot);
|
||||
}
|
||||
}
|
||||
|
||||
public void ReloadInventory(ClientInventoryComponent? component = null)
|
||||
public void ReloadInventory(InventorySlotsComponent? component = null)
|
||||
{
|
||||
var player = _playerManager.LocalPlayer?.ControlledEntity;
|
||||
if (player == null || !Resolve(player.Value, ref component, false))
|
||||
@@ -170,10 +173,10 @@ namespace Content.Client.Inventory
|
||||
}
|
||||
|
||||
OnUnlinkInventory?.Invoke();
|
||||
OnLinkInventory?.Invoke(component);
|
||||
OnLinkInventorySlots?.Invoke(component);
|
||||
}
|
||||
|
||||
public void SetSlotHighlight(EntityUid owner, ClientInventoryComponent component, string slotName, bool state)
|
||||
public void SetSlotHighlight(EntityUid owner, InventorySlotsComponent component, string slotName, bool state)
|
||||
{
|
||||
var oldData = component.SlotData[slotName];
|
||||
var newData = component.SlotData[slotName] = new SlotData(oldData, state);
|
||||
@@ -181,7 +184,7 @@ namespace Content.Client.Inventory
|
||||
EntitySlotUpdate?.Invoke(newData);
|
||||
}
|
||||
|
||||
public void UpdateSlot(EntityUid owner, ClientInventoryComponent component, string slotName,
|
||||
public void UpdateSlot(EntityUid owner, InventorySlotsComponent component, string slotName,
|
||||
bool? blocked = null, bool? highlight = null)
|
||||
{
|
||||
var oldData = component.SlotData[slotName];
|
||||
@@ -200,7 +203,7 @@ namespace Content.Client.Inventory
|
||||
EntitySlotUpdate?.Invoke(newData);
|
||||
}
|
||||
|
||||
public bool TryAddSlotDef(EntityUid owner, ClientInventoryComponent component, SlotDefinition newSlotDef)
|
||||
public bool TryAddSlotDef(EntityUid owner, InventorySlotsComponent component, SlotDefinition newSlotDef)
|
||||
{
|
||||
SlotData newSlotData = newSlotDef; //convert to slotData
|
||||
if (!component.SlotData.TryAdd(newSlotDef.Name, newSlotData))
|
||||
@@ -211,7 +214,7 @@ namespace Content.Client.Inventory
|
||||
return true;
|
||||
}
|
||||
|
||||
public void RemoveSlotDef(EntityUid owner, ClientInventoryComponent component, SlotData slotData)
|
||||
public void RemoveSlotDef(EntityUid owner, InventorySlotsComponent component, SlotData slotData)
|
||||
{
|
||||
if (component.SlotData.Remove(slotData.SlotName))
|
||||
{
|
||||
@@ -220,7 +223,7 @@ namespace Content.Client.Inventory
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveSlotDef(EntityUid owner, ClientInventoryComponent component, string slotName)
|
||||
public void RemoveSlotDef(EntityUid owner, InventorySlotsComponent component, string slotName)
|
||||
{
|
||||
if (!component.SlotData.TryGetValue(slotName, out var slotData))
|
||||
return;
|
||||
|
||||
19
Content.Client/Inventory/InventorySlotsComponent.cs
Normal file
19
Content.Client/Inventory/InventorySlotsComponent.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace Content.Client.Inventory;
|
||||
|
||||
/// <summary>
|
||||
/// A character UI which shows items the user has equipped within his inventory
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[Access(typeof(ClientInventorySystem))]
|
||||
public sealed class InventorySlotsComponent : Component
|
||||
{
|
||||
[ViewVariables]
|
||||
public readonly Dictionary<string, ClientInventorySystem.SlotData> SlotData = new ();
|
||||
|
||||
/// <summary>
|
||||
/// Data about the current layers that have been added to the players sprite due to the items in each equipment slot.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[Access(typeof(ClientInventorySystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends
|
||||
public readonly Dictionary<string, HashSet<string>> VisualLayerKeys = new();
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
[UISystemDependency] private readonly ClientInventorySystem _inventorySystem = default!;
|
||||
[UISystemDependency] private readonly HandsSystem _handsSystem = default!;
|
||||
|
||||
private ClientInventoryComponent? _playerInventory;
|
||||
private InventorySlotsComponent? _playerInventory;
|
||||
private readonly Dictionary<string, ItemSlotButtonContainer> _slotGroups = new();
|
||||
|
||||
private StrippingWindow? _strippingWindow;
|
||||
@@ -105,7 +105,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
ToggleInventoryBar();
|
||||
}
|
||||
|
||||
private void UpdateInventoryHotbar(ClientInventoryComponent? clientInv)
|
||||
private void UpdateInventoryHotbar(InventorySlotsComponent? clientInv)
|
||||
{
|
||||
if (clientInv == null)
|
||||
{
|
||||
@@ -131,7 +131,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateStrippingWindow(ClientInventoryComponent? clientInv)
|
||||
private void UpdateStrippingWindow(InventorySlotsComponent? clientInv)
|
||||
{
|
||||
if (clientInv == null)
|
||||
{
|
||||
@@ -197,7 +197,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
{
|
||||
_inventorySystem.OnSlotAdded += AddSlot;
|
||||
_inventorySystem.OnSlotRemoved += RemoveSlot;
|
||||
_inventorySystem.OnLinkInventory += LoadSlots;
|
||||
_inventorySystem.OnLinkInventorySlots += LoadSlots;
|
||||
_inventorySystem.OnUnlinkInventory += UnloadSlots;
|
||||
_inventorySystem.OnSpriteUpdate += SpriteUpdated;
|
||||
}
|
||||
@@ -207,7 +207,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
{
|
||||
_inventorySystem.OnSlotAdded -= AddSlot;
|
||||
_inventorySystem.OnSlotRemoved -= RemoveSlot;
|
||||
_inventorySystem.OnLinkInventory -= LoadSlots;
|
||||
_inventorySystem.OnLinkInventorySlots -= LoadSlots;
|
||||
_inventorySystem.OnUnlinkInventory -= UnloadSlots;
|
||||
_inventorySystem.OnSpriteUpdate -= SpriteUpdated;
|
||||
}
|
||||
@@ -265,7 +265,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
!_entities.TryGetComponent<HandsComponent>(player, out var hands) ||
|
||||
hands.ActiveHandEntity is not { } held ||
|
||||
!_entities.TryGetComponent(held, out SpriteComponent? sprite) ||
|
||||
!_inventorySystem.TryGetSlotContainer(player.Value, control.SlotName, out var container, out var slotDef, _playerInventory))
|
||||
!_inventorySystem.TryGetSlotContainer(player.Value, control.SlotName, out var container, out var slotDef))
|
||||
{
|
||||
control.ClearHover();
|
||||
return;
|
||||
@@ -274,7 +274,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
// Set green / red overlay at 50% transparency
|
||||
var hoverEntity = _entities.SpawnEntity("hoverentity", MapCoordinates.Nullspace);
|
||||
var hoverSprite = _entities.GetComponent<SpriteComponent>(hoverEntity);
|
||||
var fits = _inventorySystem.CanEquip(player.Value, held, control.SlotName, out _, slotDef, _playerInventory) &&
|
||||
var fits = _inventorySystem.CanEquip(player.Value, held, control.SlotName, out _, slotDef) &&
|
||||
container.CanInsert(held, _entities);
|
||||
|
||||
hoverSprite.CopyFrom(sprite);
|
||||
@@ -305,7 +305,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
_inventorySystem.ReloadInventory();
|
||||
}
|
||||
|
||||
private void LoadSlots(ClientInventoryComponent clientInv)
|
||||
private void LoadSlots(InventorySlotsComponent clientInv)
|
||||
{
|
||||
UnloadSlots();
|
||||
_playerInventory = clientInv;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Server.Inventory;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.Clothing.Components;
|
||||
using Content.Shared.Clothing.EntitySystems;
|
||||
using Content.Shared.Inventory;
|
||||
@@ -6,8 +6,6 @@ using NUnit.Framework;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Content.IntegrationTests.Tests
|
||||
{
|
||||
@@ -27,12 +25,11 @@ namespace Content.IntegrationTests.Tests
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
// Spawn everything.
|
||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||
var invSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InventorySystem>();
|
||||
|
||||
var entMgr = IoCManager.Resolve<IEntityManager>();
|
||||
var container = entMgr.SpawnEntity(null, coordinates);
|
||||
entMgr.EnsureComponent<ServerInventoryComponent>(container);
|
||||
entMgr.EnsureComponent<InventoryComponent>(container);
|
||||
entMgr.EnsureComponent<ContainerManagerComponent>(container);
|
||||
|
||||
var child = entMgr.SpawnEntity(null, coordinates);
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace Content.Server.Entry
|
||||
"CableVisualizer",
|
||||
"UIFragment",
|
||||
"PDABorderColor",
|
||||
"InventorySlots",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
using Content.Shared.Inventory;
|
||||
|
||||
namespace Content.Server.Inventory;
|
||||
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(InventoryComponent))]
|
||||
public sealed class ServerInventoryComponent : InventoryComponent { }
|
||||
@@ -1,9 +1,14 @@
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Shared.Inventory;
|
||||
|
||||
public abstract class InventoryComponent : Component
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[Access(typeof(InventorySystem))]
|
||||
public sealed class InventoryComponent : Component
|
||||
{
|
||||
[DataField("templateId", customTypeSerializer: typeof(PrototypeIdSerializer<InventoryTemplatePrototype>))]
|
||||
public string TemplateId { get; } = "human";
|
||||
|
||||
[DataField("speciesId")] public string? SpeciesId { get; set; }
|
||||
}
|
||||
|
||||
@@ -687,6 +687,7 @@
|
||||
flavorKind: station-event-random-sentience-flavor-primate
|
||||
- type: Inventory
|
||||
templateId: monkey
|
||||
- type: InventorySlots
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
@@ -1384,6 +1385,7 @@
|
||||
- type: Inventory
|
||||
speciesId: possum
|
||||
templateId: pet
|
||||
- type: InventorySlots
|
||||
- type: Strippable
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
@@ -1438,6 +1440,7 @@
|
||||
- type: Inventory
|
||||
speciesId: possum #close enough
|
||||
templateId: pet
|
||||
- type: InventorySlots
|
||||
- type: Strippable
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
@@ -1492,6 +1495,7 @@
|
||||
- type: Inventory
|
||||
speciesId: fox
|
||||
templateId: pet
|
||||
- type: InventorySlots
|
||||
- type: Strippable
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
@@ -1547,6 +1551,7 @@
|
||||
- type: Inventory
|
||||
speciesId: dog
|
||||
templateId: pet
|
||||
- type: InventorySlots
|
||||
- type: Strippable
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
@@ -1659,6 +1664,7 @@
|
||||
- type: Inventory
|
||||
speciesId: puppy
|
||||
templateId: pet
|
||||
- type: InventorySlots
|
||||
- type: DamageStateVisuals
|
||||
states:
|
||||
Alive:
|
||||
@@ -1698,6 +1704,7 @@
|
||||
- type: Inventory
|
||||
speciesId: cat
|
||||
templateId: pet
|
||||
- type: InventorySlots
|
||||
- type: Strippable
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
@@ -1840,6 +1847,7 @@
|
||||
- type: Inventory
|
||||
speciesId: sloth
|
||||
templateId: pet
|
||||
- type: InventorySlots
|
||||
- type: Strippable
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
@@ -1894,6 +1902,7 @@
|
||||
- type: Inventory
|
||||
speciesId: fox #close enough
|
||||
templateId: pet
|
||||
- type: InventorySlots
|
||||
- type: Strippable
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
@@ -2055,6 +2064,7 @@
|
||||
- type: Inventory
|
||||
speciesId: pig
|
||||
templateId: pet
|
||||
- type: InventorySlots
|
||||
- type: Strippable
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
|
||||
@@ -182,6 +182,7 @@
|
||||
- type: Inventory
|
||||
speciesId: cat
|
||||
templateId: pet
|
||||
- type: InventorySlots
|
||||
- type: Strippable
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
@@ -239,6 +240,7 @@
|
||||
- type: Inventory
|
||||
speciesId: puppy
|
||||
templateId: pet
|
||||
- type: InventorySlots
|
||||
- type: Strippable
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
@@ -336,6 +338,7 @@
|
||||
- type: Inventory
|
||||
speciesId: dog
|
||||
templateId: pet
|
||||
- type: InventorySlots
|
||||
- type: Strippable
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
group: Drone
|
||||
- type: Inventory
|
||||
templateId: drone
|
||||
- type: InventorySlots
|
||||
- type: Strippable
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
- type: Blindable
|
||||
# Other
|
||||
- type: Inventory
|
||||
- type: InventorySlots
|
||||
- type: Clickable
|
||||
- type: InteractionOutline
|
||||
- type: Icon
|
||||
@@ -309,6 +310,7 @@
|
||||
components:
|
||||
- type: Hands
|
||||
- type: Inventory
|
||||
- type: InventorySlots
|
||||
- type: ContainerContainer
|
||||
- type: Icon
|
||||
sprite: Mobs/Species/Human/parts.rsi
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
- MobLayer
|
||||
- type: Inventory
|
||||
templateId: diona
|
||||
- type: InventorySlots
|
||||
- type: MovementSpeedModifier
|
||||
baseWalkSpeed : 1.5
|
||||
baseSprintSpeed : 3.5
|
||||
@@ -60,5 +61,6 @@
|
||||
components:
|
||||
- type: Inventory
|
||||
templateId: diona
|
||||
- type: InventorySlots
|
||||
- type: HumanoidAppearance
|
||||
species: Diona
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
# canColorFacialHair: false
|
||||
- type: Inventory
|
||||
speciesId: vox
|
||||
- type: InventorySlots
|
||||
- type: Butcherable
|
||||
butcheringType: Spike
|
||||
spawned:
|
||||
|
||||
Reference in New Issue
Block a user