Skip to content

Commit 9e6a83f

Browse files
added glitch argument to cassie
1 parent 4e73e22 commit 9e6a83f

File tree

1 file changed

+42
-8
lines changed

1 file changed

+42
-8
lines changed

MethodSystem/Methods/CASSIEMethods/CassieMethod.cs

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
using Respawning;
1+
using System;
2+
using System.Linq;
3+
using Respawning;
24
using SER.ArgumentSystem.Arguments;
35
using SER.ArgumentSystem.BaseArguments;
6+
using SER.Helpers.Extensions;
47
using SER.MethodSystem.BaseMethods;
58

69
namespace SER.MethodSystem.Methods.CASSIEMethods;
@@ -19,6 +22,11 @@ public class CassieMethod : SynchronousMethod
1922
new TextArgument("translation")
2023
{
2124
DefaultValue = "",
25+
},
26+
new BoolArgument("should glitch")
27+
{
28+
Description = "If true, SER will add random glitch effects to the announcement.",
29+
DefaultValue = false,
2230
}
2331
];
2432

@@ -27,12 +35,38 @@ public override void Execute()
2735
var isNoisy = Args.GetOption("mode") == "jingle";
2836
var message = Args.GetText("message");
2937
var translation = Args.GetText("translation");
30-
31-
RespawnEffectsController.PlayCassieAnnouncement(
32-
message,
33-
false,
34-
isNoisy,
35-
!string.IsNullOrWhiteSpace(translation),
36-
translation);
38+
var glitch = Args.GetBool("should glitch");
39+
40+
if (glitch)
41+
{
42+
message = "jam_100_9 " + message
43+
.Split([' '], StringSplitOptions.RemoveEmptyEntries)
44+
.Select(part =>
45+
{
46+
if (UnityEngine.Random.Range(1, 3) == 1) return part;
47+
return $"pitch_{UnityEngine.Random.Range(0.7f, 1.2f)} {part}";
48+
49+
})
50+
.JoinStrings(" ");
51+
}
52+
53+
if (string.IsNullOrEmpty(translation))
54+
{
55+
RespawnEffectsController.PlayCassieAnnouncement(
56+
message,
57+
false,
58+
isNoisy
59+
);
60+
}
61+
else
62+
{
63+
RespawnEffectsController.PlayCassieAnnouncement(
64+
message,
65+
false,
66+
isNoisy,
67+
true,
68+
translation
69+
);
70+
}
3771
}
3872
}

0 commit comments

Comments
 (0)