Skip to content

Commit

Permalink
refactor: Fully replace old InfoCustom
Browse files Browse the repository at this point in the history
  • Loading branch information
psyGamer committed Oct 28, 2024
1 parent 68c9073 commit e64358f
Show file tree
Hide file tree
Showing 17 changed files with 271 additions and 783 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ protected override void HandleMessage(MessageID messageId, BinaryReader reader)
object? arg = gameDataType switch {
GameDataType.ConsoleCommand => reader.ReadBoolean(),
GameDataType.SettingValue => reader.ReadString(),
GameDataType.RawInfo => reader.ReadObject<(string, bool)>(),
GameDataType.CommandHash => reader.ReadObject<(string, string[], string, int)>(),
_ => null,
};
Expand Down Expand Up @@ -114,9 +113,6 @@ protected override void HandleMessage(MessageID messageId, BinaryReader reader)
case GameDataType.CustomInfoTemplate:
gameData = !string.IsNullOrWhiteSpace(TasSettings.InfoCustomTemplate) ? TasSettings.InfoCustomTemplate : string.Empty;
break;
case GameDataType.RawInfo:
gameData = InfoCustom.GetRawInfo(((string, bool))arg!);
break;
case GameDataType.GameState:
gameData = GameData.GetGameState();
break;
Expand Down Expand Up @@ -158,10 +154,6 @@ protected override void HandleMessage(MessageID messageId, BinaryReader reader)
writer.Write((string?)gameData ?? string.Empty);
break;

case GameDataType.RawInfo:
writer.WriteObject(gameData);
break;

case GameDataType.GameState:
writer.WriteObject((GameState?)gameData);
break;
Expand Down
551 changes: 0 additions & 551 deletions CelesteTAS-EverestInterop/Source/EverestInterop/InfoHUD/InfoCustom.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public static string GetInfo(string separator = "\n", bool alwaysUpdate = false,
}

private static void PrintAllSimpleValues(Entity entity) {
("Info of Clicked Entity:\n" + GetEntityValues(entity, WatchEntityType.All)).Log(true);
("Info of Clicked Entity:\n" + GetEntityValues(entity, WatchEntityType.All)).Log(string.Empty, true);
}

private static string GetEntityValues(Entity entity, WatchEntityType watchEntityType, string separator = "\n", int decimals = 2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ private class Meta : ITasCommandMeta {
public bool HasArguments => true;
}

private static bool consoleCommandRunning;
internal static bool ConsoleCommandRunning;

private const string CommandName = "EvalLua";
private static readonly Regex commandAndSeparatorRegex = new(@$"^{CommandName}[ |,]+", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly FieldInfo DebugRClogFieldInfo = typeof(Commands).GetFieldInfo("debugRClog");
Expand Down Expand Up @@ -76,7 +77,7 @@ private static string ReadContent(string assetPath) {
}

public static void Log(object message) {
if (consoleCommandRunning) {
if (ConsoleCommandRunning) {
Engine.Commands.Log(message);
}

Expand All @@ -91,9 +92,9 @@ private static void EvalLua(string code) {
code = commandAndSeparatorRegex.Replace(firstHistory, "");
}

consoleCommandRunning = true;
ConsoleCommandRunning = true;
object[] result = EvalLuaImpl(code);
consoleCommandRunning = false;
ConsoleCommandRunning = false;
LogResult(result);
}

Expand Down
Loading

0 comments on commit e64358f

Please sign in to comment.