Remove LungBehavior and replace with LungComponent/System (#5630)
This commit is contained in:
@@ -27,6 +27,7 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Nutrition.EntitySystems
|
||||
{
|
||||
@@ -263,8 +264,8 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
|
||||
var transferAmount = FixedPoint2.Min(drink.TransferAmount, drinkSolution.DrainAvailable);
|
||||
var drain = _solutionContainerSystem.Drain(uid, drinkSolution, transferAmount);
|
||||
var firstStomach = stomachs.FirstOrDefault(
|
||||
stomach => _stomachSystem.CanTransferSolution(stomach.OwnerUid, drain));
|
||||
var firstStomach = stomachs.FirstOrNull(
|
||||
stomach => _stomachSystem.CanTransferSolution(stomach.Comp.OwnerUid, drain));
|
||||
|
||||
// All stomach are full or can't handle whatever solution we have.
|
||||
if (firstStomach == null)
|
||||
@@ -289,7 +290,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
Filter.Pvs(userUid));
|
||||
|
||||
drain.DoEntityReaction(userUid, ReactionMethod.Ingestion);
|
||||
_stomachSystem.TryTransferSolution(firstStomach.OwnerUid, drain, firstStomach);
|
||||
_stomachSystem.TryTransferSolution(firstStomach.Value.Comp.OwnerUid, drain, firstStomach.Value.Comp);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -371,8 +372,8 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
return;
|
||||
}
|
||||
|
||||
var firstStomach = stomachs.FirstOrDefault(
|
||||
stomach => _stomachSystem.CanTransferSolution(stomach.OwnerUid, drained));
|
||||
var firstStomach = stomachs.FirstOrNull(
|
||||
stomach => _stomachSystem.CanTransferSolution(stomach.Comp.OwnerUid, drained));
|
||||
|
||||
// All stomach are full or can't handle whatever solution we have.
|
||||
if (firstStomach == null)
|
||||
@@ -399,7 +400,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
SoundSystem.Play(Filter.Pvs(uid), args.Drink.UseSound.GetSound(), uid, AudioParams.Default.WithVolume(-2f));
|
||||
|
||||
drained.DoEntityReaction(uid, ReactionMethod.Ingestion);
|
||||
_stomachSystem.TryTransferSolution(firstStomach.OwnerUid, drained, firstStomach);
|
||||
_stomachSystem.TryTransferSolution(firstStomach.Value.Comp.OwnerUid, drained, firstStomach.Value.Comp);
|
||||
}
|
||||
|
||||
private void OnForceDrinkCancelled(ForceDrinkCancelledEvent args)
|
||||
|
||||
Reference in New Issue
Block a user