get that crap outta here (completely rewrites inventorysystem) (#5807)
* some work * equip: done unequip: todo * unequipping done & refactored events * workin * movin * reee namespaces * stun * mobstate * fixes * some work on events * removes serverside itemcomp & misc fixes * work * smol merge fix * ports template to prototype & finishes ui * moves relay & adds containerenumerator * actions & cuffs * my god what is actioncode * more fixes * im loosing my grasp on reality * more fixes * more work * explosions * yes * more work * more fixes * merge master & misc fixed because i forgot to commit before merging master * more fixes * fixes * moar * more work * moar fixes * suffixmap * more work on client * motivation low * no. no containers * mirroring client to server * fixes * move serverinvcomp * serverinventorycomponent is dead * gaming * only strippable & ai left... * only ai and richtext left * fixes ai * fixes * fixes sprite layers * more fixes * resolves optional * yes * stable™️ * fixes * moar fixes * moar * fix some tests * lmao * no comment * good to merge™️ * fixes build but for real * adresses some reviews * adresses some more reviews * nullables, yo * fixes lobbyscreen * timid refactor to differentiate actor & target * adresses more reviews * more * my god what a mess * removed the rest of duplicates * removed duplicate slotflags and renamed shoes to feet * removes another unused one * yes * fixes lobby & makes tryunequip return unequipped item * fixes * some funny renames * fixes * misc improvements to attemptevents * fixes * merge fixes Co-authored-by: Paul Ritter <ritter.paul1@gmail.com>
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
using Content.Shared.Inventory;
|
||||
|
||||
namespace Content.Server.AI.WorldState.States.Clothing
|
||||
{
|
||||
public sealed class ClothingSlotConState : PlanningStateData<EquipmentSlotDefines.Slots>
|
||||
public sealed class ClothingSlotConState : PlanningStateData<string>
|
||||
{
|
||||
public override string Name => "ClothingSlotCon";
|
||||
public override void Reset()
|
||||
{
|
||||
Value = EquipmentSlotDefines.Slots.NONE;
|
||||
Value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ using Content.Shared.Inventory;
|
||||
|
||||
namespace Content.Server.AI.WorldState.States.Clothing
|
||||
{
|
||||
public sealed class ClothingSlotFlagConState : PlanningStateData<EquipmentSlotDefines.SlotFlags>
|
||||
public sealed class ClothingSlotFlagConState : PlanningStateData<SlotFlags>
|
||||
{
|
||||
public override string Name => "ClothingSlotFlagCon";
|
||||
public override void Reset()
|
||||
{
|
||||
Value = EquipmentSlotDefines.SlotFlags.NONE;
|
||||
Value = SlotFlags.NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +1,35 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Inventory.Components;
|
||||
using Content.Shared.Inventory;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using InventoryComponent = Content.Shared.Inventory.InventoryComponent;
|
||||
|
||||
namespace Content.Server.AI.WorldState.States.Clothing
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class EquippedClothingState : StateData<Dictionary<EquipmentSlotDefines.Slots, EntityUid>>
|
||||
public sealed class EquippedClothingState : StateData<Dictionary<string, EntityUid>>
|
||||
{
|
||||
public override string Name => "EquippedClothing";
|
||||
|
||||
public override Dictionary<EquipmentSlotDefines.Slots, EntityUid> GetValue()
|
||||
public override Dictionary<string, EntityUid> GetValue()
|
||||
{
|
||||
var result = new Dictionary<EquipmentSlotDefines.Slots, EntityUid>();
|
||||
var result = new Dictionary<string, EntityUid>();
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out InventoryComponent? inventoryComponent))
|
||||
var invSystem = EntitySystem.Get<InventorySystem>();
|
||||
if (!invSystem.TryGetSlots(Owner, out var slotDefinitions))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
foreach (var slot in EquipmentSlotDefines.AllSlots)
|
||||
foreach (var slot in slotDefinitions)
|
||||
{
|
||||
if (!inventoryComponent.HasSlot(slot)) continue;
|
||||
var slotItem = inventoryComponent.GetSlotItem(slot);
|
||||
if (!invSystem.HasSlot(Owner, slot.Name)) continue;
|
||||
|
||||
if (slotItem != null)
|
||||
if (invSystem.TryGetSlotEntity(Owner, slot.Name, out var entityUid))
|
||||
{
|
||||
result.Add(slot, slotItem.Owner);
|
||||
result.Add(slot.Name, entityUid.Value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user