Adding sorting to chem master (#34763)
* Adding sorting to chem master * Chem Master can now sort based on following categories - Alphabetical - Quantity - Time Added to Machine * Sorting is disabled by default and persist in the machine for everyone * Removed some pointless code from Chem Master's UI * Changed None and Time Added's text to reflect what they do better * Minor adjustments to the code requested by maintainers
This commit is contained in:
@@ -53,6 +53,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
SubscribeLocalEvent<ChemMasterComponent, BoundUIOpenedEvent>(SubscribeUpdateUiState);
|
||||
|
||||
SubscribeLocalEvent<ChemMasterComponent, ChemMasterSetModeMessage>(OnSetModeMessage);
|
||||
SubscribeLocalEvent<ChemMasterComponent, ChemMasterSortingTypeCycleMessage>(OnCycleSortingTypeMessage);
|
||||
SubscribeLocalEvent<ChemMasterComponent, ChemMasterSetPillTypeMessage>(OnSetPillTypeMessage);
|
||||
SubscribeLocalEvent<ChemMasterComponent, ChemMasterReagentAmountButtonMessage>(OnReagentButtonMessage);
|
||||
SubscribeLocalEvent<ChemMasterComponent, ChemMasterCreatePillsMessage>(OnCreatePillsMessage);
|
||||
@@ -76,7 +77,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
var bufferCurrentVolume = bufferSolution.Volume;
|
||||
|
||||
var state = new ChemMasterBoundUserInterfaceState(
|
||||
chemMaster.Mode, BuildInputContainerInfo(inputContainer), BuildOutputContainerInfo(outputContainer),
|
||||
chemMaster.Mode, chemMaster.SortingType, BuildInputContainerInfo(inputContainer), BuildOutputContainerInfo(outputContainer),
|
||||
bufferReagents, bufferCurrentVolume, chemMaster.PillType, chemMaster.PillDosageLimit, updateLabel);
|
||||
|
||||
_userInterfaceSystem.SetUiState(owner, ChemMasterUiKey.Key, state);
|
||||
@@ -93,6 +94,15 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
ClickSound(chemMaster);
|
||||
}
|
||||
|
||||
private void OnCycleSortingTypeMessage(Entity<ChemMasterComponent> chemMaster, ref ChemMasterSortingTypeCycleMessage message)
|
||||
{
|
||||
chemMaster.Comp.SortingType++;
|
||||
if (chemMaster.Comp.SortingType > ChemMasterSortingType.Latest)
|
||||
chemMaster.Comp.SortingType = ChemMasterSortingType.None;
|
||||
UpdateUiState(chemMaster);
|
||||
ClickSound(chemMaster);
|
||||
}
|
||||
|
||||
private void OnSetPillTypeMessage(Entity<ChemMasterComponent> chemMaster, ref ChemMasterSetPillTypeMessage message)
|
||||
{
|
||||
// Ensure valid pill type. There are 20 pills selectable, 0-19.
|
||||
|
||||
Reference in New Issue
Block a user