From 8339fd56724b18d79207864564604cfd9651e0b6 Mon Sep 17 00:00:00 2001 From: BIGZi0348 Date: Sun, 24 Nov 2024 18:58:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=87=D0=B5=D0=BD=D1=8C=20=D0=B2=D0=B0?= =?UTF-8?q?=D0=B6=D0=BD=D1=8B=D0=B9=20=D0=BC=D0=BE=D0=BC=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D0=BA=D1=83=D1=80=D1=82=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Client/_Amour/Hole/HoleSystem.cs | 51 ++++++++++++------- .../_Amour/Hole/HoleBlockerComponent.cs | 10 ++++ .../_Amour/Hole/HoleBlockerSystem.cs | 23 +++++++++ Content.Shared/_Amour/Hole/HoleComponent.cs | 3 +- .../_Amour/Hole/HoleSystem.Access.cs | 18 ++++--- .../_Amour/Hole/HoleSystem.Container.cs | 20 ++++---- .../Uniforms/base_clothinguniforms.yml | 1 + .../Prototypes/_Amour/Entities/Holes/base.yml | 1 + 8 files changed, 91 insertions(+), 36 deletions(-) create mode 100644 Content.Shared/_Amour/Hole/HoleBlockerComponent.cs create mode 100644 Content.Shared/_Amour/Hole/HoleBlockerSystem.cs diff --git a/Content.Client/_Amour/Hole/HoleSystem.cs b/Content.Client/_Amour/Hole/HoleSystem.cs index cb779948dc..5762d40eb8 100644 --- a/Content.Client/_Amour/Hole/HoleSystem.cs +++ b/Content.Client/_Amour/Hole/HoleSystem.cs @@ -4,6 +4,7 @@ using Robust.Client.GameObjects; using Robust.Shared.Containers; using Robust.Shared.GameStates; using Robust.Shared.Reflection; +using Content.Shared.Foldable; namespace Content.Client._Amour.Hole; @@ -13,15 +14,27 @@ public sealed class HoleSystem : SharedHoleSystem public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(OnInsert); - SubscribeLocalEvent(OnRemoved); + SubscribeLocalEvent(OnInsert); + SubscribeLocalEvent(OnRemoved); - SubscribeLocalEvent(OnHandleState); + SubscribeLocalEvent(OnHandleState); + + SubscribeLocalEvent(OnFolded); } - private void OnHandleState(EntityUid uid, HoleComponent component,ref ComponentHandleState args) + private void OnFolded(Entity ent, ref FoldedEvent args) { - if(args.Current is not HoleComponentState componentState) + if (ent.Comp.Equipee == NetEntity.Invalid) + return; + var equipee = GetEntity(ent.Comp.Equipee); + if (!HasComp(equipee)) + return; + UpdateVisuals(equipee); + } + + private void OnHandleState(EntityUid uid, HoleComponent component, ref ComponentHandleState args) + { + if (args.Current is not HoleComponentState componentState) return; component.IsExcited = componentState.IsExcited; @@ -29,25 +42,25 @@ public sealed class HoleSystem : SharedHoleSystem if (component.Parent is not null) { - UpdateVisual(GetEntity(component.Parent.Value),uid,!HasAccessTo(GetEntity(component.Parent.Value),uid)); + UpdateVisual(GetEntity(component.Parent.Value), uid, !HasAccessTo(GetEntity(component.Parent.Value), uid)); } } private void OnRemoved(EntityUid uid, HoleContainerComponent component, EntRemovedFromContainerMessage args) { - if(!HasComp(uid)) + if (!HasComp(uid)) return; UpdateVisuals(uid); - if(args.Container != component.Slot) + if (args.Container != component.Slot) return; - UpdateVisual(uid,args.Entity,true); + UpdateVisual(uid, args.Entity, true); } private void OnInsert(EntityUid uid, HoleContainerComponent component, EntInsertedIntoContainerMessage args) { - if(!HasComp(uid)) + if (!HasComp(uid)) return; UpdateVisuals(uid); @@ -55,18 +68,18 @@ public sealed class HoleSystem : SharedHoleSystem private void UpdateVisuals(Entity entity) { - if(!Resolve(entity,ref entity.Comp) || entity.Comp.Slot == null) + if (!Resolve(entity, ref entity.Comp) || entity.Comp.Slot == null) return; foreach (var hole in entity.Comp.Slot.ContainedEntities) { - UpdateVisual(entity.Owner,hole,!HasAccessTo(entity,hole)); + UpdateVisual(entity.Owner, hole, !HasAccessTo(entity, hole)); } } - private void UpdateVisual(Entity owner, Entity entity, bool clear = false) + private void UpdateVisual(Entity owner, Entity entity, bool clear = false) { - if(!Resolve(owner.Owner,ref owner.Comp1, ref owner.Comp3) || !Resolve(entity.Owner,ref entity.Comp)) + if (!Resolve(owner.Owner, ref owner.Comp1, ref owner.Comp3) || !Resolve(entity.Owner, ref entity.Comp)) return; var spriteComp = owner.Comp1; @@ -87,11 +100,11 @@ public sealed class HoleSystem : SharedHoleSystem if (holeComp.Prefixes.Count == 0) { if (clear) - spriteComp.LayerSetVisible(GenitalVisualLayers.DickFront,false); + spriteComp.LayerSetVisible(GenitalVisualLayers.DickFront, false); else { spriteComp.LayerSetData(GenitalVisualLayers.DickFront, layer); - spriteComp.LayerSetVisible(GenitalVisualLayers.DickFront,true); + spriteComp.LayerSetVisible(GenitalVisualLayers.DickFront, true); } return; } @@ -106,7 +119,7 @@ public sealed class HoleSystem : SharedHoleSystem if (clear) { - spriteComp.LayerSetVisible(@enum,false); + spriteComp.LayerSetVisible(@enum, false); } else { @@ -120,7 +133,7 @@ public sealed class HoleSystem : SharedHoleSystem layer.State = state + s + mainPrefix; spriteComp.LayerSetData(@enum, layer); - spriteComp.LayerSetVisible(@enum,true); + spriteComp.LayerSetVisible(@enum, true); layer.State = state; } @@ -130,7 +143,7 @@ public sealed class HoleSystem : SharedHoleSystem public override void Exide(Entity entity, bool value = true) { - if(!Resolve(entity.Owner,ref entity.Comp)) return; + if (!Resolve(entity.Owner, ref entity.Comp)) return; base.Exide(entity, value); var netEntity = entity.Comp.Parent; if (netEntity != null) diff --git a/Content.Shared/_Amour/Hole/HoleBlockerComponent.cs b/Content.Shared/_Amour/Hole/HoleBlockerComponent.cs new file mode 100644 index 0000000000..da5979d2e3 --- /dev/null +++ b/Content.Shared/_Amour/Hole/HoleBlockerComponent.cs @@ -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; +} diff --git a/Content.Shared/_Amour/Hole/HoleBlockerSystem.cs b/Content.Shared/_Amour/Hole/HoleBlockerSystem.cs new file mode 100644 index 0000000000..c8bfe49dd5 --- /dev/null +++ b/Content.Shared/_Amour/Hole/HoleBlockerSystem.cs @@ -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(OnHoleBlockerEquipped); + SubscribeLocalEvent(OnHoleBlockerUnequipped); + } + + private void OnHoleBlockerEquipped(Entity ent, ref GotEquippedEvent args) + { + ent.Comp.Equipee = GetNetEntity(args.Equipee); + } + + private void OnHoleBlockerUnequipped(Entity ent, ref GotUnequippedEvent args) + { + ent.Comp.Equipee = NetEntity.Invalid; + } +} diff --git a/Content.Shared/_Amour/Hole/HoleComponent.cs b/Content.Shared/_Amour/Hole/HoleComponent.cs index 234741202b..1c8fa397ff 100644 --- a/Content.Shared/_Amour/Hole/HoleComponent.cs +++ b/Content.Shared/_Amour/Hole/HoleComponent.cs @@ -29,6 +29,7 @@ public sealed partial class HoleComponent : Component [ViewVariables(VVAccess.ReadWrite)] public bool IsExcited = false; [DataField] public bool IsMainHole = false; [DataField] public bool IsVisibleInSkirt = true; + [DataField] public bool IsVisibleInFoldedJumpsuit = false; } [Serializable, NetSerializable, DataDefinition] @@ -51,7 +52,7 @@ public enum HoleType : byte Mother } -[Serializable,NetSerializable] +[Serializable, NetSerializable] public sealed partial class HoleComponentState : ComponentState { public readonly NetEntity? Parent; diff --git a/Content.Shared/_Amour/Hole/HoleSystem.Access.cs b/Content.Shared/_Amour/Hole/HoleSystem.Access.cs index 92a4902622..64b20423ae 100644 --- a/Content.Shared/_Amour/Hole/HoleSystem.Access.cs +++ b/Content.Shared/_Amour/Hole/HoleSystem.Access.cs @@ -1,4 +1,5 @@ using Content.Shared.Inventory; +using Content.Shared.Foldable; namespace Content.Shared._Amour.Hole; @@ -6,30 +7,35 @@ public partial class SharedHoleSystem { [Dependency] private readonly InventorySystem _inventory = default!; - public bool HasAccessTo(Entity entity, string to) + public bool HasAccessTo(Entity entity, string to) { - if (!Resolve(entity.Owner, ref entity.Comp1) || !TryFind(entity,to,out var hole)) + if (!Resolve(entity.Owner, ref entity.Comp1) || !TryFind(entity, to, out var hole)) return false; - return HasAccessTo(entity, new Entity(hole.Owner,hole.Comp)); + return HasAccessTo(entity, new Entity(hole.Owner, hole.Comp)); } - public bool HasAccessTo(Entity entity, Entity hole) + public bool HasAccessTo(Entity entity, Entity hole) { - if (!Resolve(entity, ref entity.Comp1) || !Resolve(hole,ref hole.Comp)) + if (!Resolve(entity, ref entity.Comp1) || !Resolve(hole, ref hole.Comp)) return false; if (!Resolve(entity, ref entity.Comp2)) return true; foreach (var slot in hole.Comp.HoleNotVisibleIn) { + if (slot == "jumpsuit" && _inventory.TryGetSlotEntity(entity, "jumpsuit", out var jumpsuit, entity) && TryComp(jumpsuit, out var foldedItem) && foldedItem.IsFolded && hole.Comp.IsVisibleInFoldedJumpsuit) + continue; + if (_inventory.TryGetSlotEntity(entity, slot, out var item, entity) && !(HasComp(item) && hole.Comp.IsVisibleInSkirt)) + { return false; + } } return true; } - public bool TryFind(Entity entity,string to, out Entity hole) + public bool TryFind(Entity entity, string to, out Entity hole) { hole = new Entity(); if (!Resolve(entity.Owner, ref entity.Comp)) diff --git a/Content.Shared/_Amour/Hole/HoleSystem.Container.cs b/Content.Shared/_Amour/Hole/HoleSystem.Container.cs index e864817fad..b9c97b5262 100644 --- a/Content.Shared/_Amour/Hole/HoleSystem.Container.cs +++ b/Content.Shared/_Amour/Hole/HoleSystem.Container.cs @@ -11,8 +11,8 @@ public abstract partial class SharedHoleSystem [Dependency] private readonly IPrototypeManager _prototypeManager = default!; public void InitializeContainer() { - SubscribeLocalEvent(OnContainerInit); - SubscribeLocalEvent(OnAppearanceLoaded); + SubscribeLocalEvent(OnContainerInit); + SubscribeLocalEvent(OnAppearanceLoaded); SubscribeLocalEvent(OnClone); } @@ -22,19 +22,19 @@ public abstract partial class SharedHoleSystem foreach (var entity in component.Slot.ContainedEntities) { var meta = MetaData(entity); - if(meta.EntityPrototype is null || !TryComp(entity, out var holeComponent)) + if (meta.EntityPrototype is null || !TryComp(entity, out var holeComponent)) continue; - AddHole(new Entity(args.Target,holeContainerComponent), meta.EntityPrototype.ID, holeComponent.Layers[0].Color); + AddHole(new Entity(args.Target, holeContainerComponent), meta.EntityPrototype.ID, holeComponent.Layers[0].Color); } - Dirty(args.Target,holeContainerComponent); + Dirty(args.Target, holeContainerComponent); } private void OnAppearanceLoaded(EntityUid uid, HoleContainerComponent component, HumanoidAppearanceLoadedEvent args) { foreach (var genitals in args.Profile.Appearance.Genitals) { - AddHole(new Entity(uid,component),genitals.GenitalId,genitals.Color); + AddHole(new Entity(uid, component), genitals.GenitalId, genitals.Color); } } @@ -43,7 +43,7 @@ public abstract partial class SharedHoleSystem component.Slot = _containerSystem.EnsureContainer(uid, HoleContainerComponent.SlotName); foreach (var protoId in component.HolePrototypes) { - AddHole(new Entity(uid,component),protoId); + AddHole(new Entity(uid, component), protoId); } } @@ -54,8 +54,8 @@ public abstract partial class SharedHoleSystem Log.Error(protoId + " NOT EXIST YOU BASTARD!"); return; } - if (!Resolve(entity.Owner, ref entity.Comp,logMissing:false)) - entity.Comp = EnsureComp(entity.Owner); + if (!Resolve(entity.Owner, ref entity.Comp, logMissing: false)) + entity.Comp = EnsureComp(entity.Owner); var spawned = Spawn(protoId); if (!TryComp(spawned, out var component)) @@ -70,6 +70,6 @@ public abstract partial class SharedHoleSystem entity.Comp.MainHole = GetNetEntity(spawned); _containerSystem.Insert(spawned, entity.Comp.Slot); - Dirty(spawned,component); + Dirty(spawned, component); } } diff --git a/Resources/Prototypes/Entities/Clothing/Uniforms/base_clothinguniforms.yml b/Resources/Prototypes/Entities/Clothing/Uniforms/base_clothinguniforms.yml index dc9edf45c0..aa9af63010 100644 --- a/Resources/Prototypes/Entities/Clothing/Uniforms/base_clothinguniforms.yml +++ b/Resources/Prototypes/Entities/Clothing/Uniforms/base_clothinguniforms.yml @@ -95,4 +95,5 @@ - state: icon_folded map: ["foldedLayer"] visible: false + - type: HoleBlocker # AMOUR EDIT # WD End diff --git a/Resources/Prototypes/_Amour/Entities/Holes/base.yml b/Resources/Prototypes/_Amour/Entities/Holes/base.yml index 0e03f27e9b..47ed7c6279 100644 --- a/Resources/Prototypes/_Amour/Entities/Holes/base.yml +++ b/Resources/Prototypes/_Amour/Entities/Holes/base.yml @@ -88,6 +88,7 @@ prefix: "_0_FRONT" excitedPrefix: "_1_FRONT" isVisibleInSkirt: false + isVisibleInFoldedJumpsuit: true - type: HoleSolution - type: HoleInventory