From c9396e7b5aee0e3da1eaa40d358d1b2bbe5045b2 Mon Sep 17 00:00:00 2001 From: Cinka Date: Wed, 14 Feb 2024 23:27:46 +0300 Subject: [PATCH] - add: improve system --- Content.Client/_Amour/Hole/HoleSystem.cs | 88 ++++++++++--- .../_Amour/Hole/HoleSystem.Container.cs | 24 ---- .../_Amour/Hole/HoleSystem.Inventory.cs | 3 +- Content.Server/_Amour/Hole/HoleSystem.cs | 8 +- .../_Amour/Hole/GenitalVisualLayers.cs | 16 +++ Content.Shared/_Amour/Hole/HoleComponent.cs | 20 ++- .../_Amour/Hole/HoleContainerComponent.cs | 1 + .../_Amour/Hole/HoleSystem.Access.cs | 51 ++++++++ .../_Amour/Hole/HoleSystem.Container.cs | 32 +++++ Content.Shared/_Amour/Hole/HoleSystem.cs | 18 ++- .../Prototypes/Entities/Mobs/Species/base.yml | 14 +++ Resources/Prototypes/Entities/Mobs/base.yml | 5 - .../_Amour/Entities/Holes/genitals.yml | 116 +++++++++++++++--- 13 files changed, 322 insertions(+), 74 deletions(-) delete mode 100644 Content.Server/_Amour/Hole/HoleSystem.Container.cs create mode 100644 Content.Shared/_Amour/Hole/GenitalVisualLayers.cs create mode 100644 Content.Shared/_Amour/Hole/HoleSystem.Access.cs create mode 100644 Content.Shared/_Amour/Hole/HoleSystem.Container.cs diff --git a/Content.Client/_Amour/Hole/HoleSystem.cs b/Content.Client/_Amour/Hole/HoleSystem.cs index b2945d5868..e8084ec8de 100644 --- a/Content.Client/_Amour/Hole/HoleSystem.cs +++ b/Content.Client/_Amour/Hole/HoleSystem.cs @@ -2,49 +2,109 @@ using Content.Shared.Humanoid; using Robust.Client.GameObjects; using Robust.Shared.Containers; +using Robust.Shared.Reflection; +using Robust.Shared.Serialization.Manager; namespace Content.Client._Amour.Hole; public sealed class HoleSystem : SharedHoleSystem { + [Dependency] private readonly IReflectionManager _reflection = default!; public override void Initialize() { + base.Initialize(); SubscribeLocalEvent(OnInsert); SubscribeLocalEvent(OnRemoved); } private void OnRemoved(EntityUid uid, HoleContainerComponent component, EntRemovedFromContainerMessage args) { - Log.Debug("A VSE"); + if(!HasComp(uid)) + return; + + UpdateVisuals(uid); + if(args.Container != component.Slot) + return; + + UpdateVisual(uid,args.Entity,true); } private void OnInsert(EntityUid uid, HoleContainerComponent component, EntInsertedIntoContainerMessage args) { - if(!TryComp(uid, out var sprite) || !TryComp(args.Entity,out var hole)) + if(!HasComp(uid)) return; - Log.Debug("DRAW PISYA"); - DrawShit(uid,args.Entity); + UpdateVisuals(uid); + if(args.Container != component.Slot) + return; + + //UpdateVisual(uid,args.Entity); } - private void DrawShit(Entity owner, Entity entity) + private void UpdateVisuals(Entity entity) { - if(!Resolve(owner.Owner,ref owner.Comp1, ref owner.Comp2) || !Resolve(entity.Owner,ref entity.Comp)) + 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)); + } + } + + private void UpdateVisual(Entity owner, Entity entity, bool clear = false) + { + if(!Resolve(owner.Owner,ref owner.Comp1) || !Resolve(entity.Owner,ref entity.Comp)) return; var spriteComp = owner.Comp1; var holeComp = entity.Comp; - foreach (var layer in holeComp.BehindLayer) + foreach (var layer in holeComp.Layers) { - var l = spriteComp.AddLayer(layer, 0); - spriteComp[l].Color = layer.Color ?? owner.Comp2.SkinColor; - } + if (string.IsNullOrEmpty(layer.RsiPath)) + layer.RsiPath = holeComp.RsiPath; - foreach (var layer in holeComp.FrontLayer) - { - var l = spriteComp.AddLayer(layer); - spriteComp[l].Color = layer.Color ?? owner.Comp2.SkinColor; + if(Resolve(owner.Owner,ref owner.Comp2)) + layer.Color ??= owner.Comp2.SkinColor; + + var state = layer.State; + + if (holeComp.Prefixes.Count == 0) + { + if (clear) + spriteComp.LayerSetVisible(GenitalVisualLayers.DickFront,false); + else + { + spriteComp.LayerSetData(GenitalVisualLayers.DickFront, layer); + spriteComp.LayerSetVisible(GenitalVisualLayers.DickFront,true); + } + + + return; + } + + foreach (var prefix in holeComp.Prefixes) + { + if (!_reflection.TryParseEnumReference(prefix.Layer, out var @enum)) + { + Log.Error("FUCK! ERROR WITH " + prefix.Layer); + continue; + } + + layer.State = state + prefix.Prefix; + if (clear) + { + spriteComp.LayerSetVisible(@enum,false); + } + else + { + Log.Debug(@enum.ToString()); + spriteComp.LayerSetData(@enum, layer); + spriteComp.LayerSetVisible(@enum,true); + } + + layer.State = state; + } } } } diff --git a/Content.Server/_Amour/Hole/HoleSystem.Container.cs b/Content.Server/_Amour/Hole/HoleSystem.Container.cs deleted file mode 100644 index d37a48b42b..0000000000 --- a/Content.Server/_Amour/Hole/HoleSystem.Container.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Content.Shared._Amour.Hole; -using Robust.Server.Containers; -using Robust.Shared.Containers; - -namespace Content.Server._Amour.Hole; - -public sealed partial class HoleSystem -{ - [Dependency] private readonly ContainerSystem _containerSystem = default!; - private void InitializeContainer() - { - SubscribeLocalEvent(OnContainerInit); - } - - private void OnContainerInit(EntityUid uid, HoleContainerComponent component, ComponentInit args) - { - component.Slot = _containerSystem.EnsureContainer(uid, HoleContainerComponent.SlotName); - foreach (var holePrototype in component.HolePrototypes) - { - Log.Debug("ADDED " + holePrototype); - _containerSystem.Insert(Spawn(holePrototype), component.Slot); - } - } -} diff --git a/Content.Server/_Amour/Hole/HoleSystem.Inventory.cs b/Content.Server/_Amour/Hole/HoleSystem.Inventory.cs index a66d7047dc..9ccd336b7e 100644 --- a/Content.Server/_Amour/Hole/HoleSystem.Inventory.cs +++ b/Content.Server/_Amour/Hole/HoleSystem.Inventory.cs @@ -7,7 +7,8 @@ namespace Content.Server._Amour.Hole; public sealed partial class HoleSystem { [Dependency] private readonly ContainerSystem _container = default!; - public void InitializeInventory() + + private void InitializeInventory() { SubscribeLocalEvent(OnInventoryInit); } diff --git a/Content.Server/_Amour/Hole/HoleSystem.cs b/Content.Server/_Amour/Hole/HoleSystem.cs index 2e7503caa6..ceb4b46701 100644 --- a/Content.Server/_Amour/Hole/HoleSystem.cs +++ b/Content.Server/_Amour/Hole/HoleSystem.cs @@ -12,14 +12,8 @@ public sealed partial class HoleSystem : SharedHoleSystem public override void Initialize() { - InitializeContainer(); + base.Initialize(); InitializeInventory(); - SubscribeLocalEvent(OnInsert); - } - - private void OnInsert(EntityUid uid, HoleComponent component, EntGotInsertedIntoContainerMessage args) - { - component.Parent = GetNetEntity(args.Container.Owner); } public override void Update(float frameTime) diff --git a/Content.Shared/_Amour/Hole/GenitalVisualLayers.cs b/Content.Shared/_Amour/Hole/GenitalVisualLayers.cs new file mode 100644 index 0000000000..ba3ad02f07 --- /dev/null +++ b/Content.Shared/_Amour/Hole/GenitalVisualLayers.cs @@ -0,0 +1,16 @@ +namespace Content.Shared._Amour.Hole; + +public enum GenitalVisualLayers : byte +{ + ButtBehind, + BreastBehind, + VaginaBehind, + TesticlesBehind, + DickBehind, + + ButtFront, + BreastFront, + VaginaFront, + TesticlesFront, + DickFront, +} diff --git a/Content.Shared/_Amour/Hole/HoleComponent.cs b/Content.Shared/_Amour/Hole/HoleComponent.cs index cf6e4dfdb3..545323909c 100644 --- a/Content.Shared/_Amour/Hole/HoleComponent.cs +++ b/Content.Shared/_Amour/Hole/HoleComponent.cs @@ -11,14 +11,28 @@ namespace Content.Shared._Amour.Hole; [RegisterComponent] public sealed partial class HoleComponent : Component { - [ViewVariables] public NetEntity Parent; + [ViewVariables] public NetEntity? Parent; + + [DataField] public string HoleName = ""; + [DataField] public List HoleNotVisibleIn = new(); // Father can be in mother, its like in audiofil shit [DataField] public HoleType HoleType = HoleType.Flat; [DataField("sprite")] public string? RsiPath; - [DataField] public List FrontLayer = new(); - [DataField] public List BehindLayer = new(); + [DataField] public List Layers = new(); + + // this shit just for sprite prefix like state: dildo_FRONT + [DataField] public List Prefixes = new(); +} + +[Serializable, NetSerializable, DataDefinition] +public sealed partial class HolePrefix +{ + [DataField] + public string Layer; + [DataField] + public string Prefix; } public enum HoleType : byte diff --git a/Content.Shared/_Amour/Hole/HoleContainerComponent.cs b/Content.Shared/_Amour/Hole/HoleContainerComponent.cs index 97c05e2543..61f99fa019 100644 --- a/Content.Shared/_Amour/Hole/HoleContainerComponent.cs +++ b/Content.Shared/_Amour/Hole/HoleContainerComponent.cs @@ -1,4 +1,5 @@ using Robust.Shared.Containers; +using Robust.Shared.GameStates; using Robust.Shared.Prototypes; namespace Content.Shared._Amour.Hole; diff --git a/Content.Shared/_Amour/Hole/HoleSystem.Access.cs b/Content.Shared/_Amour/Hole/HoleSystem.Access.cs new file mode 100644 index 0000000000..7c3b42b620 --- /dev/null +++ b/Content.Shared/_Amour/Hole/HoleSystem.Access.cs @@ -0,0 +1,51 @@ +using Content.Shared.Inventory; + +namespace Content.Shared._Amour.Hole; + +public partial class SharedHoleSystem +{ + [Dependency] private readonly InventorySystem _inventory = default!; + + public bool HasAccessTo(Entity entity, string to) + { + if (!Resolve(entity.Owner, ref entity.Comp1) || !TryFind(entity,to,out var hole)) + return false; + return HasAccessTo(entity, new Entity(hole.Owner,hole.Comp)); + } + + public bool HasAccessTo(Entity entity, Entity hole) + { + 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 (_inventory.TryGetSlotEntity(entity, slot, out _, entity)) + return false; + } + + return true; + } + + public bool TryFind(Entity entity,string to, out Entity hole) + { + hole = new Entity(); + if (!Resolve(entity.Owner, ref entity.Comp)) + return false; + + foreach (var holeUid in entity.Comp.Slot.ContainedEntities) + { + if (!TryComp(holeUid, out var holeComponent) || holeComponent.HoleName != to) + continue; + + hole.Owner = holeUid; + hole.Comp = holeComponent; + return true; + } + + return false; + } + +} diff --git a/Content.Shared/_Amour/Hole/HoleSystem.Container.cs b/Content.Shared/_Amour/Hole/HoleSystem.Container.cs new file mode 100644 index 0000000000..db90fe7a31 --- /dev/null +++ b/Content.Shared/_Amour/Hole/HoleSystem.Container.cs @@ -0,0 +1,32 @@ +using Robust.Shared.Containers; +using Robust.Shared.Prototypes; + +namespace Content.Shared._Amour.Hole; + +public abstract partial class SharedHoleSystem +{ + [Dependency] private readonly SharedContainerSystem _containerSystem = default!; + public void InitializeContainer() + { + SubscribeLocalEvent(OnContainerInit); + } + + private void OnContainerInit(EntityUid uid, HoleContainerComponent component, ComponentInit args) + { + component.Slot = _containerSystem.EnsureContainer(uid, HoleContainerComponent.SlotName); + foreach (var protoId in component.HolePrototypes) + { + AddHole(new Entity(uid,component),protoId); + } + } + + public void AddHole(Entity entity, EntProtoId protoId) + { + if (!Resolve(entity.Owner, ref entity.Comp)) + return; + //entity.Comp = EnsureComp(entity.Owner); + + Log.Debug("ADDED " + protoId); + _containerSystem.Insert(Spawn(protoId), entity.Comp.Slot); + } +} diff --git a/Content.Shared/_Amour/Hole/HoleSystem.cs b/Content.Shared/_Amour/Hole/HoleSystem.cs index 71d7047fad..749737fe1b 100644 --- a/Content.Shared/_Amour/Hole/HoleSystem.cs +++ b/Content.Shared/_Amour/Hole/HoleSystem.cs @@ -1,9 +1,23 @@ using Robust.Shared.Containers; -using Robust.Shared.Timing; namespace Content.Shared._Amour.Hole; -public abstract class SharedHoleSystem : EntitySystem +public abstract partial class SharedHoleSystem : EntitySystem { + public override void Initialize() + { + InitializeContainer(); + SubscribeLocalEvent(OnInsert); + SubscribeLocalEvent(OnRemoved); + } + private void OnRemoved(EntityUid uid, HoleComponent component, EntGotRemovedFromContainerMessage args) + { + component.Parent = null; + } + + private void OnInsert(EntityUid uid, HoleComponent component, EntGotInsertedIntoContainerMessage args) + { + component.Parent = GetNetEntity(args.Container.Owner); + } } diff --git a/Resources/Prototypes/Entities/Mobs/Species/base.yml b/Resources/Prototypes/Entities/Mobs/Species/base.yml index 3b8cf5a912..06dd3ffbf2 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/base.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/base.yml @@ -9,6 +9,13 @@ components: - type: Sprite layers: + # START AMOUR EDIT + - map: [ "enum.GenitalVisualLayers.ButtBehind"] + - map: [ "enum.GenitalVisualLayers.BreastBehind"] + - map: [ "enum.GenitalVisualLayers.VaginaBehind"] + - map: [ "enum.GenitalVisualLayers.TesticlesBehind"] + - map: [ "enum.GenitalVisualLayers.DickBehind"] + # END AMOUR EDIT - map: [ "enum.HumanoidVisualLayers.Chest" ] - map: [ "enum.HumanoidVisualLayers.Head" ] - map: [ "enum.HumanoidVisualLayers.Snout" ] @@ -35,6 +42,13 @@ - map: ["jumpsuit"] - map: ["enum.HumanoidVisualLayers.LHand"] - map: ["enum.HumanoidVisualLayers.RHand"] + # START AMOUR EDIT + - map: [ "enum.GenitalVisualLayers.ButtFront" ] + - map: [ "enum.GenitalVisualLayers.BreastFront" ] + - map: [ "enum.GenitalVisualLayers.VaginaFront" ] + - map: [ "enum.GenitalVisualLayers.TesticlesFront" ] + - map: [ "enum.GenitalVisualLayers.DickFront" ] + # END AMOUR EDIT - map: [ "gloves" ] - map: [ "shoes" ] - map: [ "ears" ] diff --git a/Resources/Prototypes/Entities/Mobs/base.yml b/Resources/Prototypes/Entities/Mobs/base.yml index b253810db3..c335f731e3 100644 --- a/Resources/Prototypes/Entities/Mobs/base.yml +++ b/Resources/Prototypes/Entities/Mobs/base.yml @@ -43,11 +43,6 @@ - type: MovementSpeedModifier - type: Polymorphable - type: StatusIcon - - type: HoleContainer - holePrototypes: - - BaseDick - - BaseBreast - - BaseButt # Used for mobs that have health and can take damage. - type: entity diff --git a/Resources/Prototypes/_Amour/Entities/Holes/genitals.yml b/Resources/Prototypes/_Amour/Entities/Holes/genitals.yml index 2b11ce1309..ad28fea60f 100644 --- a/Resources/Prototypes/_Amour/Entities/Holes/genitals.yml +++ b/Resources/Prototypes/_Amour/Entities/Holes/genitals.yml @@ -1,15 +1,22 @@ - type: entity id: BaseDick + abstract: true name: Чилен components: - type: Hole holeType: Father - frontLayer: - - state: penis_thick_4_1_FRONT - sprite: _Amour/Genitals/penis.rsi - behindLayer: - - state: penis_thick_4_1_BEHIND - sprite: _Amour/Genitals/penis.rsi + holeName: Dick + holeNotVisibleIn: + - suitstorage + - outerClothing + - jumpsuit + - underwearb + sprite: _Amour/Genitals/penis.rsi + prefixes: + - layer: "enum.GenitalVisualLayers.DickBehind" + prefix: "_BEHIND" + - layer: "enum.GenitalVisualLayers.DickFront" + prefix: "_FRONT" - type: HoleSolution - type: HoleInventory size: Tiny @@ -17,35 +24,63 @@ - type: entity id: BaseVagina + abstract: true name: Пизда components: - type: Hole holeType: Mother + holeName: Vagina + holeNotVisibleIn: + - suitstorage + - outerClothing + - jumpsuit + - underwearb + sprite: _Amour/Genitals/butt.rsi + prefixes: + - layer: "enum.GenitalVisualLayers.VaginaBehind" + prefix: "_BEHIND" + - layer: "enum.GenitalVisualLayers.VaginaFront" + prefix: "_FRONT" - type: HoleSolution - type: HoleInventory - type: entity id: BaseButt + abstract: true name: Очко components: - type: Hole holeType: Mother - frontLayer: - - state: butt_pair_3_s_0_FRONT - sprite: _Amour/Genitals/butt.rsi + holeName: Anus + holeNotVisibleIn: + - suitstorage + - outerClothing + - jumpsuit + - underwearb + sprite: _Amour/Genitals/butt.rsi + prefixes: + - layer: "enum.GenitalVisualLayers.ButtFront" + prefix: "_FRONT" - type: HoleInventory - type: entity id: BaseBreast + abstract: true name: Сиськи components: - type: Hole - frontLayer: - - state: breasts_pair_i_s_0_FRONT - sprite: _Amour/Genitals/breasts.rsi - behindLayer: - - state: breasts_pair_i_s_0_BEHIND - sprite: _Amour/Genitals/breasts.rsi + holeName: Breast + holeNotVisibleIn: + - suitstorage + - outerClothing + - jumpsuit + - underweart + sprite: _Amour/Genitals/breasts.rsi + prefixes: + - layer: "enum.GenitalVisualLayers.BreastBehind" + prefix: "_BEHIND" + - layer: "enum.GenitalVisualLayers.BreastFront" + prefix: "_FRONT" - type: HoleInventory - type: entity @@ -53,6 +88,51 @@ name: Яички components: - type: Hole - frontLayer: - - state: testicles_single_5_s_1_FRONT - sprite: _Amour/Genitals/testicles.rsi + holeName: Dick + holeNotVisibleIn: + - suitstorage + - outerClothing + - jumpsuit + - underwearb + sprite: _Amour/Genitals/testicles.rsi + prefixes: + - layer: "enum.GenitalVisualLayers.TesticlesBehind" + prefix: "_BEHIND" + - layer: "enum.GenitalVisualLayers.TesticlesFront" + prefix: "_FRONT" + + +- type: entity + parent: BaseDick + id: Dick + components: + - type: Hole + layers: + - state: penis_thick_4_1 + +- type: entity + parent: BaseButt + id: Butt + components: + - type: Hole + layers: + - state: butt_pair_3_s_0 + +- type: entity + parent: BaseBreast + id: Breast + components: + - type: Hole + layers: + - state: breasts_pair_huge_s_0 + +- type: entity + parent: BaseTesticles + id: Testicles + components: + - type: Hole + prefixes: + - layer: "enum.GenitalVisualLayers.TesticlesFront" + prefix: "_FRONT" + layers: + - state: testicles_sheath_5_s_0