From 5b33d1cd511a1a1df30833b98e73603ee4288343 Mon Sep 17 00:00:00 2001 From: Lye Date: Wed, 27 Nov 2024 22:06:38 +0000 Subject: [PATCH 1/6] time to use git --- .../SolutionRegenerationComponent.cs | 6 ++++ .../SolutionRegenerationSystem.cs | 14 ++++++++ .../Clothing/Components/ClothingComponent.cs | 3 ++ .../Clothing/EntitySystems/ClothingSystem.cs | 6 +++- .../Floof/Entities/Clothing/Uniforms/misc.yml | 32 +++++++++++++++++++ 5 files changed, 60 insertions(+), 1 deletion(-) diff --git a/Content.Server/Chemistry/Components/SolutionRegenerationComponent.cs b/Content.Server/Chemistry/Components/SolutionRegenerationComponent.cs index 23bf6b21573..ba618dbda37 100644 --- a/Content.Server/Chemistry/Components/SolutionRegenerationComponent.cs +++ b/Content.Server/Chemistry/Components/SolutionRegenerationComponent.cs @@ -41,4 +41,10 @@ public sealed partial class SolutionRegenerationComponent : Component [DataField("nextChargeTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] [AutoPausedField] public TimeSpan NextRegenTime = TimeSpan.FromSeconds(0); + + /// + /// Whether the entity with the solution needs to be equipped + /// + [DataField("needsEquipped"), ViewVariables(VVAccess.ReadWrite)] + public bool NeedsEquipped = false; } diff --git a/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs index 5af181e4af5..60c943eb538 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs @@ -2,6 +2,7 @@ using Content.Server.Chemistry.Containers.EntitySystems; using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Components.SolutionManager; +using Content.Shared.Clothing.Components; using Content.Shared.FixedPoint; using Robust.Shared.Timing; @@ -20,7 +21,20 @@ public override void Update(float frameTime) while (query.MoveNext(out var uid, out var regen, out var manager)) { if (_timing.CurTime < regen.NextRegenTime) + { continue; + } + + if (regen.NeedsEquipped) + { + if(EntityManager.TryGetComponent(uid, out ClothingComponent? clothing)) + { + if (!clothing.IsEquipped) + { + continue; + } + } + } // timer ignores if its full, it's just a fixed cycle regen.NextRegenTime = _timing.CurTime + regen.Duration; diff --git a/Content.Shared/Clothing/Components/ClothingComponent.cs b/Content.Shared/Clothing/Components/ClothingComponent.cs index 6d7226e767d..325d046f416 100644 --- a/Content.Shared/Clothing/Components/ClothingComponent.cs +++ b/Content.Shared/Clothing/Components/ClothingComponent.cs @@ -66,6 +66,9 @@ public sealed partial class ClothingComponent : Component [DataField("unisexMask")] public ClothingMask UnisexMask = ClothingMask.UniformFull; + [DataField("isEquipped")] + public bool IsEquipped; + /// /// Name of the inventory slot the clothing is in. /// diff --git a/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs b/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs index 2f650a19066..829fcc9570c 100644 --- a/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs +++ b/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs @@ -137,7 +137,10 @@ protected virtual void OnGotEquipped(EntityUid uid, ClothingComponent component, var didEquippedEvent = new ClothingDidEquippedEvent((uid, component)); RaiseLocalEvent(args.Equipee, ref didEquippedEvent); + + } + component.IsEquipped = true; } protected virtual void OnGotUnequipped(EntityUid uid, ClothingComponent component, GotUnequippedEvent args) @@ -151,6 +154,7 @@ protected virtual void OnGotUnequipped(EntityUid uid, ClothingComponent componen RaiseLocalEvent(args.Equipee, ref didUnequippedEvent); } + component.IsEquipped = false; component.InSlot = null; CheckEquipmentForLayerHide(args.Equipment, args.Equipee); } @@ -288,4 +292,4 @@ public void SetLayerState(ClothingComponent clothing, string slot, string mapKey } #endregion -} \ No newline at end of file +} diff --git a/Resources/Prototypes/Floof/Entities/Clothing/Uniforms/misc.yml b/Resources/Prototypes/Floof/Entities/Clothing/Uniforms/misc.yml index d2f71ff596f..5cafe8b20c9 100644 --- a/Resources/Prototypes/Floof/Entities/Clothing/Uniforms/misc.yml +++ b/Resources/Prototypes/Floof/Entities/Clothing/Uniforms/misc.yml @@ -206,3 +206,35 @@ sprite: Floof/Clothing/Uniforms/musiciankingblack.rsi - type: Clothing sprite: Floof/Clothing/Uniforms/musiciankingblack.rsi + +- type: entity + parent: ClothingUniformBase + id: ClothingUniformMilkingMachine + name: milking machine + components: + - type: Sprite + sprite: Floof/Clothing/Uniforms/codervalidthong.rsi + - type: Clothing + sprite: Floof/Clothing/Uniforms/codervalidthong.rsi + - type: Tag #DeltaV, needed for species with nonhuman legs/can only wear skirts + tags: + - Skirt + - type: SolutionContainerManager + solutions: + tank: + maxVol: 100 + - type: DrawableSolution + solution: tank + - type: DrainableSolution + solution: tank + - type: ExaminableSolution + solution: tank + - type: SolutionItemStatus + solution: tank + - type: SolutionRegeneration + solution: tank + generated: + reagents: + - ReagentId: Cum + Quantity: 0.01 + needsEquipped: true From 4c8ce65a7bb9b68b2d9d46b59facfe981084c267 Mon Sep 17 00:00:00 2001 From: Lye <128915833+Lyroth001@users.noreply.github.com> Date: Thu, 28 Nov 2024 02:04:47 +0000 Subject: [PATCH 2/6] Update Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs Co-authored-by: Mnemotechnican <69920617+Mnemotechnician@users.noreply.github.com> --- .../EntitySystems/SolutionRegenerationSystem.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs index 60c943eb538..a423345783f 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs @@ -21,20 +21,10 @@ public override void Update(float frameTime) while (query.MoveNext(out var uid, out var regen, out var manager)) { if (_timing.CurTime < regen.NextRegenTime) - { continue; - } - if (regen.NeedsEquipped) - { - if(EntityManager.TryGetComponent(uid, out ClothingComponent? clothing)) - { - if (!clothing.IsEquipped) - { - continue; - } - } - } + if (regen.NeedsEquipped && TryComp(uid, out ClothingComponent? clothing) && !clothing.IsEquipped) + continue; // timer ignores if its full, it's just a fixed cycle regen.NextRegenTime = _timing.CurTime + regen.Duration; From c5472838faf39c9d9db79baaf3fdd4dd05d562e1 Mon Sep 17 00:00:00 2001 From: Lye Date: Thu, 28 Nov 2024 15:55:16 +0000 Subject: [PATCH 3/6] Doing it properly --- .../Chemistry/EntitySystems/SolutionRegenerationSystem.cs | 2 +- Content.Shared/Clothing/Components/ClothingComponent.cs | 3 --- Content.Shared/Clothing/EntitySystems/ClothingSystem.cs | 2 -- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs index a423345783f..22c6ca5995e 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs @@ -23,7 +23,7 @@ public override void Update(float frameTime) if (_timing.CurTime < regen.NextRegenTime) continue; - if (regen.NeedsEquipped && TryComp(uid, out ClothingComponent? clothing) && !clothing.IsEquipped) + if (regen.NeedsEquipped && TryComp(uid, out ClothingComponent? clothing) && clothing.InSlot != null) continue; // timer ignores if its full, it's just a fixed cycle diff --git a/Content.Shared/Clothing/Components/ClothingComponent.cs b/Content.Shared/Clothing/Components/ClothingComponent.cs index 325d046f416..6d7226e767d 100644 --- a/Content.Shared/Clothing/Components/ClothingComponent.cs +++ b/Content.Shared/Clothing/Components/ClothingComponent.cs @@ -66,9 +66,6 @@ public sealed partial class ClothingComponent : Component [DataField("unisexMask")] public ClothingMask UnisexMask = ClothingMask.UniformFull; - [DataField("isEquipped")] - public bool IsEquipped; - /// /// Name of the inventory slot the clothing is in. /// diff --git a/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs b/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs index 829fcc9570c..088d0d95f1d 100644 --- a/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs +++ b/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs @@ -140,7 +140,6 @@ protected virtual void OnGotEquipped(EntityUid uid, ClothingComponent component, } - component.IsEquipped = true; } protected virtual void OnGotUnequipped(EntityUid uid, ClothingComponent component, GotUnequippedEvent args) @@ -154,7 +153,6 @@ protected virtual void OnGotUnequipped(EntityUid uid, ClothingComponent componen RaiseLocalEvent(args.Equipee, ref didUnequippedEvent); } - component.IsEquipped = false; component.InSlot = null; CheckEquipmentForLayerHide(args.Equipment, args.Equipee); } From 10b051ff42ba441401fbffbbbf7c6f3d9c4fcfc0 Mon Sep 17 00:00:00 2001 From: Lye Date: Thu, 28 Nov 2024 16:01:36 +0000 Subject: [PATCH 4/6] Fixed logic skill issue --- .../Chemistry/EntitySystems/SolutionRegenerationSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs index 22c6ca5995e..317c8bb57d0 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs @@ -23,7 +23,7 @@ public override void Update(float frameTime) if (_timing.CurTime < regen.NextRegenTime) continue; - if (regen.NeedsEquipped && TryComp(uid, out ClothingComponent? clothing) && clothing.InSlot != null) + if (regen.NeedsEquipped && TryComp(uid, out ClothingComponent? clothing) && clothing.InSlot == null) continue; // timer ignores if its full, it's just a fixed cycle From 3f26f32f191295260b98a1b514acc3372aa6237d Mon Sep 17 00:00:00 2001 From: Lye Date: Thu, 28 Nov 2024 16:03:10 +0000 Subject: [PATCH 5/6] remove extra whitespace --- Content.Shared/Clothing/EntitySystems/ClothingSystem.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs b/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs index 088d0d95f1d..9e3f917e96f 100644 --- a/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs +++ b/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs @@ -137,8 +137,6 @@ protected virtual void OnGotEquipped(EntityUid uid, ClothingComponent component, var didEquippedEvent = new ClothingDidEquippedEvent((uid, component)); RaiseLocalEvent(args.Equipee, ref didEquippedEvent); - - } } From 77fe073bc1b35541f6e07bd9927c19a3571a85bc Mon Sep 17 00:00:00 2001 From: Lye Date: Thu, 28 Nov 2024 16:08:00 +0000 Subject: [PATCH 6/6] marked placeholder sprite in yaml --- Resources/Prototypes/Floof/Entities/Clothing/Uniforms/misc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Prototypes/Floof/Entities/Clothing/Uniforms/misc.yml b/Resources/Prototypes/Floof/Entities/Clothing/Uniforms/misc.yml index 5cafe8b20c9..e4d0182d6e0 100644 --- a/Resources/Prototypes/Floof/Entities/Clothing/Uniforms/misc.yml +++ b/Resources/Prototypes/Floof/Entities/Clothing/Uniforms/misc.yml @@ -212,7 +212,7 @@ id: ClothingUniformMilkingMachine name: milking machine components: - - type: Sprite + - type: Sprite #sprite is placeholder as I cannot sprite :(( sprite: Floof/Clothing/Uniforms/codervalidthong.rsi - type: Clothing sprite: Floof/Clothing/Uniforms/codervalidthong.rsi