From 5ba9e91c0dbd2e4e40331aafa51d721e09e31471 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Thu, 20 Jun 2024 21:04:19 -0500 Subject: [PATCH] Implement showDeathMessages gamerule --- mods/HUD/mcl_death_messages/init.lua | 8 +++++--- mods/HUD/mcl_death_messages/mod.conf | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mods/HUD/mcl_death_messages/init.lua b/mods/HUD/mcl_death_messages/init.lua index 82749ca94..b50777cc5 100644 --- a/mods/HUD/mcl_death_messages/init.lua +++ b/mods/HUD/mcl_death_messages/init.lua @@ -1,6 +1,10 @@ local S = minetest.get_translator(minetest.get_current_modname()) local ASSIST_TIMEOUT_SEC = 5 +local gamerule_showDeathMessages = vl_tuning.setting("gamerule:showDeathMessages", "bool", { + description = S("Whether death messages are put into chat when a player dies. Also affects whether a message is sent to the pet's owner when the pet dies."), + default = minetest.settings:get_bool("mcl_showDeathMessages", true), +}) mcl_death_messages = { assist = {}, @@ -204,9 +208,7 @@ local function fallback_translator(s) end mcl_damage.register_on_death(function(obj, reason) - if not minetest.settings:get_bool("mcl_showDeathMessages", true) then - return - end + if not gamerule_showDeathMessages[1] then return end local send_to diff --git a/mods/HUD/mcl_death_messages/mod.conf b/mods/HUD/mcl_death_messages/mod.conf index 5497e9473..7d3bae5e0 100644 --- a/mods/HUD/mcl_death_messages/mod.conf +++ b/mods/HUD/mcl_death_messages/mod.conf @@ -1,4 +1,4 @@ name = mcl_death_messages author = 4Evergreen4 description = Shows messages in chat when a player dies. -depends = mcl_colors, mcl_damage +depends = mcl_colors, mcl_damage, vl_tuning