Skip to content

Commit

Permalink
empty airtanks were working with the breathing tube
Browse files Browse the repository at this point in the history
  • Loading branch information
FaceDeer committed Sep 7, 2022
1 parent b686694 commit 6f02c5e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ local function use_any_airtank(player)
local hotbar = player:hud_get_hotbar_itemcount()
for i=1, hotbar do
local itemstack = inv:get_stack("main", i)
if minetest.get_item_group(itemstack:get_name(), "airtank") > 0 then
if minetest.get_item_group(itemstack:get_name(), "airtank") > 1 then
itemstack = use_airtank(itemstack, player)
inv:set_stack("main", i, itemstack)
return true
Expand All @@ -591,8 +591,7 @@ local function use_any_airtank(player)
end

local function player_event_handler(player, eventname)
assert(player:is_player())
if eventname == "breath_changed" and player:get_breath() < 5 and tool_active(player, "airtanks:breathing_tube") then
if player:is_player() and eventname == "breath_changed" and player:get_breath() < 5 and tool_active(player, "airtanks:breathing_tube") then
if not use_any_airtank(player) then
minetest.sound_play("airtanks_gasp", {pos = player:get_pos(), gain = 0.5})
end
Expand Down

0 comments on commit 6f02c5e

Please sign in to comment.