Skip to content

Commit

Permalink
some tweaks to make tas helper compile
Browse files Browse the repository at this point in the history
  • Loading branch information
LozenChen committed Dec 31, 2024
1 parent d72c66d commit ba04397
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public static class ActualCollideHitbox {
private static readonly Dictionary<Type, Func<Entity, bool>> CollidableHandlers = new();

// Disable actual-collide hitboxes while they aren't used
private static bool Disabled => !TasSettings.ShowHitboxes || TasSettings.ShowActualCollideHitboxes == ActualCollideHitboxType.Off || Manager.FastForwarding;

[PublicAPI]
public static bool Disabled => !TasSettings.ShowHitboxes || TasSettings.ShowActualCollideHitboxes == ActualCollideHitboxType.Off || Manager.FastForwarding;

private static bool playerUpdated;
private static bool colliderListRendering;
Expand Down Expand Up @@ -142,16 +144,17 @@ private static void IL_Player_origUpdate(ILContext il) {
} else {
"Failed to apply patch for storing entity state during Update for actual-collide-hitboxes".Log(LogLevel.Warn);
}
}

static void StoreCollider(Entity? entity) {
// If a PlayerCollider is checked multiple times, only use the first one
if (entity == null || playerUpdated || Disabled) {
return;
}

LastPositions[entity] = entity.Position;
LastCollidables[entity] = entity.IsCollidable();
[PublicAPI]
public static void StoreCollider(Entity? entity) {
// If a PlayerCollider is checked multiple times, only use the first one
if (entity == null || playerUpdated || Disabled) {
return;
}

LastPositions[entity] = entity.Position;
LastCollidables[entity] = entity.IsCollidable();
}

private static void On_Player_Update(On.Celeste.Player.orig_Update orig, Player self) {
Expand Down
6 changes: 6 additions & 0 deletions CelesteTAS-EverestInterop/Source/InfoHUD/InfoWatchEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,17 @@ public UniqueEntityId(Entity entity, EntityData entityData) {
private static AreaKey currentAreaKey;
internal static List<WeakReference> WatchedEntities = [];
internal static List<WeakReference> WatchedEntities_Save = []; // Used for save-states

private static readonly HashSet<UniqueEntityId> WatchedEntityIds = [];

/// Entities which are actively watched for the current frame
internal static readonly HashSet<Entity> CurrentlyWatchedEntities = [];

[PublicAPI]
public static bool IsWatching(Entity entity) {
return CurrentlyWatchedEntities.Contains(entity) || (entity.GetEntityData() is EntityData entityData && WatchedEntityIds.Contains(new UniqueEntityId(entity, entityData)));
}

internal static void CheckMouseButtons() {
if (MouseButtons.Right.Pressed) {
ClearWatchEntities();
Expand Down

0 comments on commit ba04397

Please sign in to comment.