Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

Commit 081f88d

Browse files
committed
refactor(client): show notification when using item while armed
1 parent e5082f7 commit 081f88d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

client.lua

+11-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,13 @@ end
413413
local function useItem(data, cb, noAnim)
414414
local slotData, result = PlayerData.inventory[data.slot]
415415

416-
if not slotData or not canUseItem(data.ammo and true) then return end
416+
if not slotData or not canUseItem(data.ammo and true) then
417+
if currentWeapon then
418+
return lib.notify({ id = 'cannot_perform', type = 'error', description = locale('cannot_perform') })
419+
end
420+
421+
return
422+
end
417423

418424
if currentWeapon?.timer and currentWeapon.timer > 100 then return end
419425

@@ -650,6 +656,10 @@ local function useSlot(slot, noAnim)
650656
useItem(data)
651657
end
652658
end
659+
660+
if currentWeapon then
661+
return lib.notify({ id = 'cannot_perform', type = 'error', description = locale('cannot_perform') })
662+
end
653663
end
654664
exports('useSlot', useSlot)
655665

0 commit comments

Comments
 (0)