DrinkSystem uses EntityUid instead of IEntity
This commit is contained in:
@@ -14,30 +14,30 @@ namespace Content.Shared.Chemistry
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
public void ReactionEntity(IEntity entity, ReactionMethod method, Solution solution)
|
||||
public void ReactionEntity(EntityUid uid, ReactionMethod method, Solution solution)
|
||||
{
|
||||
foreach (var (id, quantity) in solution)
|
||||
{
|
||||
ReactionEntity(entity, method, id, quantity, solution);
|
||||
ReactionEntity(uid, method, id, quantity, solution);
|
||||
}
|
||||
}
|
||||
|
||||
public void ReactionEntity(IEntity entity, ReactionMethod method, string reagentId, FixedPoint2 reactVolume, Solution? source)
|
||||
public void ReactionEntity(EntityUid uid, ReactionMethod method, string reagentId, FixedPoint2 reactVolume, Solution? source)
|
||||
{
|
||||
// We throw if the reagent specified doesn't exist.
|
||||
ReactionEntity(entity, method, _prototypeManager.Index<ReagentPrototype>(reagentId), reactVolume, source);
|
||||
ReactionEntity(uid, method, _prototypeManager.Index<ReagentPrototype>(reagentId), reactVolume, source);
|
||||
}
|
||||
|
||||
public void ReactionEntity(IEntity entity, ReactionMethod method, ReagentPrototype reagent,
|
||||
public void ReactionEntity(EntityUid uid, ReactionMethod method, ReagentPrototype reagent,
|
||||
FixedPoint2 reactVolume, Solution? source)
|
||||
{
|
||||
if (entity == null || entity.Deleted || !entity.TryGetComponent(out ReactiveComponent? reactive))
|
||||
if (!EntityManager.TryGetComponent(uid, out ReactiveComponent? reactive))
|
||||
return;
|
||||
|
||||
foreach (var reaction in reactive.Reactions)
|
||||
{
|
||||
// If we have a source solution, use the reagent quantity we have left. Otherwise, use the reaction volume specified.
|
||||
reaction.React(method, entity.Uid, reagent, source?.GetReagentQuantity(reagent.ID) ?? reactVolume, source, EntityManager);
|
||||
reaction.React(method, uid, reagent, source?.GetReagentQuantity(reagent.ID) ?? reactVolume, source, EntityManager);
|
||||
|
||||
// Make sure we still have enough reagent to go...
|
||||
if (source != null && !source.ContainsReagent(reagent.ID))
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Content.Shared.Chemistry.Components
|
||||
[ViewVariables]
|
||||
[DataField("reagents")]
|
||||
public List<ReagentQuantity> Contents = new(2);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The calculated total volume of all reagents in the solution (ex. Total volume of liquid in beaker).
|
||||
/// </summary>
|
||||
@@ -332,13 +332,13 @@ namespace Content.Shared.Chemistry.Components
|
||||
return newSolution;
|
||||
}
|
||||
|
||||
public void DoEntityReaction(IEntity entity, ReactionMethod method)
|
||||
public void DoEntityReaction(EntityUid uid, ReactionMethod method)
|
||||
{
|
||||
var chemistry = EntitySystem.Get<ChemistrySystem>();
|
||||
|
||||
foreach (var (reagentId, quantity) in Contents.ToArray())
|
||||
{
|
||||
chemistry.ReactionEntity(entity, method, reagentId, quantity, this);
|
||||
chemistry.ReactionEntity(uid, method, reagentId, quantity, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user