Generalize ReagentUnit into FixedPoint2 and use it for damage calculations (#5151)

* Damage units

* sum ext method
This commit is contained in:
mirrorcult
2021-11-03 16:48:03 -07:00
committed by GitHub
parent 8165d8f38c
commit 3ab4a30a0f
100 changed files with 730 additions and 601 deletions

View File

@@ -12,6 +12,7 @@ using Content.Shared.Audio;
using Content.Shared.Botany;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Examine;
using Content.Shared.FixedPoint;
using Content.Shared.Interaction;
using Content.Shared.Popups;
using Content.Shared.Random.Helpers;
@@ -560,7 +561,7 @@ namespace Content.Server.Botany.Components
}
else
{
var one = ReagentUnit.New(1);
var one = FixedPoint2.New(1);
foreach (var reagent in solutionSystem.RemoveEachReagent(solution, one))
{
var reagentProto = _prototypeManager.Index<ReagentPrototype>(reagent);
@@ -727,7 +728,7 @@ namespace Content.Server.Botany.Components
if (solutionSystem.TryGetDrainableSolution(usingItem.Uid, out var solution)
&& solutionSystem.TryGetSolution(Owner.Uid, SoilSolutionName, out var targetSolution))
{
var amount = ReagentUnit.New(5);
var amount = FixedPoint2.New(5);
var sprayed = false;
var targetEntity = Owner.Uid;
var solutionEntity = usingItem.Uid;
@@ -735,7 +736,7 @@ namespace Content.Server.Botany.Components
if (usingItem.TryGetComponent(out SprayComponent? spray))
{
sprayed = true;
amount = ReagentUnit.New(1);
amount = FixedPoint2.New(1);
SoundSystem.Play(Filter.Pvs(usingItem), spray.SpraySound.GetSound(), usingItem,
AudioHelpers.WithVariation(0.125f));