Implement showDeathMessages gamerule

This commit is contained in:
teknomunk 2024-06-20 21:04:19 -05:00
parent 4c0bc279af
commit 882e00b819
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 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

View file

@ -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