Cap ChemMaster label length (#12260)
* Cap ChemMaster label length * Reroll for green checkmark
This commit is contained in:
@@ -79,6 +79,9 @@ namespace Content.Client.Chemistry.UI
|
||||
PillNumber.InitDefaultButtons();
|
||||
BottleDosage.InitDefaultButtons();
|
||||
|
||||
// Ensure label length is within the character limit.
|
||||
LabelLineEdit.IsValid = s => s.Length <= SharedChemMaster.LabelMaxLength;
|
||||
|
||||
Tabs.SetTabTitle(0, Loc.GetString("chem-master-window-input-tab"));
|
||||
Tabs.SetTabTitle(1, Loc.GetString("chem-master-window-output-tab"));
|
||||
}
|
||||
|
||||
@@ -186,6 +186,10 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
if (message.Dosage == 0 || message.Dosage > chemMaster.PillDosageLimit)
|
||||
return;
|
||||
|
||||
// Ensure label length is within the character limit.
|
||||
if (message.Label.Length > SharedChemMaster.LabelMaxLength)
|
||||
return;
|
||||
|
||||
var needed = message.Dosage * message.Number;
|
||||
if (!WithdrawFromBuffer(chemMaster, needed, user, out var withdrawal))
|
||||
return;
|
||||
@@ -227,6 +231,10 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
if (message.Dosage == 0 || message.Dosage > solution.AvailableVolume)
|
||||
return;
|
||||
|
||||
// Ensure label length is within the character limit.
|
||||
if (message.Label.Length > SharedChemMaster.LabelMaxLength)
|
||||
return;
|
||||
|
||||
if (!WithdrawFromBuffer(chemMaster, message.Dosage, user, out var withdrawal))
|
||||
return;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Content.Shared.Chemistry
|
||||
public const string OutputSlotName = "outputSlot";
|
||||
public const string PillSolutionName = "food";
|
||||
public const string BottleSolutionName = "drink";
|
||||
public const uint LabelMaxLength = 50;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
Reference in New Issue
Block a user