Extractible tweak - Allow grinding and juicing (#5112)

This commit is contained in:
Ygg01
2021-11-02 05:20:14 +01:00
committed by GitHub
parent 0625d5d117
commit 8c81312c0c
6 changed files with 30 additions and 23 deletions

View File

@@ -17,11 +17,11 @@ namespace Content.Server.Kitchen.Components
public override string Name => "Extractable"; public override string Name => "Extractable";
[ViewVariables] [ViewVariables]
[DataField("result")] [DataField("juiceSolution")]
public Solution ResultSolution = new(); public Solution? JuiceSolution;
[ViewVariables] [ViewVariables]
[DataField("extractableSolution")] [DataField("grindableSolutionName")]
public string? GrindableSolution; public string? GrindableSolution;
} }
} }

View File

@@ -20,6 +20,7 @@ using Robust.Shared.Containers;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Localization; using Robust.Shared.Localization;
using Robust.Shared.Log;
using Robust.Shared.Player; using Robust.Shared.Player;
using Robust.Shared.Utility; using Robust.Shared.Utility;
@@ -227,8 +228,9 @@ namespace Content.Server.Kitchen.EntitySystems
{ {
if (canJuice || !entity.TryGetComponent(out ExtractableComponent? component)) continue; if (canJuice || !entity.TryGetComponent(out ExtractableComponent? component)) continue;
canJuice = component.GrindableSolution == null; canJuice = component.JuiceSolution != null;
canGrind = component.GrindableSolution != 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()) 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 var juiceEvent = new ExtractableScalingEvent(); // default of scalar is always 1.0
if (item.HasComponent<StackComponent>()) if (item.HasComponent<StackComponent>())
{ {
@@ -340,10 +347,10 @@ namespace Content.Server.Kitchen.EntitySystems
} }
if (component.HeldBeaker.CurrentVolume + if (component.HeldBeaker.CurrentVolume +
juiceMe.ResultSolution.TotalVolume * juiceEvent.Scalar > juiceMe.JuiceSolution.TotalVolume * juiceEvent.Scalar >
component.HeldBeaker.MaxVolume) continue; component.HeldBeaker.MaxVolume) continue;
juiceMe.ResultSolution.ScaleSolution(juiceEvent.Scalar); juiceMe.JuiceSolution.ScaleSolution(juiceEvent.Scalar);
_solutionsSystem.TryAddSolution(beakerEntity.Uid, component.HeldBeaker, juiceMe.ResultSolution); _solutionsSystem.TryAddSolution(beakerEntity.Uid, component.HeldBeaker, juiceMe.JuiceSolution);
item.Delete(); item.Delete();
} }

View File

@@ -9,7 +9,7 @@
- type: Mechanism - type: Mechanism
- type: Food - type: Food
- type: Extractable - type: Extractable
extractableSolution: extractableSolution grindableSolutionName: organ
- type: SolutionContainerManager - type: SolutionContainerManager
solutions: solutions:
organ: organ:

View File

@@ -385,7 +385,7 @@
# a mob is dead or something idk # a mob is dead or something idk
- type: Food - type: Food
- type: Extractable - type: Extractable
extractableSolution: food grindableSolutionName: food
- type: SolutionContainerManager - type: SolutionContainerManager
solutions: solutions:
food: food:

View File

@@ -11,7 +11,7 @@
state: produce state: produce
- type: Produce - type: Produce
- type: Extractable - type: Extractable
extractableSolution: food grindableSolutionName: food
# For produce that can be immediately eaten # For produce that can be immediately eaten
@@ -26,7 +26,6 @@
state: produce state: produce
- type: Produce - type: Produce
- type: Extractable - type: Extractable
extractableSolution: food
# Subclasses # Subclasses
@@ -64,7 +63,7 @@
- type: Produce - type: Produce
seed: oat seed: oat
- type: Extractable - type: Extractable
result: juiceSolution:
reagents: reagents:
- ReagentId: MilkOat - ReagentId: MilkOat
Quantity: 5 Quantity: 5
@@ -123,7 +122,7 @@
- type: Produce - type: Produce
seed: banana seed: banana
- type: Extractable - type: Extractable
result: juiceSolution:
reagents: reagents:
- ReagentId: JuiceBanana - ReagentId: JuiceBanana
Quantity: 10 Quantity: 10
@@ -181,7 +180,7 @@
- type: Produce - type: Produce
seed: carrots seed: carrots
- type: Extractable - type: Extractable
result: juiceSolution:
reagents: reagents:
- ReagentId: JuiceCarrot - ReagentId: JuiceCarrot
Quantity: 10 Quantity: 10
@@ -204,7 +203,7 @@
- type: Produce - type: Produce
seed: lemon seed: lemon
- type: Extractable - type: Extractable
result: juiceSolution:
reagents: reagents:
- ReagentId: JuiceLime - ReagentId: JuiceLime
Quantity: 10 Quantity: 10
@@ -227,7 +226,7 @@
- type: Produce - type: Produce
seed: pineapple seed: pineapple
- type: Extractable - type: Extractable
result: juiceSolution:
reagents: reagents:
- ReagentId: JuicePineapple - ReagentId: JuicePineapple
Quantity: 10 Quantity: 10
@@ -269,7 +268,8 @@
- type: Produce - type: Produce
seed: tomato seed: tomato
- type: Extractable - type: Extractable
result: grindableSolutionName: food
juiceSolution:
reagents: reagents:
- ReagentId: JuiceTomato - ReagentId: JuiceTomato
Quantity: 10 Quantity: 10
@@ -364,7 +364,7 @@
- type: Produce - type: Produce
seed: apple seed: apple
- type: Extractable - type: Extractable
result: juiceSolution:
reagents: reagents:
- ReagentId: JuiceApple - ReagentId: JuiceApple
Quantity: 10 Quantity: 10
@@ -477,7 +477,7 @@
netsync: false netsync: false
state: slice state: slice
- type: Extractable - type: Extractable
extractableSolution: food grindableSolutionName: food
- type: entity - type: entity
name: pineapple slice name: pineapple slice
@@ -488,7 +488,7 @@
- type: Sprite - type: Sprite
sprite: Objects/Specific/Hydroponics/pineapple.rsi sprite: Objects/Specific/Hydroponics/pineapple.rsi
- type: Extractable - type: Extractable
result: juiceSolution:
reagents: reagents:
- ReagentId: JuicePineapple - ReagentId: JuicePineapple
Quantity: 2 Quantity: 2

View File

@@ -93,7 +93,7 @@
- plasma_2 - plasma_2
- plasma_3 - plasma_3
- type: Extractable - type: Extractable
extractableSolution: plasma grindableSolutionName: plasma
- type: SolutionContainerManager - type: SolutionContainerManager
solutions: solutions:
plasma: plasma: