Extractible tweak - Allow grinding and juicing (#5112)
This commit is contained in:
@@ -17,11 +17,11 @@ namespace Content.Server.Kitchen.Components
|
||||
public override string Name => "Extractable";
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("result")]
|
||||
public Solution ResultSolution = new();
|
||||
[DataField("juiceSolution")]
|
||||
public Solution? JuiceSolution;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("extractableSolution")]
|
||||
[DataField("grindableSolutionName")]
|
||||
public string? GrindableSolution;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
- type: Mechanism
|
||||
- type: Food
|
||||
- type: Extractable
|
||||
extractableSolution: extractableSolution
|
||||
grindableSolutionName: organ
|
||||
- type: SolutionContainerManager
|
||||
solutions:
|
||||
organ:
|
||||
|
||||
@@ -385,7 +385,7 @@
|
||||
# a mob is dead or something idk
|
||||
- type: Food
|
||||
- type: Extractable
|
||||
extractableSolution: food
|
||||
grindableSolutionName: food
|
||||
- type: SolutionContainerManager
|
||||
solutions:
|
||||
food:
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
state: produce
|
||||
- type: Produce
|
||||
- type: Extractable
|
||||
extractableSolution: food
|
||||
grindableSolutionName: food
|
||||
|
||||
# For produce that can be immediately eaten
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
state: produce
|
||||
- type: Produce
|
||||
- type: Extractable
|
||||
extractableSolution: food
|
||||
|
||||
# Subclasses
|
||||
|
||||
@@ -64,7 +63,7 @@
|
||||
- type: Produce
|
||||
seed: oat
|
||||
- type: Extractable
|
||||
result:
|
||||
juiceSolution:
|
||||
reagents:
|
||||
- ReagentId: MilkOat
|
||||
Quantity: 5
|
||||
@@ -123,7 +122,7 @@
|
||||
- type: Produce
|
||||
seed: banana
|
||||
- type: Extractable
|
||||
result:
|
||||
juiceSolution:
|
||||
reagents:
|
||||
- ReagentId: JuiceBanana
|
||||
Quantity: 10
|
||||
@@ -181,7 +180,7 @@
|
||||
- type: Produce
|
||||
seed: carrots
|
||||
- type: Extractable
|
||||
result:
|
||||
juiceSolution:
|
||||
reagents:
|
||||
- ReagentId: JuiceCarrot
|
||||
Quantity: 10
|
||||
@@ -204,7 +203,7 @@
|
||||
- type: Produce
|
||||
seed: lemon
|
||||
- type: Extractable
|
||||
result:
|
||||
juiceSolution:
|
||||
reagents:
|
||||
- ReagentId: JuiceLime
|
||||
Quantity: 10
|
||||
@@ -227,7 +226,7 @@
|
||||
- type: Produce
|
||||
seed: pineapple
|
||||
- type: Extractable
|
||||
result:
|
||||
juiceSolution:
|
||||
reagents:
|
||||
- ReagentId: JuicePineapple
|
||||
Quantity: 10
|
||||
@@ -269,7 +268,8 @@
|
||||
- type: Produce
|
||||
seed: tomato
|
||||
- type: Extractable
|
||||
result:
|
||||
grindableSolutionName: food
|
||||
juiceSolution:
|
||||
reagents:
|
||||
- ReagentId: JuiceTomato
|
||||
Quantity: 10
|
||||
@@ -364,7 +364,7 @@
|
||||
- type: Produce
|
||||
seed: apple
|
||||
- type: Extractable
|
||||
result:
|
||||
juiceSolution:
|
||||
reagents:
|
||||
- ReagentId: JuiceApple
|
||||
Quantity: 10
|
||||
@@ -477,7 +477,7 @@
|
||||
netsync: false
|
||||
state: slice
|
||||
- type: Extractable
|
||||
extractableSolution: food
|
||||
grindableSolutionName: food
|
||||
|
||||
- type: entity
|
||||
name: pineapple slice
|
||||
@@ -488,7 +488,7 @@
|
||||
- type: Sprite
|
||||
sprite: Objects/Specific/Hydroponics/pineapple.rsi
|
||||
- type: Extractable
|
||||
result:
|
||||
juiceSolution:
|
||||
reagents:
|
||||
- ReagentId: JuicePineapple
|
||||
Quantity: 2
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
- plasma_2
|
||||
- plasma_3
|
||||
- type: Extractable
|
||||
extractableSolution: plasma
|
||||
grindableSolutionName: plasma
|
||||
- type: SolutionContainerManager
|
||||
solutions:
|
||||
plasma:
|
||||
|
||||
Reference in New Issue
Block a user