Implement showDeathMessages gamerule

This commit is contained in:
teknomunk 2024-06-20 21:04:19 -05:00
parent 7db07612ac
commit cbc0d6d581
2 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,10 @@
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
local ASSIST_TIMEOUT_SEC = 5 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 = { mcl_death_messages = {
assist = {}, assist = {},
@ -204,9 +208,7 @@ local function fallback_translator(s)
end end
mcl_damage.register_on_death(function(obj, reason) mcl_damage.register_on_death(function(obj, reason)
if not minetest.settings:get_bool("mcl_showDeathMessages", true) then if not gamerule_showDeathMessages[1] then return end
return
end
local send_to local send_to

View File

@ -1,4 +1,4 @@
name = mcl_death_messages name = mcl_death_messages
author = 4Evergreen4 author = 4Evergreen4
description = Shows messages in chat when a player dies. description = Shows messages in chat when a player dies.
depends = mcl_colors depends = mcl_colors, vl_tuning