Check for extinguishing nodes only when on fire (#2)

This change has globalstep check for extinguish nodes around player only when on fire.
This commit is contained in:
tenplus1 2021-01-23 17:52:50 +00:00 committed by GitHub
parent 9e06fa33d3
commit 2eb918f7a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,23 +35,28 @@ minetest.register_globalstep(function(dtime)
-- Put out players in extinguisher nodes
for _, player in pairs(minetest.get_connected_players()) do
local nodename = minetest.get_node(player:get_pos()).name
local nodename_head = minetest.get_node(vector.add(player:get_pos(), vector.new(0, 1, 0))).name
for _, extinguisher in pairs(fire_plus.extinguishers) do
if nodename:find(extinguisher) or nodename_head:find(extinguisher) then
local name = player:get_player_name()
local name = player:get_player_name()
if fire_plus.burning[name] then
local nodename = minetest.get_node(player:get_pos()).name
local nodename_head = minetest.get_node(vector.add(player:get_pos(),
vector.new(0, 1, 0))).name
for _, extinguisher in pairs(fire_plus.extinguishers) do
if nodename:find(extinguisher) or nodename_head:find(extinguisher) then
if fire_plus.burning[name] then
minetest.sound_play("fire_extinguish_flame", {
to_player = name,
gain = 1.0,
})
fire_plus.extinguish_player(name)
end
return
return
end
end
end
end