Skip to content

Commit

Permalink
Bugfix: Drop craft and alert player if inventory is full (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyshannon committed Nov 26, 2021
1 parent 34d10e9 commit 203ce5f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,13 @@ function crafting.perform_craft(name, inv, listname, outlistname, recipe)
end

-- Add output
inv:add_item(outlistname, recipe.output)

if inv:room_for_item("main", recipe.output) then
inv:add_item(outlistname, recipe.output)
else
local pos = minetest.get_player_by_name(name):get_pos()
minetest.chat_send_player(name, "No room in inventory!")
minetest.add_item(pos, recipe.output)
end
return true
end

Expand Down

0 comments on commit 203ce5f

Please sign in to comment.