Skip to content

Commit 4d1efed

Browse files
committed
auto watch now shows CS name
dash code add aurorasHelper's flag version support stunHelper hazards
1 parent 00ab66a commit 4d1efed

8 files changed

+73
-7
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ This mod is based on [CelesteTAS](https://github.com/EverestAPI/CelesteTAS-Evere
6262

6363
Here lists some ideas, which I may not work on recently. Feel free if you like that idea and want to implement that in your mod (tell me when you've implemented it so i needn't work on them).
6464

65-
- SpeedrunTool multi-saveslots PR (Update2: plan to put effort on this some time later)(Update: done, PR is created but never gets merged)
65+
- SpeedrunTool multi-saveslots PR (Update2: plan to put effort on this some time later)(Update: done, PR is created but never gets merged)
66+
67+
- CollabPartialLoader: when loading a single map of a collab, only need to load necessary dependencies instead of all dependencies of the collab.
6668

6769
- Predictor combined with Brute Forcer: previous brute forcers simulate game logic so can be wrong if there are some complex mod logics, so in our way it should be better? (but also slower for sure)
6870

Source/Gameplay/AutoWatchEntity/Entity/CutsceneEntity.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public CutsceneEntityRenderer(RenderMode mode) : base(mode, active: true) { }
1818

1919
public bool waitingForCoroutine = true;
2020

21+
public string name;
22+
2123
public static Vector2 offset = Vector2.UnitY * 12f; // make sure this is different to that of player
2224

2325
private static bool IsCutscene(IEnumerator func) {
@@ -26,9 +28,12 @@ private static bool IsCutscene(IEnumerator func) {
2628

2729
public static bool useFallBack = true;
2830

31+
public static bool useCSTypeName = true;
32+
2933
public override void Added(Entity entity) {
3034
base.Added(entity);
3135
cs = entity as CutsceneEntity;
36+
name = useCSTypeName ? cs.GetType().Name : "Cutscene";
3237
text.justify = new Vector2(0.5f, 0f);
3338
bool found = false;
3439
foreach (Component c in cs.Components) {
@@ -117,7 +122,7 @@ public override void UpdateImpl() {
117122
wasWaiting = flag;
118123

119124
if (text.content != "") {
120-
text.AppendAtFirst("Cutscene", "Cutscene");
125+
text.AppendAtFirst(name, name);
121126
}
122127

123128
SetVisible();

Source/Gameplay/AutoWatchEntity/HelperClasses.cs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ public static string ToCode(int angle, int offset) {
214214
return DashCodes[num];
215215
}
216216

217-
public static class AurorasHashedDashCode {
217+
public static class AurorasDashCode {
218218

219-
public static int AcceptableLengthUpperBound = 8;
219+
public static int AcceptableLengthUpperBound = 9;
220220

221221
private static readonly Dictionary<string, string> results = new Dictionary<string, string>();
222222

@@ -278,6 +278,28 @@ private static string CastToDashCode(uint num, int length) {
278278
}
279279
return string.Join(",", list);
280280
}
281+
282+
private static readonly string[] flagDashCode = ["U", "UR", "R", "DR", "D", "DL", "L", "UL"];
283+
public static string DashCodeFlagGetCurrentCode(string baseFlag, int length, Level level, out bool success) {
284+
List<string> list = new List<string>();
285+
Session session = level.Session;
286+
for (int i = 1; i <= length; i++) {
287+
bool flag = true;
288+
foreach (string text in flagDashCode) {
289+
if (session.GetFlag(baseFlag + "_" + i + "_" + text)) {
290+
list.Add(text);
291+
flag = false;
292+
break;
293+
}
294+
}
295+
if (flag) {
296+
success = false;
297+
return $"NeedFlag: {baseFlag}_{i}_[dir]";
298+
}
299+
}
300+
success = true;
301+
return string.Join(",", list);
302+
}
281303
}
282304

283305
}

Source/Gameplay/AutoWatchEntity/Trigger/AbstractTriggerRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public override void DebugRenderImpl() {
209209
if (hitbox is not null) {
210210
Draw.Rect(hitbox.AbsoluteX, hitbox.AbsoluteY, hitbox.Width, hitbox.Height, innerRegion);
211211
}
212-
Draw.HollowRect(nearPlayerDetector.AbsoluteX, nearPlayerDetector.AbsoluteY, nearPlayerDetector.Width, nearPlayerDetector.Height, Color.Pink);
212+
// Draw.HollowRect(nearPlayerDetector.AbsoluteX, nearPlayerDetector.AbsoluteY, nearPlayerDetector.Width, nearPlayerDetector.Height, Color.Pink);
213213
}
214214

215215
public void SetVerticallyClampedCenter() {

Source/Gameplay/AutoWatchEntity/Trigger/TriggerDynamicInfoGetter.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,29 @@ public static void HandleAurorasHelper() {
140140
}
141141
});
142142
}
143+
144+
if (ModUtils.GetType("AurorasHelper", "Celeste.Mod.AurorasHelper.DashcodeFlagTrigger") is { } dashCodeTrigger) {
145+
Add(dashCodeTrigger, (trigger, level) => {
146+
string flag = trigger.GetFieldValue<string>("flag");
147+
bool flagState = trigger.GetFieldValue<bool>("flag_state");
148+
if (level.Session.GetFlag(flag) == flagState) {
149+
return $"{(flagState ? "Added: " : "Removed: ")}{flag}";
150+
}
151+
string baseFlag = trigger.GetFieldValue<string>("baseFlag");
152+
int codeLength = trigger.GetFieldValue<int>("codeLength");
153+
string dashCode = DashCode.AurorasDashCode.DashCodeFlagGetCurrentCode(baseFlag, codeLength, level, out bool success);
154+
if (!success) {
155+
return dashCode;
156+
}
157+
158+
List<string> currentInputs = trigger.GetFieldValue<List<string>>("currentInputs");
159+
if (flagState) {
160+
return $"DashCode: {dashCode}\nCurrent: {string.Join(",", currentInputs.Select(DashCode.ToCode))}\nAdd: {flag}";
161+
}
162+
else {
163+
return $"DashCode: {dashCode}\nCurrent: {string.Join(",", currentInputs.Select(DashCode.ToCode))}\nRemove: {flag}";
164+
}
165+
});
166+
}
143167
}
144168
}

Source/Gameplay/AutoWatchEntity/Trigger/TriggerStaticInfoGetter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public static void HandleAurorasHelper() {
299299
Add(hashedDashCode, (trigger, _) => {
300300
string hashedCode = trigger.GetFieldValue<string>("hashedCode");
301301
int length = trigger.GetFieldValue<int>("codeLength");
302-
if (DashCode.AurorasHashedDashCode.TryGetInputs(hashedCode, length, out string inputs)) {
302+
if (DashCode.AurorasDashCode.TryGetInputs(hashedCode, length, out string inputs)) {
303303
return "DashCode: " + inputs;
304304
}
305305
return "";

Source/Gameplay/HKNailDebugRender.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
namespace Celeste.Mod.TASHelper.Gameplay;
77
internal static class HKNailDebugRender {
8-
8+
9+
// Kepler mod also has hk nail, but it has a good DebugRender
910
[Initialize]
1011
private static void Initialize() {
1112
prepared = true;

Source/Gameplay/Spinner/SpinnerCalculateHelper.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,18 @@ public static void Initialize() {
203203
if (ModUtils.GetType("Glyph", "Celeste.Mod.AcidHelper.Entities.AcidLightning") is { } acidLightningType) {
204204
HazardTypesTreatNormal.Add(acidLightningType, lightning);
205205
OffsetGetters.Add(acidLightningType, OffsetGetters[vanillaLightningType]);
206+
}
207+
208+
if (ModUtils.GetType("StunningHelper", "Celeste.Mod.StunningHelper.CustomOffsetSpinner") is { } stunSpinnerType) {
209+
DictionaryAdderVanilla(stunSpinnerType, e => (e as CrystalStaticSpinner)!.offset, spinner);
210+
}
211+
212+
if (ModUtils.GetType("StunningHelper", "Celeste.Mod.StunningHelper.CustomOffsetLightning") is { } stunLightningType) {
213+
DictionaryAdderVanilla(stunLightningType, e => (e as Lightning)!.toggleOffset, lightning);
214+
}
215+
216+
if (ModUtils.GetType("StunningHelper", "Celeste.Mod.StunningHelper.CustomOffsetDustBunny") is { } stunDustType) {
217+
DictionaryAdderVanilla(stunDustType, e => (e as DustStaticSpinner)!.offset, dust);
206218
}
207219

208220
//if (ModUtils.GetType("Scuffed Helper", "ScuffedHelperCode.RandomSpinner") is { } randomSpinnerType) {

0 commit comments

Comments
 (0)