-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Last Message Before Death Webhook. #30235
base: master
Are you sure you want to change the base?
Last Message Before Death Webhook. #30235
Conversation
Signed-off-by: VelonacepsCalyxEggs <ivankuvaev777@gmail.com>
Signed-off-by: VelonacepsCalyxEggs <ivankuvaev777@gmail.com>
very fun |
- Added conditional compilation for Debugging. - Webhook is no longer exposed to VV. - Now using an ordered dict. - Message is now formatted. - Time is now trunucated. - Now checking for maximum size and splitting the message (2000). - Prevention of a ratelimit if more than 30 messages are sent.
Remove the leftover [ViewVariables] (I am blind). Co-authored-by: Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com>
- All hardcoded variables are now constants. (well not all, all that needed to be) - If the message exceeds the MaxICLength, it will be cut off at a random interval. Example: Someone was giving a speech and got blown to bits. IC: "I am giving a very interesting 1000 character long spee-" - Made sure the messages don't get split in half. - Added a delay between messages.
I have encountered a problem, IGameTiming.CurTime seems to be the time of how long the server has been up, and not the round time. |
GameTicker has it |
Signed-off-by: VelonacepsCalyxEggs <ivankuvaev777@gmail.com>
fixed a place where a constant was not used.
I have only one concern as of now. What if a player says something inapropriate, and gets kicked / banned from the game? Player's message will still stay in the pool. But I didn't really look at any admin code, so... not sure how I would go about implementing that without touching some sacred code. |
When someone is banned or kicked you could just call a method that finds and removes their message from the message list |
Oh, so I suppose there is an event listener for that, that also returns the player's uid when someone is kicked/banned? |
I'm not sure if there's an existing event for those or not, but it should be fairly easy to make an event if it's needed |
So... uhh... I've asked around and looked around, and I don't think there are event listeners for that. |
You can just add them with this if they'll be used by this PR |
I had to add an event listener for bans, it seems to work. But I am not sure I did it properly. Also some minor fixes, like whisper and emote not registering properly. Signed-off-by: VelonacepsCalyxEggs <ivankuvaev777@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't fully reviewed this but well here's enough to keep you busy.
private static LastMessageBeforeDeathSystem? _instance; | ||
private static readonly object _lock = new object(); | ||
|
||
private static readonly Random _random = new Random(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not fixed.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
1 similar comment
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
I'll get back to this soon. Just in case. |
# Conflicts: # Content.Server/Administration/Managers/IBanManager.cs # Content.Shared/CCVar/CCVars.cs Added a webhook related CCVar in Content.Shared/CCVar/CCVars.Discord.cs
Now using mind to get the Character Name to avoid obfuscation. Added all constants as CVars. Webhook CVar is now tracked fully in the LastMessage system. Removed unneeded junk.
I think I did everything specified in the review, but I am not sure about some things, specifically not storing ICommonSession, I need to store it to check whenever the player was banned or kicked during their gameplay, which would disqualify them from getting into the webhook, but, that also could mean that if a player looses connection and reconnects, they would be disqualified too, I need a way to check directly by NetUserId, because it is persistent, I was thinking of checking if there is a mind linked to this NetUserId, but I am not sure what happens to a player's mind when they disconnect. I need some advice on this. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
About the PR
This PR introduces an optional webhook feature that sends the last in-character (IC) messages of dead players before their death at the end of the round.
Why / Balance
This feature is added mainly for fun, I have taken inspiration from a simillar webhook on a SS13 server.
It doesn’t have a specific reason, but could add an amusing element to the game by capturing players’ final words.
Technical details
This is my first PR involving C#. So, if I did anything wrong, I will be glad to learn and improve.
The implementation works as follows:
This feature is only active if the webhook link is specified in server_config.toml.
Media
I know it says After Death on the image... I am dumb.Changelog
🆑 func_kenobi