mirror of
https://github.com/minetest-mods/airtanks.git
synced 2024-12-26 06:07:28 +01:00
Merge branch 'master' into mineclone_compatibility
This commit is contained in:
commit
d78b85489b
5
init.lua
5
init.lua
@ -620,7 +620,7 @@ local function use_any_airtank(player)
|
|||||||
local hotbar = player:hud_get_hotbar_itemcount()
|
local hotbar = player:hud_get_hotbar_itemcount()
|
||||||
for i=1, hotbar do
|
for i=1, hotbar do
|
||||||
local itemstack = inv:get_stack("main", i)
|
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)
|
itemstack = use_airtank(itemstack, player)
|
||||||
inv:set_stack("main", i, itemstack)
|
inv:set_stack("main", i, itemstack)
|
||||||
return true
|
return true
|
||||||
@ -630,8 +630,7 @@ local function use_any_airtank(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function player_event_handler(player, eventname)
|
local function player_event_handler(player, eventname)
|
||||||
assert(player:is_player())
|
if player:is_player() and eventname == "breath_changed" and player:get_breath() < 5 and tool_active(player, "airtanks:breathing_tube") then
|
||||||
if eventname == "breath_changed" and player:get_breath() < 5 and tool_active(player, "airtanks:breathing_tube") then
|
|
||||||
if not use_any_airtank(player) then
|
if not use_any_airtank(player) then
|
||||||
minetest.sound_play("airtanks_gasp", {pos = player:get_pos(), gain = 0.5})
|
minetest.sound_play("airtanks_gasp", {pos = player:get_pos(), gain = 0.5})
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user