Uranium is now edible! (#15952)
This commit is contained in:
@@ -13,6 +13,7 @@ using Robust.Shared.GameStates;
|
|||||||
using Content.Shared.DoAfter;
|
using Content.Shared.DoAfter;
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
|
using Content.Shared.Stacks;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
|
|
||||||
@@ -297,9 +298,7 @@ public sealed partial class ChemistrySystem
|
|||||||
{
|
{
|
||||||
if (!_solutions.TryGetSolution(injector, InjectorComponent.SolutionName, out var solution)
|
if (!_solutions.TryGetSolution(injector, InjectorComponent.SolutionName, out var solution)
|
||||||
|| solution.Volume == 0)
|
|| solution.Volume == 0)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// Get transfer amount. May be smaller than _transferAmount if not enough room
|
// Get transfer amount. May be smaller than _transferAmount if not enough room
|
||||||
var realTransferAmount = FixedPoint2.Min(component.TransferAmount, targetSolution.AvailableVolume);
|
var realTransferAmount = FixedPoint2.Min(component.TransferAmount, targetSolution.AvailableVolume);
|
||||||
@@ -312,18 +311,18 @@ public sealed partial class ChemistrySystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move units from attackSolution to targetSolution
|
// Move units from attackSolution to targetSolution
|
||||||
var removedSolution = _solutions.SplitSolution(injector, solution, realTransferAmount);
|
Solution removedSolution;
|
||||||
|
if (TryComp<StackComponent>(targetEntity, out var stack))
|
||||||
|
removedSolution = _solutions.SplitStackSolution(injector, solution, realTransferAmount, stack.Count);
|
||||||
|
else
|
||||||
|
removedSolution = _solutions.SplitSolution(injector, solution, realTransferAmount);
|
||||||
|
|
||||||
_reactiveSystem.DoEntityReaction(targetEntity, removedSolution, ReactionMethod.Injection);
|
_reactiveSystem.DoEntityReaction(targetEntity, removedSolution, ReactionMethod.Injection);
|
||||||
|
|
||||||
if (!asRefill)
|
if (!asRefill)
|
||||||
{
|
|
||||||
_solutions.Inject(targetEntity, targetSolution, removedSolution);
|
_solutions.Inject(targetEntity, targetSolution, removedSolution);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
_solutions.Refill(targetEntity, targetSolution, removedSolution);
|
_solutions.Refill(targetEntity, targetSolution, removedSolution);
|
||||||
}
|
|
||||||
|
|
||||||
_popup.PopupEntity(Loc.GetString("injector-component-transfer-success-message",
|
_popup.PopupEntity(Loc.GetString("injector-component-transfer-success-message",
|
||||||
("amount", removedSolution.Volume),
|
("amount", removedSolution.Volume),
|
||||||
|
|||||||
@@ -128,6 +128,14 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
|||||||
return splitSol;
|
return splitSol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Solution SplitStackSolution(EntityUid targetUid, Solution solutionHolder, FixedPoint2 quantity, int stackCount)
|
||||||
|
{
|
||||||
|
var splitSol = solutionHolder.SplitSolution(quantity / stackCount);
|
||||||
|
Solution attackSolutionHolder = solutionHolder.SplitSolution(quantity - splitSol.Volume);
|
||||||
|
UpdateChemicals(targetUid, solutionHolder);
|
||||||
|
return splitSol;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Splits a solution without the specified reagent(s).
|
/// Splits a solution without the specified reagent(s).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Server.Body.Systems;
|
|||||||
using Content.Server.Chemistry.EntitySystems;
|
using Content.Server.Chemistry.EntitySystems;
|
||||||
using Content.Server.Nutrition.Components;
|
using Content.Server.Nutrition.Components;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
|
using Content.Server.Stack;
|
||||||
using Content.Shared.Administration.Logs;
|
using Content.Shared.Administration.Logs;
|
||||||
using Content.Shared.Body.Components;
|
using Content.Shared.Body.Components;
|
||||||
using Content.Shared.Body.Organ;
|
using Content.Shared.Body.Organ;
|
||||||
@@ -22,6 +23,7 @@ using Content.Shared.Mobs.Components;
|
|||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
using Content.Shared.Nutrition;
|
using Content.Shared.Nutrition;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
|
using Content.Shared.Stacks;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
@@ -47,6 +49,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||||
[Dependency] private readonly ReactiveSystem _reaction = default!;
|
[Dependency] private readonly ReactiveSystem _reaction = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
|
[Dependency] private readonly StackSystem _stack = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -260,7 +263,19 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
_utensilSystem.TryBreak(utensil, args.User);
|
_utensilSystem.TryBreak(utensil, args.User);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (component.UsesRemaining > 0)
|
args.Repeat = !forceFeed;
|
||||||
|
|
||||||
|
if (TryComp<StackComponent>(uid, out var stack))
|
||||||
|
{
|
||||||
|
//Not deleting whole stack piece will make troubles with grinding object
|
||||||
|
if (stack.Count > 1)
|
||||||
|
{
|
||||||
|
_stack.SetCount(uid, stack.Count - 1);
|
||||||
|
_solutionContainerSystem.TryAddSolution(uid, solution, split);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (component.UsesRemaining > 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,12 +143,14 @@
|
|||||||
count: 1
|
count: 1
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: SheetOtherBase
|
parent: [SheetOtherBase, FoodBase]
|
||||||
id: SheetUranium
|
id: SheetUranium
|
||||||
name: uranium
|
name: uranium
|
||||||
suffix: Full
|
suffix: Full
|
||||||
components:
|
components:
|
||||||
- type: Material
|
- type: Material
|
||||||
|
- type: Food
|
||||||
|
transferAmount: 10
|
||||||
- type: PhysicalComposition
|
- type: PhysicalComposition
|
||||||
materialComposition:
|
materialComposition:
|
||||||
Uranium: 100
|
Uranium: 100
|
||||||
@@ -166,10 +168,10 @@
|
|||||||
- type: Item
|
- type: Item
|
||||||
heldPrefix: uranium
|
heldPrefix: uranium
|
||||||
- type: Extractable
|
- type: Extractable
|
||||||
grindableSolutionName: uranium
|
grindableSolutionName: food
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
uranium:
|
food:
|
||||||
reagents:
|
reagents:
|
||||||
- ReagentId: Uranium
|
- ReagentId: Uranium
|
||||||
Quantity: 10
|
Quantity: 10
|
||||||
|
|||||||
Reference in New Issue
Block a user