Lower data usage (#4005)
* Lower data usage * Fix the problems at the root
This commit is contained in:
@@ -148,7 +148,7 @@ namespace Content.Shared.GameObjects.Components.Chemistry
|
||||
/// <returns>If the solution could be added.</returns>
|
||||
public bool TryAddSolution(Solution solution)
|
||||
{
|
||||
if (!CanAddSolution(solution))
|
||||
if (!CanAddSolution(solution) || solution.TotalVolume == 0)
|
||||
return false;
|
||||
|
||||
Solution.AddSolution(solution);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -257,18 +257,25 @@ namespace Content.Shared.GameObjects.Components.Damage
|
||||
finalDamage = Resistances.CalculateDamage(type, amount);
|
||||
}
|
||||
|
||||
if (finalDamage == 0)
|
||||
return false;
|
||||
|
||||
if (!_damageList.TryGetValue(type, out var current))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_damageList[type] = current + finalDamage;
|
||||
|
||||
if (_damageList[type] < 0)
|
||||
if (current + finalDamage < 0)
|
||||
{
|
||||
if (current == 0)
|
||||
return false;
|
||||
_damageList[type] = 0;
|
||||
finalDamage = -current;
|
||||
}
|
||||
else
|
||||
{
|
||||
_damageList[type] = current + finalDamage;
|
||||
}
|
||||
|
||||
current = _damageList[type];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user