From 5d6938b0b442f82d971a679cd4d0c109f154e0a5 Mon Sep 17 00:00:00 2001 From: qasdwer01 Date: Sun, 14 Jul 2024 16:00:36 +0300 Subject: [PATCH] Update nodes.lua Fix spammed messages sent to player when adding an item into treasure chest using Shift+ Item --- mods/ctf/ctf_map/nodes.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mods/ctf/ctf_map/nodes.lua b/mods/ctf/ctf_map/nodes.lua index 6287c8681d..4b123a3f64 100644 --- a/mods/ctf/ctf_map/nodes.lua +++ b/mods/ctf/ctf_map/nodes.lua @@ -205,8 +205,15 @@ local chest_def = { end, allow_metadata_inventory_put = function(pos, listname, index, stack, player) if player then - minetest.chat_send_player(player:get_player_name(), - "You're not allowed to put things in treasure chests!") + local meta = player:get_meta() + local last_time_warned = meta:get_int("last_chest_time_warned") + local current_time = minetest.get_gametime() + + if current_time - last_time_warned > 0.01 then + minetest.chat_send_player(player:get_player_name(), + "You're not allowed to put things in treasure chests!") + meta:set_int("last_chest_time_warned", current_time) + end return 0 end end,