Skip to content

Conversation

@microlith57
Copy link
Member

:3

@microlith57 microlith57 requested a review from Popax21 September 13, 2025 23:40
@maddie480-bot maddie480-bot added the review needed This PR needs 2 approvals to be merged (bot-managed) label Sep 13, 2025
Copy link
Contributor

@DashingCat DashingCat left a comment

Choose a reason for hiding this comment

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

I agree that adding dialog keys is better than hard-coding text in UIs, and from my testing this PR works as intended, both in English and other languages (which fallback to English text).

However the changes in CriticalErrorHandler.cs could be simpler.
The function PopulateDialog is not needed as Dialog.Get already uses the English language if the dialog keys are not translated in other languages (relevant code below).

public static string Get(string name, Language language = null) {
if (string.IsNullOrEmpty(name))
return "";
name = name.DialogKeyify();
language ??= Dialog.Language;
if (language.Dialog.TryGetValue(name, out string result))
return result;
if (language != FallbackLanguage && FallbackLanguage.Dialog.TryGetValue(name, out result))
return result;
WarnMissingDialogId(name, language);
return "[" + name + "]";
}

I will approve this PR once the changes in CriticalErrorHandler.cs are simplified.

@microlith57 microlith57 force-pushed the critical-error-handler-dialog-keys branch from 0abb711 to 23975ab Compare November 1, 2025 06:52
Copy link
Member

@SnipUndercover SnipUndercover left a comment

Choose a reason for hiding this comment

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

Looks good, I just want to test before approving.

Comment on lines 368 to +369
playerShouldTeabag = CoreModule.Settings.CrashHandlerAlwaysTeabag || (!(Settings.Instance?.DisableFlashes ?? true) && new Random().Next(0, 10) == 0);
isColonThree = CoreModule.Settings.CrashHandlerAlwaysColonThree || new Random().Next(0, 10) == 0;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
playerShouldTeabag = CoreModule.Settings.CrashHandlerAlwaysTeabag || (!(Settings.Instance?.DisableFlashes ?? true) && new Random().Next(0, 10) == 0);
isColonThree = CoreModule.Settings.CrashHandlerAlwaysColonThree || new Random().Next(0, 10) == 0;
Random rng = new();
playerShouldTeabag = CoreModule.Settings.CrashHandlerAlwaysTeabag || (!(Settings.Instance?.DisableFlashes ?? true) && rng.Next(0, 10) == 0);
isColonThree = CoreModule.Settings.CrashHandlerAlwaysColonThree || rng.Next(0, 10) == 0;

}

[Command("criticalerrorhandler", "open the critical error handler screen")]
private static void CmdCriticalErrorHandler() {
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to allow changing the exception message?

Logger.Info("crit-error-handler", $"Created critical error handler for exception {errorType}: {errorMessage}");
}

private void PopulateDialog() {
Copy link
Member

Choose a reason for hiding this comment

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

Probably add a comment that we're doing this to not have to call Dialog.Get multiple times in case something's wrong with the dialog.

@SnipUndercover SnipUndercover self-assigned this Nov 29, 2025
@SnipUndercover
Copy link
Member

Tested locally and it works well. Will approve once the remaining concerns are addressed. May your eyes be blessed with this beauty:
image

@SnipUndercover
Copy link
Member

...i just realized i tested this but completely forgot to approve.

awesome

Though, one more review is necessary anyways so...

@Wartori54
Copy link
Member

Looks good, I'd like Snip's comments to get resolved before approving though.
Also, I hate to say it but, the addition of the colon three "Easter Egg" feels a tad bit unnecessary, especially in the crash handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review needed This PR needs 2 approvals to be merged (bot-managed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants