From a3989a6807ba9e26f2e7de271747b5ec6df09db3 Mon Sep 17 00:00:00 2001 From: ClobberXD Date: Thu, 29 Nov 2018 21:22:43 +0530 Subject: [PATCH] Fix points being for suicide and disable gun damage during buildtime --- mods/ctf_stats/init.lua | 4 ++++ mods/shooter/shooter.lua | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/mods/ctf_stats/init.lua b/mods/ctf_stats/init.lua index 38f828a..a6a7471 100644 --- a/mods/ctf_stats/init.lua +++ b/mods/ctf_stats/init.lua @@ -286,6 +286,10 @@ local function calculateKillReward(victim, killer) end ctf.register_on_killedplayer(function(victim, killer) + -- Suicide is not encouraged here at CTF + if victim == killer then + return + end local main, match = ctf_stats.player(killer) if main and match then local reward = calculateKillReward(victim, killer) diff --git a/mods/shooter/shooter.lua b/mods/shooter/shooter.lua index 264396e..e81671e 100644 --- a/mods/shooter/shooter.lua +++ b/mods/shooter/shooter.lua @@ -42,6 +42,15 @@ if singleplayer then SHOOTER_ALLOW_PLAYERS = false end +if minetest.global_exists("ctf_match") then + ctf_match.register_on_build_time_start(function() + SHOOTER_ALLOW_PLAYERS = false + end) + ctf_match.register_on_build_time_end(function() + SHOOTER_ALLOW_PLAYERS = true + end) +end + local modpath = minetest.get_modpath(minetest.get_current_modname()) local worldpath = minetest.get_worldpath() local input = io.open(modpath.."/shooter.conf", "r")