Voice trigger fixes, death acidifier typos (#24941)

* Fixed length check, added attempt event, added popups on failure

* Fixed file name typo, fixed description

* Converted to else-if
This commit is contained in:
Krunklehorn
2024-02-21 01:57:23 -05:00
committed by GitHub
parent cd6370877e
commit f29575f43f
4 changed files with 19 additions and 5 deletions

View File

@@ -32,8 +32,19 @@ namespace Content.Server.Explosion.EntitySystems
if (component.IsRecording)
{
if (message.Length >= component.MinLength || message.Length <= component.MaxLength)
var ev = new ListenAttemptEvent(args.Source);
RaiseLocalEvent(ent, ev);
if (ev.Cancelled)
return;
if (message.Length >= component.MinLength && message.Length <= component.MaxLength)
FinishRecording(ent, args.Source, args.Message);
else if (message.Length > component.MaxLength)
_popupSystem.PopupEntity(Loc.GetString("popup-trigger-voice-record-failed-too-long"), ent);
else if (message.Length < component.MinLength)
_popupSystem.PopupEntity(Loc.GetString("popup-trigger-voice-record-failed-too-short"), ent);
return;
}
@@ -55,7 +66,7 @@ namespace Content.Server.Explosion.EntitySystems
var @event = args;
args.Verbs.Add(new AlternativeVerb()
{
Text = Loc.GetString(component.IsRecording ? "verb-trigger-voice-record-stop" : "verb-trigger-voice-record"),
Text = Loc.GetString(component.IsRecording ? "verb-trigger-voice-stop" : "verb-trigger-voice-record"),
Act = () =>
{
if (component.IsRecording)