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>
|
/// <returns>If the solution could be added.</returns>
|
||||||
public bool TryAddSolution(Solution solution)
|
public bool TryAddSolution(Solution solution)
|
||||||
{
|
{
|
||||||
if (!CanAddSolution(solution))
|
if (!CanAddSolution(solution) || solution.TotalVolume == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Solution.AddSolution(solution);
|
Solution.AddSolution(solution);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -257,18 +257,25 @@ namespace Content.Shared.GameObjects.Components.Damage
|
|||||||
finalDamage = Resistances.CalculateDamage(type, amount);
|
finalDamage = Resistances.CalculateDamage(type, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (finalDamage == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!_damageList.TryGetValue(type, out var current))
|
if (!_damageList.TryGetValue(type, out var current))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_damageList[type] = current + finalDamage;
|
if (current + finalDamage < 0)
|
||||||
|
|
||||||
if (_damageList[type] < 0)
|
|
||||||
{
|
{
|
||||||
|
if (current == 0)
|
||||||
|
return false;
|
||||||
_damageList[type] = 0;
|
_damageList[type] = 0;
|
||||||
finalDamage = -current;
|
finalDamage = -current;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_damageList[type] = current + finalDamage;
|
||||||
|
}
|
||||||
|
|
||||||
current = _damageList[type];
|
current = _damageList[type];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user