Fix drinking glasses not fitting in reagent dispensers.
This commit is contained in:
@@ -8,6 +8,7 @@ using Content.Server.Power.Components;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Components.SolutionManager;
|
||||
using Content.Shared.Chemistry.Dispenser;
|
||||
using Content.Shared.Chemistry.EntitySystems;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
@@ -228,8 +229,8 @@ namespace Content.Server.Chemistry.Components
|
||||
private ReagentDispenserBoundUserInterfaceState GetUserInterfaceState()
|
||||
{
|
||||
var beaker = _beakerContainer.ContainedEntity;
|
||||
if (beaker == null ||
|
||||
!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(beaker, "beaker", out var solution))
|
||||
if (beaker == null || !beaker.TryGetComponent(out FitsInDispenserComponent? fits) ||
|
||||
!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(beaker, fits.Solution, out var solution))
|
||||
{
|
||||
return new ReagentDispenserBoundUserInterfaceState(Powered, false, ReagentUnit.New(0),
|
||||
ReagentUnit.New(0),
|
||||
@@ -275,9 +276,9 @@ namespace Content.Server.Chemistry.Components
|
||||
/// </summary>
|
||||
private void TryClear()
|
||||
{
|
||||
if (!HasBeaker ||
|
||||
if (!HasBeaker || !_beakerContainer.ContainedEntity!.TryGetComponent(out FitsInDispenserComponent? fits) ||
|
||||
!EntitySystem.Get<SolutionContainerSystem>()
|
||||
.TryGetSolution(_beakerContainer.ContainedEntity, "beaker", out var solution))
|
||||
.TryGetSolution(_beakerContainer.ContainedEntity, fits.Solution, out var solution))
|
||||
return;
|
||||
|
||||
EntitySystem.Get<SolutionContainerSystem>().RemoveAllSolution(_beakerContainer.ContainedEntity!.Uid, solution);
|
||||
@@ -293,9 +294,9 @@ namespace Content.Server.Chemistry.Components
|
||||
{
|
||||
if (!HasBeaker) return;
|
||||
|
||||
if (_beakerContainer.ContainedEntity == null
|
||||
if (_beakerContainer.ContainedEntity is not {} contained || !contained.TryGetComponent(out FitsInDispenserComponent? fits)
|
||||
|| !EntitySystem.Get<SolutionContainerSystem>()
|
||||
.TryGetSolution(_beakerContainer.ContainedEntity, "beaker", out var solution)) return;
|
||||
.TryGetSolution(_beakerContainer.ContainedEntity, fits.Solution, out var solution)) return;
|
||||
|
||||
EntitySystem.Get<SolutionContainerSystem>()
|
||||
.TryAddReagent(_beakerContainer.ContainedEntity.Uid, solution, Inventory[dispenseIndex].ID, _dispenseAmount, out _);
|
||||
@@ -349,34 +350,27 @@ namespace Content.Server.Chemistry.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
var solutionSys = EntitySystem.Get<SolutionContainerSystem>();
|
||||
var activeHandEntity = hands.GetActiveHand.Owner;
|
||||
if (solutionSys.TryGetSolution(activeHandEntity, "beaker", out _))
|
||||
if (activeHandEntity.HasComponent<FitsInDispenserComponent>())
|
||||
{
|
||||
if (HasBeaker)
|
||||
{
|
||||
Owner.PopupMessage(args.User,
|
||||
Loc.GetString("reagent-dispenser-component-has-container-already-message"));
|
||||
return false;
|
||||
}
|
||||
else if (!solutionSys.HasFitsInDispenser(activeHandEntity))
|
||||
{
|
||||
//If it can't fit in the dispenser, don't put it in. For example, buckets and mop buckets can't fit.
|
||||
Owner.PopupMessage(args.User, Loc.GetString("reagent-dispenser-component-cannot-fit-message"));
|
||||
}
|
||||
else
|
||||
{
|
||||
_beakerContainer.Insert(activeHandEntity);
|
||||
UpdateUserInterface();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Owner.PopupMessage(args.User,
|
||||
Loc.GetString("reagent-dispenser-component-cannot-put-entity-message",
|
||||
("entity", activeHandEntity)));
|
||||
|
||||
_beakerContainer.Insert(activeHandEntity);
|
||||
UpdateUserInterface();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
Owner.PopupMessage(args.User,
|
||||
Loc.GetString("reagent-dispenser-component-cannot-put-entity-message",
|
||||
("entity", activeHandEntity)));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void ClickSound()
|
||||
|
||||
4
Resources/Changelog/Parts/dispenser.txt
Normal file
4
Resources/Changelog/Parts/dispenser.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
author: Zumorica
|
||||
changes:
|
||||
- type: Fix # One of the following: Add, Remove, Tweak, Fix
|
||||
message: Fixes drinking glasses not fitting in reagent dispensers.
|
||||
@@ -6,8 +6,7 @@ reagent-dispenser-component-interact-using-nothing-in-hands = You have nothing i
|
||||
|
||||
reagent-dispenser-component-has-container-already-message = This dispenser already has a container in it.
|
||||
reagent-dispenser-component-container-too-large-message = The {$container} is too large for the ChemMaster!
|
||||
reagent-dispenser-component-cannot-put-entity-message = You can't put {$entity} in the dispenser!
|
||||
reagent-dispenser-component-cannot-fit-message = That can't fit in the dispenser.
|
||||
reagent-dispenser-component-cannot-put-entity-message = You can't put { THE($entity) } in the dispenser!
|
||||
|
||||
## Bound UI
|
||||
|
||||
@@ -16,10 +15,10 @@ reagent-dispenser-bound-user-interface-title = Reagent dispenser
|
||||
## UI
|
||||
|
||||
reagent-dispenser-window-amount-to-dispense-label = Amount
|
||||
reagent-dispenser-window-container-label = Container:
|
||||
reagent-dispenser-window-clear-button = Clear
|
||||
reagent-dispenser-window-eject-button = Eject
|
||||
reagent-dispenser-window-container-label = Container:
|
||||
reagent-dispenser-window-clear-button = Clear
|
||||
reagent-dispenser-window-eject-button = Eject
|
||||
reagent-dispenser-window-no-container-loaded-text = No container loaded.
|
||||
reagent-dispenser-window-reagent-name-not-found-text = Reagent name not found
|
||||
reagent-dispenser-window-unknown-reagent-text = Unknown reagent
|
||||
reagent-dispenser-window-quantity-label-text = {$quantity}u
|
||||
reagent-dispenser-window-quantity-label-text = {$quantity}u
|
||||
|
||||
Reference in New Issue
Block a user