scale reagent damage when under metabolism rate (#11578)
This commit is contained in:
@@ -172,7 +172,7 @@ namespace Content.Server.Body.Systems
|
|||||||
|
|
||||||
var actualEntity = bodyEntityUid != null ? bodyEntityUid.Value : solutionEntityUid.Value;
|
var actualEntity = bodyEntityUid != null ? bodyEntityUid.Value : solutionEntityUid.Value;
|
||||||
var args = new ReagentEffectArgs(actualEntity, (meta).Owner, solution, proto, mostToRemove,
|
var args = new ReagentEffectArgs(actualEntity, (meta).Owner, solution, proto, mostToRemove,
|
||||||
EntityManager, null);
|
EntityManager, null, entry);
|
||||||
|
|
||||||
// do all effects, if conditions apply
|
// do all effects, if conditions apply
|
||||||
foreach (var effect in entry.Effects)
|
foreach (var effect in entry.Effects)
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ namespace Content.Server.Chemistry.ReagentEffects
|
|||||||
public override void Effect(ReagentEffectArgs args)
|
public override void Effect(ReagentEffectArgs args)
|
||||||
{
|
{
|
||||||
var scale = ScaleByQuantity ? args.Quantity : FixedPoint2.New(1);
|
var scale = ScaleByQuantity ? args.Quantity : FixedPoint2.New(1);
|
||||||
|
if (args.MetabolismEffects != null)
|
||||||
|
scale *= (args.Quantity / args.MetabolismEffects.MetabolismRate);
|
||||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(args.SolutionEntity, Damage * scale, IgnoreResistances);
|
EntitySystem.Get<DamageableSystem>().TryChangeDamage(args.SolutionEntity, Damage * scale, IgnoreResistances);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ namespace Content.Shared.Chemistry.Reaction
|
|||||||
{
|
{
|
||||||
var args = new ReagentEffectArgs(owner, null, solution,
|
var args = new ReagentEffectArgs(owner, null, solution,
|
||||||
randomReagent,
|
randomReagent,
|
||||||
unitReactions, EntityManager, null);
|
unitReactions, EntityManager, null, null);
|
||||||
|
|
||||||
foreach (var effect in reaction.Effects)
|
foreach (var effect in reaction.Effects)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Content.Shared.Chemistry
|
|||||||
|
|
||||||
// If we have a source solution, use the reagent quantity we have left. Otherwise, use the reaction volume specified.
|
// If we have a source solution, use the reagent quantity we have left. Otherwise, use the reaction volume specified.
|
||||||
var args = new ReagentEffectArgs(uid, null, source, reagent,
|
var args = new ReagentEffectArgs(uid, null, source, reagent,
|
||||||
source?.GetReagentQuantity(reagent.ID) ?? reactVolume, EntityManager, method);
|
source?.GetReagentQuantity(reagent.ID) ?? reactVolume, EntityManager, method, null);
|
||||||
|
|
||||||
// First, check if the reagent wants to apply any effects.
|
// First, check if the reagent wants to apply any effects.
|
||||||
if (reagent.ReactiveEffects != null && reactive.ReactiveGroups != null)
|
if (reagent.ReactiveEffects != null && reactive.ReactiveGroups != null)
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ namespace Content.Shared.Chemistry.Reagent
|
|||||||
ReagentPrototype Reagent,
|
ReagentPrototype Reagent,
|
||||||
FixedPoint2 Quantity,
|
FixedPoint2 Quantity,
|
||||||
IEntityManager EntityManager,
|
IEntityManager EntityManager,
|
||||||
ReactionMethod? Method
|
ReactionMethod? Method,
|
||||||
|
ReagentEffectsEntry? MetabolismEffects
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ namespace Content.Shared.Chemistry.Reagent
|
|||||||
|
|
||||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||||
var random = IoCManager.Resolve<IRobustRandom>();
|
var random = IoCManager.Resolve<IRobustRandom>();
|
||||||
var args = new ReagentEffectArgs(plantHolder.Value, null, solution, this, amount.Quantity, entMan, null);
|
var args = new ReagentEffectArgs(plantHolder.Value, null, solution, this, amount.Quantity, entMan, null, null);
|
||||||
foreach (var plantMetabolizable in PlantMetabolisms)
|
foreach (var plantMetabolizable in PlantMetabolisms)
|
||||||
{
|
{
|
||||||
if (!plantMetabolizable.ShouldApply(args, random))
|
if (!plantMetabolizable.ShouldApply(args, random))
|
||||||
|
|||||||
Reference in New Issue
Block a user