Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix treasure chest chat spam #1327

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

qasdwer01
Copy link
Contributor

@qasdwer01 qasdwer01 commented Jul 14, 2024

Fix spammed messages sent to player when adding an item into treasure chest using Shift+ Item

  • This PR has been tested locally

Fix spammed messages sent to player when adding an item into treasure chest using Shift+ Item
@farooqkz
Copy link
Contributor

Hello. Thanks for your interest in contributing to CTF. Please update the PR title with a better more descriptive name. Also I am in favor of removing this message from chat and sending as HUD event message, instead. @LoneWolfHT Opinion(s)?

@LoneWolfHT
Copy link
Member

hud messages would be hidden by the formspec, the chat gives you a better chance of seeing what went wrong.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The timer doesn't need to be chest-specific, so for speed's sake instead of storing the current time in meta I would store it in a local table indexed by playername, when a player leaves their entry is removed.

@LoneWolfHT
Copy link
Member

Are you still interested in finishing this PR or do you want someone to take it over?

@LoneWolfHT
Copy link
Member

Got answer via Discord, this PR is up for adoption

@LoneWolfHT LoneWolfHT added Trivial Needs Adoption Looking for someone to take over the PR labels Dec 6, 2024
@LoneWolfHT LoneWolfHT changed the title Update nodes.lua Fix treasure chest chat spam Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug / Bugfix ⚙️ Chat Needs Adoption Looking for someone to take over the PR Trivial
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants