Extractible tweak - Allow grinding and juicing (#5112)
This commit is contained in:
@@ -20,6 +20,7 @@ using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -227,8 +228,9 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
{
|
||||
if (canJuice || !entity.TryGetComponent(out ExtractableComponent? component)) continue;
|
||||
|
||||
canJuice = component.GrindableSolution == null;
|
||||
canGrind = component.GrindableSolution != null;
|
||||
canJuice = component.JuiceSolution != null;
|
||||
canGrind = component.GrindableSolution != null
|
||||
&& _solutionsSystem.TryGetSolution(entity.Uid, component.GrindableSolution, out _);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,7 +334,12 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
{
|
||||
foreach (var item in component.Chamber.ContainedEntities.ToList())
|
||||
{
|
||||
if (!item.TryGetComponent<ExtractableComponent>(out var juiceMe)) continue;
|
||||
if (!item.TryGetComponent<ExtractableComponent>(out var juiceMe)
|
||||
|| juiceMe.JuiceSolution == null)
|
||||
{
|
||||
Logger.Warning("Couldn't find a juice solution on entityUid:{0}", item.Uid);
|
||||
continue;
|
||||
}
|
||||
var juiceEvent = new ExtractableScalingEvent(); // default of scalar is always 1.0
|
||||
if (item.HasComponent<StackComponent>())
|
||||
{
|
||||
@@ -340,10 +347,10 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
}
|
||||
|
||||
if (component.HeldBeaker.CurrentVolume +
|
||||
juiceMe.ResultSolution.TotalVolume * juiceEvent.Scalar >
|
||||
juiceMe.JuiceSolution.TotalVolume * juiceEvent.Scalar >
|
||||
component.HeldBeaker.MaxVolume) continue;
|
||||
juiceMe.ResultSolution.ScaleSolution(juiceEvent.Scalar);
|
||||
_solutionsSystem.TryAddSolution(beakerEntity.Uid, component.HeldBeaker, juiceMe.ResultSolution);
|
||||
juiceMe.JuiceSolution.ScaleSolution(juiceEvent.Scalar);
|
||||
_solutionsSystem.TryAddSolution(beakerEntity.Uid, component.HeldBeaker, juiceMe.JuiceSolution);
|
||||
item.Delete();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user