Merge branch 'master-upstream' into expl_int_analyzer
# Conflicts: # Content.Server/GameObjects/Components/Body/Part/BodyPartComponent.cs # Content.Server/GameObjects/Components/Botany/PlantHolderComponent.cs # Content.Server/GameObjects/Components/Chemistry/PillComponent.cs # Content.Server/GameObjects/Components/Interactable/TilePryingComponent.cs # Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs # Content.Server/GameObjects/Components/Items/RCD/RCDAmmoComponent.cs # Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs # Content.Server/GameObjects/Components/Medical/HealingComponent.cs # Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs # Content.Shared/Chemistry/Solution.cs
This commit is contained in:
@@ -3,11 +3,9 @@ using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Body.Behavior;
|
||||
using Content.Server.GameObjects.Components.Chemistry;
|
||||
using Content.Server.GameObjects.Components.Fluids;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Body.Mechanism;
|
||||
using Content.Shared.GameObjects.Components.Nutrition;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Interfaces;
|
||||
@@ -75,7 +73,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
_contents = Owner.AddComponent<SolutionContainerComponent>();
|
||||
}
|
||||
|
||||
_contents.Capabilities = SolutionContainerCaps.AddTo | SolutionContainerCaps.RemoveFrom;
|
||||
_contents.Capabilities = SolutionContainerCaps.Refillable | SolutionContainerCaps.Drainable;
|
||||
Opened = _defaultToOpened;
|
||||
UpdateAppearance();
|
||||
}
|
||||
@@ -113,9 +111,10 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
}
|
||||
|
||||
//Force feeding a drink to someone.
|
||||
async Task IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
{
|
||||
TryUseDrink(eventArgs.Target, forced: true);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
@@ -131,7 +130,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
|
||||
private bool TryUseDrink(IEntity target, bool forced = false)
|
||||
{
|
||||
if (target == null || !_contents.CanRemoveSolutions)
|
||||
if (target == null || !_contents.CanDrain)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -181,11 +180,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
|
||||
// TODO: Account for partial transfer.
|
||||
|
||||
foreach (var (reagentId, quantity) in split.Contents)
|
||||
{
|
||||
if (!_prototypeManager.TryIndex(reagentId, out ReagentPrototype reagent)) continue;
|
||||
split.RemoveReagent(reagentId, reagent.ReactionEntity(target, ReactionMethod.Ingestion, quantity));
|
||||
}
|
||||
split.DoEntityReaction(target, ReactionMethod.Ingestion);
|
||||
|
||||
firstStomach.TryTransferSolution(split);
|
||||
|
||||
|
||||
@@ -100,14 +100,15 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
}
|
||||
|
||||
// Feeding someone else
|
||||
async Task IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
{
|
||||
if (eventArgs.Target == null)
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
TryUseFood(eventArgs.User, eventArgs.Target);
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool TryUseFood(IEntity? user, IEntity? target, UtensilComponent? utensilUsed = null)
|
||||
@@ -183,11 +184,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
|
||||
// TODO: Account for partial transfer.
|
||||
|
||||
foreach (var (reagentId, quantity) in split.Contents)
|
||||
{
|
||||
if (!_prototypeManager.TryIndex(reagentId, out ReagentPrototype reagent)) continue;
|
||||
split.RemoveReagent(reagentId, reagent.ReactionEntity(trueTarget, ReactionMethod.Ingestion, quantity));
|
||||
}
|
||||
split.DoEntityReaction(trueTarget, ReactionMethod.Ingestion);
|
||||
|
||||
firstStomach.TryTransferSolution(split);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user