stop people from shooting if they're shooting with a continous fire weapon when someone scores (closes #80)

This commit is contained in:
Zughy 2023-04-19 23:06:37 +02:00
parent 8a7f60a9f7
commit fc0f3a1211
2 changed files with 9 additions and 2 deletions

View File

@ -349,8 +349,13 @@ end
function after_point(teamID, arena)
-- disabilita le armi e interrompi spari vari
arena.weapons_disabled = true
for pl_name, _ in pairs(arena.players) do
minetest.get_player_by_name(pl_name):get_meta():set_int("bl_is_shooting", 0)
end
-- se rimane troppo poco tempo, aspetta la fine del match
if arena.current_time <= 6 then return end

View File

@ -66,7 +66,7 @@ function block_league.register_weapon(name, def)
else
groups = {bl_weapon = 1}
end
minetest.register_node(name, {
name = def.name,
groups = groups,
@ -475,9 +475,11 @@ function shoot_loop(weapon, player, pointed_thing)
end
-- interrompo lo sparo, se non è un'arma a fuoco continuo
if not weapon.continuos_fire then return end
minetest.after(0.1, function()
if not arena_lib.is_player_in_arena(p_name, "block_league") then return end
if weapon.continuos_fire and player:get_player_control().LMB and player:get_meta():get_int("bl_is_shooting") == 1 then
if player:get_player_control().LMB and player:get_meta():get_int("bl_is_shooting") == 1 then
shoot_loop(weapon, player, pointed_thing)
else
shoot_end(player, weapon)