Очень важный момент для курток

This commit is contained in:
BIGZi0348
2024-11-24 18:58:00 +03:00
parent 30180b2e2a
commit 8339fd5672
8 changed files with 91 additions and 36 deletions

View File

@@ -4,6 +4,7 @@ using Robust.Client.GameObjects;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.GameStates; using Robust.Shared.GameStates;
using Robust.Shared.Reflection; using Robust.Shared.Reflection;
using Content.Shared.Foldable;
namespace Content.Client._Amour.Hole; namespace Content.Client._Amour.Hole;
@@ -17,6 +18,18 @@ public sealed class HoleSystem : SharedHoleSystem
SubscribeLocalEvent<HoleContainerComponent, EntRemovedFromContainerMessage>(OnRemoved); SubscribeLocalEvent<HoleContainerComponent, EntRemovedFromContainerMessage>(OnRemoved);
SubscribeLocalEvent<HoleComponent, ComponentHandleState>(OnHandleState); SubscribeLocalEvent<HoleComponent, ComponentHandleState>(OnHandleState);
SubscribeLocalEvent<HoleBlockerComponent, FoldedEvent>(OnFolded);
}
private void OnFolded(Entity<HoleBlockerComponent> ent, ref FoldedEvent args)
{
if (ent.Comp.Equipee == NetEntity.Invalid)
return;
var equipee = GetEntity(ent.Comp.Equipee);
if (!HasComp<HoleContainerComponent>(equipee))
return;
UpdateVisuals(equipee);
} }
private void OnHandleState(EntityUid uid, HoleComponent component, ref ComponentHandleState args) private void OnHandleState(EntityUid uid, HoleComponent component, ref ComponentHandleState args)

View File

@@ -0,0 +1,10 @@
using Robust.Shared.GameStates;
namespace Content.Shared._Amour.Hole;
[RegisterComponent, AutoGenerateComponentState, NetworkedComponent]
public sealed partial class HoleBlockerComponent : Component
{
[ViewVariables(VVAccess.ReadOnly), AutoNetworkedField]
public NetEntity Equipee = NetEntity.Invalid;
}

View File

@@ -0,0 +1,23 @@
using Content.Shared.Inventory.Events;
namespace Content.Shared._Amour.Hole;
public sealed class HoleBlockerSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<HoleBlockerComponent, GotEquippedEvent>(OnHoleBlockerEquipped);
SubscribeLocalEvent<HoleBlockerComponent, GotUnequippedEvent>(OnHoleBlockerUnequipped);
}
private void OnHoleBlockerEquipped(Entity<HoleBlockerComponent> ent, ref GotEquippedEvent args)
{
ent.Comp.Equipee = GetNetEntity(args.Equipee);
}
private void OnHoleBlockerUnequipped(Entity<HoleBlockerComponent> ent, ref GotUnequippedEvent args)
{
ent.Comp.Equipee = NetEntity.Invalid;
}
}

View File

@@ -29,6 +29,7 @@ public sealed partial class HoleComponent : Component
[ViewVariables(VVAccess.ReadWrite)] public bool IsExcited = false; [ViewVariables(VVAccess.ReadWrite)] public bool IsExcited = false;
[DataField] public bool IsMainHole = false; [DataField] public bool IsMainHole = false;
[DataField] public bool IsVisibleInSkirt = true; [DataField] public bool IsVisibleInSkirt = true;
[DataField] public bool IsVisibleInFoldedJumpsuit = false;
} }
[Serializable, NetSerializable, DataDefinition] [Serializable, NetSerializable, DataDefinition]

View File

@@ -1,4 +1,5 @@
using Content.Shared.Inventory; using Content.Shared.Inventory;
using Content.Shared.Foldable;
namespace Content.Shared._Amour.Hole; namespace Content.Shared._Amour.Hole;
@@ -22,9 +23,14 @@ public partial class SharedHoleSystem
foreach (var slot in hole.Comp.HoleNotVisibleIn) foreach (var slot in hole.Comp.HoleNotVisibleIn)
{ {
if (slot == "jumpsuit" && _inventory.TryGetSlotEntity(entity, "jumpsuit", out var jumpsuit, entity) && TryComp<FoldableComponent>(jumpsuit, out var foldedItem) && foldedItem.IsFolded && hole.Comp.IsVisibleInFoldedJumpsuit)
continue;
if (_inventory.TryGetSlotEntity(entity, slot, out var item, entity) && !(HasComp<VisibleHoleComponent>(item) && hole.Comp.IsVisibleInSkirt)) if (_inventory.TryGetSlotEntity(entity, slot, out var item, entity) && !(HasComp<VisibleHoleComponent>(item) && hole.Comp.IsVisibleInSkirt))
{
return false; return false;
} }
}
return true; return true;
} }

View File

@@ -95,4 +95,5 @@
- state: icon_folded - state: icon_folded
map: ["foldedLayer"] map: ["foldedLayer"]
visible: false visible: false
- type: HoleBlocker # AMOUR EDIT
# WD End # WD End

View File

@@ -88,6 +88,7 @@
prefix: "_0_FRONT" prefix: "_0_FRONT"
excitedPrefix: "_1_FRONT" excitedPrefix: "_1_FRONT"
isVisibleInSkirt: false isVisibleInSkirt: false
isVisibleInFoldedJumpsuit: true
- type: HoleSolution - type: HoleSolution
- type: HoleInventory - type: HoleInventory