Skip to content

Commit

Permalink
Update LewdTraitSystem.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Memeji authored Aug 16, 2024
1 parent 913eaf2 commit 1e6a1a9
Showing 1 changed file with 41 additions and 53 deletions.
94 changes: 41 additions & 53 deletions Content.Server/FloofStation/Traits/LewdTraitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,73 +268,61 @@ private void AttemptMilk(Entity<MilkProducerComponent> lewd, EntityUid userUid,
public override void Update(float frameTime)
{
base.Update(frameTime);
var queryCum = EntityQueryEnumerator<CumProducerComponent>(); //SquirtProducerComponent -unused ,
var queryMilk = EntityQueryEnumerator<MilkProducerComponent>();

var now = _timing.CurTime;
var query = AllEntityQuery<CumProducerComponent, MilkProducerComponent>(); //SquirtProducerComponent -unused

while (queryCum.MoveNext(out var uid, out var containerCum))
while (query.MoveNext(out var uid, out var containerCum, out var containerMilk)) // out var containerSquirt -unused
{
if (now < containerCum.NextGrowth)
continue;

containerCum.NextGrowth = now + containerCum.GrowthDelay;

if (_mobState.IsDead(uid))
continue;

if (EntityManager.TryGetComponent(uid, out HungerComponent? hunger))
if (!(now < containerCum.NextGrowth))
{
if (_hunger.GetHungerThreshold(hunger) < HungerThreshold.Okay)
continue;

_hunger.ModifyHunger(uid, -containerCum.HungerUsage, 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 (!_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 (!(now < containerMilk.NextGrowth))
{
if (_hunger.GetHungerThreshold(hunger) < HungerThreshold.Okay)
continue;
containerMilk.NextGrowth = now + containerMilk.GrowthDelay;

_hunger.ModifyHunger(uid, -containerMilk.HungerUsage, hunger);
}
if (EntityManager.TryGetComponent(uid, out HungerComponent? hunger))
{
if (!(_hunger.GetHungerThreshold(hunger) < HungerThreshold.Okay))
_hunger.ModifyHunger(uid, -containerMilk.HungerUsage, hunger);
}

if (!_solutionContainer.ResolveSolution(uid, containerMilk.SolutionName, ref containerMilk.Solution))
continue;
if (_solutionContainer.ResolveSolution(uid, containerMilk.SolutionName, ref containerMilk.Solution))
_solutionContainer.TryAddReagent(containerMilk.Solution.Value, containerMilk.ReagentId, containerMilk.QuantityPerUpdate, out _);
}

_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 _);
//}
}

//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
}

0 comments on commit 1e6a1a9

Please sign in to comment.