Всякие приколы с телекристаллами (#564)
* Crossbow telecrystal * Other stuff * Less power
This commit is contained in:
@@ -219,6 +219,9 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
[DataField("priority")]
|
||||
public int Priority = 0;
|
||||
|
||||
[DataField("maxStackAmount")] // WD
|
||||
public int MaxStackAmount;
|
||||
|
||||
/// <summary>
|
||||
/// If false, errors when adding an item slot with a duplicate key are suppressed. Local==true implies that
|
||||
/// the slot was added via client component state handling.
|
||||
|
||||
@@ -8,6 +8,7 @@ using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Stacks;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
@@ -206,6 +207,20 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
if (!CanInsert(uid, args.Used, args.User, slot, swap: slot.Swap, popup: args.User))
|
||||
continue;
|
||||
|
||||
// WD START
|
||||
if (slot.MaxStackAmount > 0 && TryComp(args.Used, out StackComponent? stack) &&
|
||||
stack.Count > slot.MaxStackAmount)
|
||||
{
|
||||
if (_netManager.IsClient && _timing.IsFirstTimePredicted)
|
||||
{
|
||||
_popupSystem.PopupEntity(
|
||||
$"Невозможно одновременно вставить {stack.Count}, максимум: {slot.MaxStackAmount}.", uid,
|
||||
args.User);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// WD END
|
||||
|
||||
// Drop the held item onto the floor. Return if the user cannot drop.
|
||||
if (!_handsSystem.TryDrop(args.User, args.Used, handsComp: hands))
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user