Fix crash related to reagent reactions
This commit is contained in:
@@ -188,7 +188,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
foreach (var (reagentId, quantity) in split.Contents)
|
foreach (var (reagentId, quantity) in split.Contents)
|
||||||
{
|
{
|
||||||
if (!_prototypeManager.TryIndex(reagentId, out ReagentPrototype reagent)) continue;
|
if (!_prototypeManager.TryIndex(reagentId, out ReagentPrototype reagent)) continue;
|
||||||
split.RemoveReagent(reagentId, reagent.ReactionEntity(target, ReactionMethod.Ingestion, quantity));
|
split.RemoveReagent(reagentId, reagent.ReactionEntity(trueTarget, ReactionMethod.Ingestion, quantity));
|
||||||
}
|
}
|
||||||
|
|
||||||
firstStomach.TryTransferSolution(split);
|
firstStomach.TryTransferSolution(split);
|
||||||
|
|||||||
@@ -88,6 +88,9 @@ namespace Content.Shared.Chemistry
|
|||||||
{
|
{
|
||||||
var removed = ReagentUnit.Zero;
|
var removed = ReagentUnit.Zero;
|
||||||
|
|
||||||
|
if (entity == null || entity.Deleted)
|
||||||
|
return removed;
|
||||||
|
|
||||||
foreach (var react in entity.GetAllComponents<IReagentReaction>())
|
foreach (var react in entity.GetAllComponents<IReagentReaction>())
|
||||||
{
|
{
|
||||||
switch (method)
|
switch (method)
|
||||||
|
|||||||
Reference in New Issue
Block a user