From 60907482389c3c259ab94cc3aebe0d7b54392cb9 Mon Sep 17 00:00:00 2001 From: Pierson Arnold Date: Tue, 13 Aug 2024 22:58:04 -0500 Subject: [PATCH 1/2] Fixed cum/milk generation --- .../Traits/Components/CumProducerComponent.cs | 14 +-- .../Components/MilkProducerComponent.cs | 16 ++-- .../FloofStation/Traits/LewdTraitSystem.cs | 94 +++++++++++-------- .../{FloofStation => Floof}/Traits/lewd.yml | 8 +- 4 files changed, 72 insertions(+), 60 deletions(-) rename Resources/Prototypes/{FloofStation => Floof}/Traits/lewd.yml (92%) diff --git a/Content.Server/FloofStation/Traits/Components/CumProducerComponent.cs b/Content.Server/FloofStation/Traits/Components/CumProducerComponent.cs index aa7ed3fc009..c9400ea1384 100644 --- a/Content.Server/FloofStation/Traits/Components/CumProducerComponent.cs +++ b/Content.Server/FloofStation/Traits/Components/CumProducerComponent.cs @@ -13,7 +13,7 @@ namespace Content.Server.FloofStation.Traits; public sealed partial class CumProducerComponent : Component { [DataField("solutionname"), ViewVariables(VVAccess.ReadWrite)] - public string SolutionName; + public string SolutionName = "penis"; [DataField, ViewVariables(VVAccess.ReadWrite)] public ProtoId ReagentId = "Cum"; @@ -24,15 +24,15 @@ public sealed partial class CumProducerComponent : Component [DataField] public Entity? Solution = null; - [DataField, ViewVariables(VVAccess.ReadOnly)] - public FixedPoint2 QuantityPerUpdate = 25; + [DataField, ViewVariables(VVAccess.ReadWrite)] + public FixedPoint2 QuantityPerUpdate = 5; - [DataField] + [DataField, ViewVariables(VVAccess.ReadWrite)] public float HungerUsage = 10f; - [DataField] - public TimeSpan GrowthDelay = TimeSpan.FromMinutes(1); + [DataField, ViewVariables(VVAccess.ReadWrite)] + public TimeSpan GrowthDelay = TimeSpan.FromSeconds(10); - [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] public TimeSpan NextGrowth = TimeSpan.FromSeconds(0); } diff --git a/Content.Server/FloofStation/Traits/Components/MilkProducerComponent.cs b/Content.Server/FloofStation/Traits/Components/MilkProducerComponent.cs index f557394c94c..a964211b96b 100644 --- a/Content.Server/FloofStation/Traits/Components/MilkProducerComponent.cs +++ b/Content.Server/FloofStation/Traits/Components/MilkProducerComponent.cs @@ -13,26 +13,26 @@ namespace Content.Server.FloofStation.Traits; public sealed partial class MilkProducerComponent : Component { [DataField("solutionname"), ViewVariables(VVAccess.ReadWrite)] - public string SolutionName; + public string SolutionName = "breasts"; [DataField, ViewVariables(VVAccess.ReadWrite)] public ProtoId ReagentId = "Milk"; [DataField] - public FixedPoint2 MaxVolume = FixedPoint2.New(25); + public FixedPoint2 MaxVolume = FixedPoint2.New(50); [DataField] public Entity? Solution = null; - [DataField, ViewVariables(VVAccess.ReadOnly)] - public FixedPoint2 QuantityPerUpdate = 25; + [DataField, ViewVariables(VVAccess.ReadWrite)] + public FixedPoint2 QuantityPerUpdate = 5; - [DataField] + [DataField, ViewVariables(VVAccess.ReadWrite)] public float HungerUsage = 10f; - [DataField] - public TimeSpan GrowthDelay = TimeSpan.FromMinutes(1); + [DataField, ViewVariables(VVAccess.ReadWrite)] + public TimeSpan GrowthDelay = TimeSpan.FromSeconds(10); - [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] public TimeSpan NextGrowth = TimeSpan.FromSeconds(0); } diff --git a/Content.Server/FloofStation/Traits/LewdTraitSystem.cs b/Content.Server/FloofStation/Traits/LewdTraitSystem.cs index 1429488a47a..5c5f084ce08 100644 --- a/Content.Server/FloofStation/Traits/LewdTraitSystem.cs +++ b/Content.Server/FloofStation/Traits/LewdTraitSystem.cs @@ -268,61 +268,73 @@ private void AttemptMilk(Entity lewd, EntityUid userUid, public override void Update(float frameTime) { base.Update(frameTime); - + var queryCum = EntityQueryEnumerator(); //SquirtProducerComponent -unused , + var queryMilk = EntityQueryEnumerator(); var now = _timing.CurTime; - var query = AllEntityQuery(); //SquirtProducerComponent -unused - while (query.MoveNext(out var uid, out var containerCum, out var containerMilk)) // out var containerSquirt -unused + while (queryCum.MoveNext(out var uid, out var containerCum)) { + if (now < containerCum.NextGrowth) + continue; + + containerCum.NextGrowth = now + containerCum.GrowthDelay; + if (_mobState.IsDead(uid)) continue; - if (!(now < containerCum.NextGrowth)) + if (EntityManager.TryGetComponent(uid, out HungerComponent? hunger)) { - containerCum.NextGrowth = now + containerCum.GrowthDelay; - - // Actually there is food digestion so no problem with instant reagent generation "OnFeed" - if (EntityManager.TryGetComponent(uid, out HungerComponent? hunger)) - { - // Is there enough nutrition to produce reagent? - if (!(_hunger.GetHungerThreshold(hunger) < HungerThreshold.Okay)) - _hunger.ModifyHunger(uid, -containerCum.HungerUsage, hunger); - } - - if (_solutionContainer.ResolveSolution(uid, containerCum.SolutionName, ref containerCum.Solution)) - _solutionContainer.TryAddReagent(containerCum.Solution.Value, containerCum.ReagentId, containerCum.QuantityPerUpdate, out _); + if (_hunger.GetHungerThreshold(hunger) < HungerThreshold.Okay) + continue; + + _hunger.ModifyHunger(uid, -containerCum.HungerUsage, hunger); } - if (!(now < containerMilk.NextGrowth)) - { - containerMilk.NextGrowth = now + containerMilk.GrowthDelay; + if (!_solutionContainer.ResolveSolution(uid, containerCum.SolutionName, ref containerCum.Solution)) + continue; + + _solutionContainer.TryAddReagent(containerCum.Solution.Value, containerCum.ReagentId, containerCum.QuantityPerUpdate, out _); + } + + while (queryMilk.MoveNext(out var uid, out var containerMilk)) + { + if (now < containerMilk.NextGrowth) + continue; + + containerMilk.NextGrowth = now + containerMilk.GrowthDelay; + + if (_mobState.IsDead(uid)) + continue; - if (EntityManager.TryGetComponent(uid, out HungerComponent? hunger)) - { - if (!(_hunger.GetHungerThreshold(hunger) < HungerThreshold.Okay)) - _hunger.ModifyHunger(uid, -containerMilk.HungerUsage, hunger); - } + if (EntityManager.TryGetComponent(uid, out HungerComponent? hunger)) + { + if (_hunger.GetHungerThreshold(hunger) < HungerThreshold.Okay) + continue; - if (_solutionContainer.ResolveSolution(uid, containerMilk.SolutionName, ref containerMilk.Solution)) - _solutionContainer.TryAddReagent(containerMilk.Solution.Value, containerMilk.ReagentId, containerMilk.QuantityPerUpdate, out _); + _hunger.ModifyHunger(uid, -containerMilk.HungerUsage, hunger); } - //if (!(now < containerSquirt.NextGrowth)) //Unused-Trait is WIP - //{ - // containerSquirt.NextGrowth = now + containerSquirt.GrowthDelay; - - // - // if (EntityManager.TryGetComponent(uid, out HungerComponent? hunger)) - // { - // - // if (!(_hunger.GetHungerThreshold(hunger) < HungerThreshold.Okay)) - // _hunger.ModifyHunger(uid, -containerSquirt.HungerUsage, hunger); - // } - - // if (_solutionContainer.ResolveSolution(uid, containerSquirt.SolutionName, ref containerSquirt.Solution)) - // _solutionContainer.TryAddReagent(containerSquirt.Solution.Value, containerSquirt.ReagentId, containerSquirt.QuantityPerUpdate, out _); - //} + if (!_solutionContainer.ResolveSolution(uid, containerMilk.SolutionName, ref containerMilk.Solution)) + continue; + + _solutionContainer.TryAddReagent(containerMilk.Solution.Value, containerMilk.ReagentId, containerMilk.QuantityPerUpdate, out _); } + + //if (!(now < containerSquirt.NextGrowth)) //Unused-Trait is WIP + //{ + // containerSquirt.NextGrowth = now + containerSquirt.GrowthDelay; + + // + // if (EntityManager.TryGetComponent(uid, out HungerComponent? hunger)) + // { + // + // if (!(_hunger.GetHungerThreshold(hunger) < HungerThreshold.Okay)) + // _hunger.ModifyHunger(uid, -containerSquirt.HungerUsage, hunger); + // } + + // if (_solutionContainer.ResolveSolution(uid, containerSquirt.SolutionName, ref containerSquirt.Solution)) + // _solutionContainer.TryAddReagent(containerSquirt.Solution.Value, containerSquirt.ReagentId, containerSquirt.QuantityPerUpdate, out _); + //} } #endregion } diff --git a/Resources/Prototypes/FloofStation/Traits/lewd.yml b/Resources/Prototypes/Floof/Traits/lewd.yml similarity index 92% rename from Resources/Prototypes/FloofStation/Traits/lewd.yml rename to Resources/Prototypes/Floof/Traits/lewd.yml index d3cd1304479..fb05c082657 100644 --- a/Resources/Prototypes/FloofStation/Traits/lewd.yml +++ b/Resources/Prototypes/Floof/Traits/lewd.yml @@ -13,10 +13,10 @@ - type: SolutionContainerManager solutions: penis: - maxVol: 250 + maxVol: 25 reagents: - ReagentId: Cum - Quantity: 30 + Quantity: 25 - type: trait id: MilkProducer @@ -33,10 +33,10 @@ - type: SolutionContainerManager solutions: breasts: - maxVol: 250 + maxVol: 50 reagents: - ReagentId: Milk - Quantity: 30 + Quantity: 50 # WIP - Needs a Reagent # - type: trait From 5b40e9994609edfd234e1cccf05ffd7ed54611b9 Mon Sep 17 00:00:00 2001 From: Pierson Arnold Date: Thu, 15 Aug 2024 08:00:38 -0500 Subject: [PATCH 2/2] DataField usage for components --- .../Traits/Components/CumProducerComponent.cs | 12 ++++++------ .../Traits/Components/MilkProducerComponent.cs | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Content.Server/FloofStation/Traits/Components/CumProducerComponent.cs b/Content.Server/FloofStation/Traits/Components/CumProducerComponent.cs index c9400ea1384..0eb0d8a0e1c 100644 --- a/Content.Server/FloofStation/Traits/Components/CumProducerComponent.cs +++ b/Content.Server/FloofStation/Traits/Components/CumProducerComponent.cs @@ -12,10 +12,10 @@ namespace Content.Server.FloofStation.Traits; [RegisterComponent, Access(typeof(LewdTraitSystem))] public sealed partial class CumProducerComponent : Component { - [DataField("solutionname"), ViewVariables(VVAccess.ReadWrite)] + [DataField("solutionname")] public string SolutionName = "penis"; - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField] public ProtoId ReagentId = "Cum"; [DataField] @@ -24,15 +24,15 @@ public sealed partial class CumProducerComponent : Component [DataField] public Entity? Solution = null; - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField] public FixedPoint2 QuantityPerUpdate = 5; - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField] public float HungerUsage = 10f; - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField] public TimeSpan GrowthDelay = TimeSpan.FromSeconds(10); - [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] + [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] public TimeSpan NextGrowth = TimeSpan.FromSeconds(0); } diff --git a/Content.Server/FloofStation/Traits/Components/MilkProducerComponent.cs b/Content.Server/FloofStation/Traits/Components/MilkProducerComponent.cs index a964211b96b..8b159e3921b 100644 --- a/Content.Server/FloofStation/Traits/Components/MilkProducerComponent.cs +++ b/Content.Server/FloofStation/Traits/Components/MilkProducerComponent.cs @@ -12,10 +12,10 @@ namespace Content.Server.FloofStation.Traits; [RegisterComponent, Access(typeof(LewdTraitSystem))] public sealed partial class MilkProducerComponent : Component { - [DataField("solutionname"), ViewVariables(VVAccess.ReadWrite)] + [DataField("solutionname")] public string SolutionName = "breasts"; - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField] public ProtoId ReagentId = "Milk"; [DataField] @@ -24,15 +24,15 @@ public sealed partial class MilkProducerComponent : Component [DataField] public Entity? Solution = null; - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField] public FixedPoint2 QuantityPerUpdate = 5; - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField] public float HungerUsage = 10f; - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField] public TimeSpan GrowthDelay = TimeSpan.FromSeconds(10); - [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] + [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] public TimeSpan NextGrowth = TimeSpan.FromSeconds(0); }