Adds missing reactions to chemical stuff.

- Adds ingestion reaction for food, drinks, and pills.
- Adds injection reaction for syringes.
This commit is contained in:
Víctor Aguilera Puerto
2020-09-26 14:48:24 +02:00
parent 62288dd7ec
commit 4eb5891c4a
7 changed files with 107 additions and 19 deletions

View File

@@ -72,7 +72,7 @@ namespace Content.Server.GameObjects.Components.Body.Digestive
solution.MaxVolume = _initialMaxVolume;
}
public bool TryTransferSolution(Solution solution)
public bool CanTransferSolution(Solution solution)
{
if (!Owner.TryGetComponent(out SolutionContainerComponent? solutionComponent))
{
@@ -80,11 +80,21 @@ namespace Content.Server.GameObjects.Components.Body.Digestive
}
// TODO: For now no partial transfers. Potentially change by design
if (solution.TotalVolume + solutionComponent.CurrentVolume > solutionComponent.MaxVolume)
if (!solutionComponent.CanAddSolution(solution))
{
return false;
}
return true;
}
public bool TryTransferSolution(Solution solution)
{
if (!CanTransferSolution(solution))
return false;
var solutionComponent = Owner.GetComponent<SolutionContainerComponent>();
// Add solution to _stomachContents
solutionComponent.TryAddSolution(solution, false, true);
// Add each reagent to _reagentDeltas. Used to track how long each reagent has been in the stomach