mirror of
https://github.com/minetest-mods/airtanks.git
synced 2025-01-12 21:17:27 +01:00
empty airtanks were working with the breathing tube
This commit is contained in:
parent
b686694979
commit
6f02c5ee64
5
init.lua
5
init.lua
@ -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
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user