Properly track players' LMB keypresses
Fixes automatic fire continuing after player's death and respawn
This commit is contained in:
parent
b8b1c6d368
commit
bc0fc7f43c
2 changed files with 7 additions and 4 deletions
|
@ -551,3 +551,7 @@ end
|
||||||
shooter.set_shooting = function(name, is_shooting)
|
shooter.set_shooting = function(name, is_shooting)
|
||||||
shooting[name] = is_shooting and true or nil
|
shooting[name] = is_shooting and true or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.register_on_dieplayer(function(player)
|
||||||
|
shooting[player:get_player_name()] = nil
|
||||||
|
end)
|
||||||
|
|
|
@ -69,9 +69,8 @@ if shooter.config.automatic_weapons == true then
|
||||||
minetest.register_globalstep(function()
|
minetest.register_globalstep(function()
|
||||||
for _, player in pairs(minetest.get_connected_players()) do
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if name then
|
if shooter.get_shooting(name) and not player:get_player_control().LMB then
|
||||||
shooter.set_shooting(name,
|
shooter.set_shooting(name, nil)
|
||||||
player:get_player_control().LMB == true)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in a new issue