epic Respiration Rework (#6022)

This commit is contained in:
mirrorcult
2022-02-06 21:48:15 -07:00
committed by GitHub
parent ee4c5559a3
commit 4ae1c4e332
32 changed files with 596 additions and 586 deletions

View File

@@ -77,6 +77,8 @@ namespace Content.Server.Body.Systems
// First step is get the solution we actually care about
Solution? solution = null;
EntityUid? solutionEntityUid = null;
EntityUid? bodyEntityUid = mech?.Body?.Owner;
SolutionContainerManagerComponent? manager = null;
if (meta.SolutionOnBody)
@@ -144,6 +146,10 @@ namespace Content.Server.Body.Systems
if (entry.MetabolismRate > mostToRemove)
mostToRemove = entry.MetabolismRate;
mostToRemove *= group.MetabolismRateModifier;
mostToRemove = FixedPoint2.Clamp(mostToRemove, 0, reagent.Quantity);
// if it's possible for them to be dead, and they are,
// then we shouldn't process any effects, but should probably
// still remove reagents
@@ -153,7 +159,8 @@ namespace Content.Server.Body.Systems
continue;
}
var args = new ReagentEffectArgs(solutionEntityUid.Value, (meta).Owner, solution, proto, entry.MetabolismRate,
var actualEntity = bodyEntityUid != null ? bodyEntityUid.Value : solutionEntityUid.Value;
var args = new ReagentEffectArgs(actualEntity, (meta).Owner, solution, proto, mostToRemove,
EntityManager, null);
// do all effects, if conditions apply
@@ -164,9 +171,8 @@ namespace Content.Server.Body.Systems
if (effect.ShouldLog)
{
var entity = args.SolutionEntity;
_logSystem.Add(LogType.ReagentEffect, effect.LogImpact,
$"Metabolism effect {effect.GetType().Name:effect} of reagent {args.Reagent.Name:reagent} applied on entity {entity} at {Transform(entity).Coordinates:coordinates}");
$"Metabolism effect {effect.GetType().Name:effect} of reagent {args.Reagent.Name:reagent} applied on entity {actualEntity:entity} at {Transform(actualEntity).Coordinates:coordinates}");
}
effect.Effect(args);