Clean up terrible solution entity reaction copy pasta.
This commit is contained in:
@@ -3,6 +3,8 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Serialization;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
@@ -315,6 +317,20 @@ namespace Content.Shared.Chemistry
|
||||
return newSolution;
|
||||
}
|
||||
|
||||
public void DoEntityReaction(IEntity entity, ReactionMethod method)
|
||||
{
|
||||
var proto = IoCManager.Resolve<IPrototypeManager>();
|
||||
|
||||
foreach (var (reagentId, quantity) in _contents)
|
||||
{
|
||||
if (!proto.TryIndex(reagentId, out ReagentPrototype reagent))
|
||||
continue;
|
||||
|
||||
var removedAmount = reagent.ReactionEntity(entity, method, quantity);
|
||||
RemoveReagent(reagentId, removedAmount);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public readonly struct ReagentQuantity: IComparable<ReagentQuantity>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user