Skip to content

Commit

Permalink
fix: potions add flask to player (#2538)
Browse files Browse the repository at this point in the history
  • Loading branch information
Luan Luciano authored Apr 17, 2024
1 parent d2d44cd commit 582e286
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions data/scripts/actions/items/potions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,13 @@ function flaskPotion.onUse(player, item, fromPosition, target, toPosition, isHot
local deactivatedFlasks = player:kv():get("talkaction.potions.flask") or false
if not deactivatedFlasks then
local container = Container(item:getParent().uid)
local inbox = player:getSlotItem(CONST_SLOT_STORE_INBOX)

if fromPosition.x == CONTAINER_POSITION and container ~= inbox and container:getEmptySlots() ~= 0 then
container:addItem(potion.flask, 1)
if container then
local storeInbox = player:getSlotItem(CONST_SLOT_STORE_INBOX)
if fromPosition.x == CONTAINER_POSITION and container ~= storeInbox and container:getEmptySlots() ~= 0 then
container:addItem(potion.flask, 1)
else
player:addItem(potion.flask, 1)
end
else
Game.createItem(potion.flask, 1, fromPosition)
end
Expand Down

0 comments on commit 582e286

Please sign in to comment.