Add error popup message on equip failure (#955)

This commit is contained in:
Hugal31
2020-05-23 17:27:57 +02:00
committed by GitHub
parent 1ad9a10050
commit 6c2ad53b68
4 changed files with 69 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ using Robust.Server.GameObjects.Components.Container;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.Localization;
using Robust.Shared.Timers;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
@@ -23,15 +24,17 @@ namespace Content.Server.GameObjects
_inventory = Owner.GetComponent<InventoryComponent>();
}
bool IInventoryController.CanEquip(Slots slot, IEntity entity, bool flagsCheck)
bool IInventoryController.CanEquip(Slots slot, IEntity entity, bool flagsCheck, out string reason)
{
var slotMask = SlotMasks[slot];
reason = null;
if ((slotMask & (SlotFlags.POCKET | SlotFlags.IDCARD)) != SlotFlags.NONE)
{
// Can't wear stuff in ID card or pockets unless you have a uniform.
if (_inventory.GetSlotItem(Slots.INNERCLOTHING) == null)
{
reason = Loc.GetString("You need a uniform to store something in your pockets!");
return false;
}
@@ -44,6 +47,10 @@ namespace Content.Server.GameObjects
{
return true;
}
else if (!flagsCheck)
{
reason = Loc.GetString("This is too large!");
}
}
}