Фикс уязвимости химкомата. (#2306)
Co-authored-by: haiwwkes <49613070+rhailrake@users.noreply.github.com> Co-authored-by: Vigers Ray <vigersray@gmail.com>
This commit is contained in:
parent
aea4f57a13
commit
a8d53b10e2
2 changed files with 11 additions and 0 deletions
|
|
@ -42,6 +42,8 @@ namespace Content.Server.Chemistry.EntitySystems
|
|||
[ValidatePrototypeId<EntityPrototype>]
|
||||
private const string PillPrototypeId = "Pill";
|
||||
|
||||
private const int MaxPillsPerRequest = 50; // Sunrise-Edit
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
|
@ -200,6 +202,14 @@ namespace Content.Server.Chemistry.EntitySystems
|
|||
if (message.Number == 0 || !_storageSystem.HasSpace((container, storage)))
|
||||
return;
|
||||
|
||||
// Surnise-Start
|
||||
if (message.Number > MaxPillsPerRequest)
|
||||
{
|
||||
_popupSystem.PopupCursor(Loc.GetString("chem-master-window-too-many-pills-text"), user);
|
||||
return;
|
||||
}
|
||||
// Surnise-End
|
||||
|
||||
// Ensure the amount is valid.
|
||||
if (message.Dosage == 0 || message.Dosage > chemMaster.Comp.PillDosageLimit)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
chem-master-window-too-many-pills-text = Вы не можете создать сколько таблеток.
|
||||
Loading…
Add table
Reference in a new issue