Make suit storage only available for hardsuits, softsuits, and armor (#27546)

* AAAAAAAAAAAAdd!

* o shit

* I FUCKING HATE INDENTATION GRAAAAAAAAAH
This commit is contained in:
Джексон Миссиссиппи
2024-05-09 21:19:07 -05:00
committed by GitHub
parent b55cf45ec5
commit da2b9afc3a
10 changed files with 38 additions and 4 deletions

View File

@@ -0,0 +1,10 @@
namespace Content.Shared.Armor;
/// <summary>
/// Used on outerclothing to allow use of suit storage
/// </summary>
[RegisterComponent]
public sealed partial class AllowSuitStorageComponent : Component
{
}

View File

@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using Content.Shared.Armor;
using Content.Shared.Clothing.Components;
using Content.Shared.DoAfter;
using Content.Shared.Hands;
@@ -114,7 +115,7 @@ public abstract partial class InventorySystem
if (!_handsSystem.CanDropHeld(actor, hands.ActiveHand!, checkActionBlocker: false))
return;
RaiseLocalEvent(held.Value, new HandDeselectedEvent(actor), false);
RaiseLocalEvent(held.Value, new HandDeselectedEvent(actor));
TryEquip(actor, actor, held.Value, ev.Slot, predicted: true, inventory: inventory, force: true, checkDoafter:true);
}
@@ -243,8 +244,16 @@ public abstract partial class InventorySystem
return false;
DebugTools.Assert(slotDefinition.Name == slot);
if (slotDefinition.DependsOn != null && !TryGetSlotEntity(target, slotDefinition.DependsOn, out _, inventory))
return false;
if (slotDefinition.DependsOn != null)
{
if (!TryGetSlotEntity(target, slotDefinition.DependsOn, out EntityUid? slotEntity, inventory))
return false;
if (slotDefinition.DependsOnComponents is { } componentRegistry)
foreach (var (_, entry) in componentRegistry)
if (!HasComp(slotEntity, entry.Component.GetType()))
return false;
}
var fittingInPocket = slotDefinition.SlotFlags.HasFlag(SlotFlags.POCKET) &&
item != null &&
@@ -301,7 +310,6 @@ public abstract partial class InventorySystem
reason = itemAttemptEvent.Reason ?? reason;
return false;
}
return true;
}

View File

@@ -34,6 +34,8 @@ public sealed partial class SlotDefinition
[DataField("dependsOn")] public string? DependsOn { get; private set; }
[DataField("dependsOnComponents")] public ComponentRegistry? DependsOnComponents { get; private set; }
[DataField("displayName", required: true)]
public string DisplayName { get; private set; } = string.Empty;

View File

@@ -21,6 +21,7 @@
Heat: 0.80
- type: ExplosionResistance
damageCoefficient: 0.90
- type: AllowSuitStorage
#Alternate / slim basic armor vest
- type: entity
@@ -211,6 +212,7 @@
- type: ExplosionResistance
damageCoefficient: 0.65
- type: GroupExamine
- type: AllowSuitStorage
- type: entity
parent: ClothingOuterBaseLarge

View File

@@ -138,6 +138,7 @@
- WhitelistChameleon
- type: ClothingRequiredStepTriggerImmune
slots: WITHOUT_POCKET
- type: AllowSuitStorage
- type: entity
abstract: true
@@ -158,6 +159,7 @@
size: Huge
- type: ClothingRequiredStepTriggerImmune
slots: WITHOUT_POCKET
- type: AllowSuitStorage
- type: entity
parent: ClothingOuterBase

View File

@@ -137,4 +137,6 @@
uiWindowPos: 2,0
strippingWindowPos: 2,5
dependsOn: outerClothing
dependsOnComponents:
- type: AllowSuitStorage
displayName: Suit Storage

View File

@@ -83,6 +83,8 @@
uiWindowPos: 2,0
strippingWindowPos: 2,5
dependsOn: outerClothing
dependsOnComponents:
- type: AllowSuitStorage
displayName: Suit Storage
- name: belt
slotTexture: belt

View File

@@ -84,6 +84,8 @@
uiWindowPos: 2,0
strippingWindowPos: 2,5
dependsOn: outerClothing
dependsOnComponents:
- type: AllowSuitStorage
displayName: Suit Storage
- name: id
slotTexture: id

View File

@@ -90,6 +90,8 @@
uiWindowPos: 2,0
strippingWindowPos: 2,5
dependsOn: outerClothing
dependsOnComponents:
- type: AllowSuitStorage
displayName: Suit Storage
- name: id
slotTexture: id

View File

@@ -45,6 +45,8 @@
uiWindowPos: 2,0
strippingWindowPos: 2,5
dependsOn: outerClothing
dependsOnComponents:
- type: AllowSuitStorage
displayName: Suit Storage
- name: outerClothing
slotTexture: suit