Inline OwnerUid
This commit is contained in:
@@ -218,13 +218,13 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
|
||||
public void UpdateAppearance(DrinkComponent component)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(component.OwnerUid, out AppearanceComponent? appearance) ||
|
||||
!EntityManager.HasComponent<SolutionContainerManagerComponent>(component.OwnerUid))
|
||||
if (!EntityManager.TryGetComponent(((IComponent) component).Owner, out AppearanceComponent? appearance) ||
|
||||
!EntityManager.HasComponent<SolutionContainerManagerComponent>(((IComponent) component).Owner))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var drainAvailable = _solutionContainerSystem.DrainAvailable(component.OwnerUid);
|
||||
var drainAvailable = _solutionContainerSystem.DrainAvailable(((IComponent) component).Owner);
|
||||
appearance.SetData(FoodVisuals.Visual, drainAvailable.Float());
|
||||
appearance.SetData(DrinkCanStateVisual.Opened, component.Opened);
|
||||
}
|
||||
@@ -248,7 +248,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
if (!EntityManager.TryGetComponent(userUid, out SharedBodyComponent? body))
|
||||
return false;
|
||||
|
||||
if (!_solutionContainerSystem.TryGetDrainableSolution(drink.OwnerUid, out var drinkSolution) ||
|
||||
if (!_solutionContainerSystem.TryGetDrainableSolution(((IComponent) drink).Owner, out var drinkSolution) ||
|
||||
drinkSolution.DrainAvailable <= 0)
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-is-empty",
|
||||
@@ -274,7 +274,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
var transferAmount = FixedPoint2.Min(drink.TransferAmount, drinkSolution.DrainAvailable);
|
||||
var drain = _solutionContainerSystem.Drain(uid, drinkSolution, transferAmount);
|
||||
var firstStomach = stomachs.FirstOrNull(
|
||||
stomach => _stomachSystem.CanTransferSolution(stomach.Comp.OwnerUid, drain));
|
||||
stomach => _stomachSystem.CanTransferSolution(((IComponent) stomach.Comp).Owner, drain));
|
||||
|
||||
// All stomach are full or can't handle whatever solution we have.
|
||||
if (firstStomach == null)
|
||||
@@ -299,7 +299,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
Filter.Pvs(userUid));
|
||||
|
||||
drain.DoEntityReaction(userUid, ReactionMethod.Ingestion);
|
||||
_stomachSystem.TryTransferSolution(firstStomach.Value.Comp.OwnerUid, drain, firstStomach.Value.Comp);
|
||||
_stomachSystem.TryTransferSolution(((IComponent) firstStomach.Value.Comp).Owner, drain, firstStomach.Value.Comp);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -378,7 +378,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
{
|
||||
args.Drink.InUse = false;
|
||||
var transferAmount = FixedPoint2.Min(args.Drink.TransferAmount, args.DrinkSolution.DrainAvailable);
|
||||
var drained = _solutionContainerSystem.Drain(args.Drink.OwnerUid, args.DrinkSolution, transferAmount);
|
||||
var drained = _solutionContainerSystem.Drain(((IComponent) args.Drink).Owner, args.DrinkSolution, transferAmount);
|
||||
|
||||
if (!_bodySystem.TryGetComponentsOnMechanisms<StomachComponent>(uid, out var stomachs, body))
|
||||
{
|
||||
@@ -390,7 +390,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
}
|
||||
|
||||
var firstStomach = stomachs.FirstOrNull(
|
||||
stomach => _stomachSystem.CanTransferSolution(stomach.Comp.OwnerUid, drained));
|
||||
stomach => _stomachSystem.CanTransferSolution(((IComponent) stomach.Comp).Owner, drained));
|
||||
|
||||
// All stomach are full or can't handle whatever solution we have.
|
||||
if (firstStomach == null)
|
||||
@@ -417,7 +417,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.Value.Comp.OwnerUid, drained, firstStomach.Value.Comp);
|
||||
_stomachSystem.TryTransferSolution(((IComponent) firstStomach.Value.Comp).Owner, drained, firstStomach.Value.Comp);
|
||||
}
|
||||
|
||||
private void OnForceDrinkCancelled(ForceDrinkCancelledEvent args)
|
||||
|
||||
Reference in New Issue
Block a user