diff --git a/CelesteTAS-EverestInterop/Source/EverestInterop/Hitboxes/HitboxSimplified.cs b/CelesteTAS-EverestInterop/Source/EverestInterop/Hitboxes/HitboxSimplified.cs index 3c836217..d6de80c9 100644 --- a/CelesteTAS-EverestInterop/Source/EverestInterop/Hitboxes/HitboxSimplified.cs +++ b/CelesteTAS-EverestInterop/Source/EverestInterop/Hitboxes/HitboxSimplified.cs @@ -41,6 +41,7 @@ public static class HitboxSimplified { "Celeste.Mod.JungleHelper.Entities.Firefly", "Celeste.Mod.ClutterHelper.CustomClutter", "Celeste.Mod.HonlyHelper.FloatyBgTile", + "BrokemiaHelper.PixelRendered.Vineinator", }; public static Dictionary Followers = new(); @@ -52,8 +53,14 @@ private static void Initialize() { UselessTypes.Add(type); } } + + HookHelper.SkipMethod(typeof(HitboxSimplified), nameof(IsSimplifiedHitboxes), "DebugRender", + ModUtils.GetType("FemtoHelper", "CustomMoonCreature") + ); } + private static bool IsSimplifiedHitboxes() => TasSettings.ShowHitboxes && TasSettings.SimplifiedHitboxes; + [Load] private static void Load() { IL.Monocle.Entity.DebugRender += ModDebugRender; diff --git a/CelesteTAS-EverestInterop/Source/EverestInterop/SimplifiedGraphicsFeature.cs b/CelesteTAS-EverestInterop/Source/EverestInterop/SimplifiedGraphicsFeature.cs index 63d8ad9e..4f3a4b70 100644 --- a/CelesteTAS-EverestInterop/Source/EverestInterop/SimplifiedGraphicsFeature.cs +++ b/CelesteTAS-EverestInterop/Source/EverestInterop/SimplifiedGraphicsFeature.cs @@ -33,6 +33,10 @@ public static class SimplifiedGraphicsFeature { "4-cliffside/bridge_a", }; + private static readonly List ClutteredTypes = new() { + typeof(FloatingDebris), typeof(MoonCreature), typeof(ResortLantern) + }; + private static bool lastSimplifiedGraphics = TasSettings.SimplifiedGraphics; private static SolidTilesStyle currentSolidTilesStyle; private static bool creatingSolidTiles; @@ -202,19 +206,20 @@ private static void Initialize() { ModUtils.GetType("ContortHelper", "ContortHelper.BetterLightningStrike") ); - HookHelper.SkipMethod(t, nameof(IsSimplifiedClutteredEntity), "Render", typeof(ReflectionTentacles), typeof(SummitCloud), typeof(TempleEye), typeof(Wire), typeof(Cobweb), typeof(HangingLamp), typeof(DustGraphic).GetNestedType("Eyeballs", BindingFlags.NonPublic), ModUtils.GetType("BrokemiaHelper", "BrokemiaHelper.PixelRendered.PixelComponent") ); - HookHelper.SkipMethod(t, nameof(IsSimplifiedClutteredEntity), "DebugRender", - ModUtils.GetType("BrokemiaHelper", "BrokemiaHelper.PixelRendered.PixelComponent") - ); On.Celeste.FloatingDebris.ctor_Vector2 += FloatingDebris_ctor; On.Celeste.MoonCreature.ctor_Vector2 += MoonCreature_ctor; On.Celeste.ResortLantern.ctor_Vector2 += ResortLantern_ctor; + if (ModUtils.GetType("FemtoHelper", "CustomMoonCreature") is { } customMoonCreatureType + && customMoonCreatureType.GetMethodInfo("Added") is { } customMoonCreatureAdded) { + customMoonCreatureAdded.HookAfter(CustomMoonCreatureAdded); + ClutteredTypes.Add(customMoonCreatureType); + } HookHelper.SkipMethod( t, @@ -282,9 +287,11 @@ private static void OnSimplifiedGraphicsChanged(bool simplifiedGraphics) { return; } - if (simplifiedGraphics) { - level.Tracker.GetEntities().ForEach(debris => debris.RemoveSelf()); - level.Entities.FindAll().ForEach(creature => creature.RemoveSelf()); + if (simplifiedGraphics && TasSettings.SimplifiedClutteredEntity) { + IEnumerable clutteredEntities = level.Entities.Where(e => ClutteredTypes.Any(t => e.GetType().IsSameOrSubclassOf(t))); + foreach (Entity entity in clutteredEntities) { + entity.RemoveSelf(); + } } if (simplifiedGraphics && currentSolidTilesStyle != TasSettings.SimplifiedSolidTilesStyle || @@ -559,6 +566,12 @@ private static void ResortLantern_ctor(On.Celeste.ResortLantern.orig_ctor_Vector } } + private static void CustomMoonCreatureAdded(Entity customMoonCreature) { + if (IsSimplifiedClutteredEntity()) { + customMoonCreature.Add(new RemoveSelfComponent()); + } + } + private static void LightningRenderer_RenderIL(ILContext il) { ILCursor c = new(il); if (c.TryGotoNext(i => i.MatchLdfld("Visible"))) { diff --git a/CelesteTAS-EverestInterop/Source/Utils/Extensions.cs b/CelesteTAS-EverestInterop/Source/Utils/Extensions.cs index 4828837a..73e6a837 100644 --- a/CelesteTAS-EverestInterop/Source/Utils/Extensions.cs +++ b/CelesteTAS-EverestInterop/Source/Utils/Extensions.cs @@ -364,7 +364,7 @@ public static long GetCustomHashCode(this IEnumerable enumerable) { internal static class TypeExtensions { public static bool IsSameOrSubclassOf(this Type potentialDescendant, Type potentialBase) { - return potentialDescendant.IsSubclassOf(potentialBase) || potentialDescendant == potentialBase; + return potentialDescendant == potentialBase || potentialDescendant.IsSubclassOf(potentialBase); } public static bool IsSameOrSubclassOf(this Type potentialDescendant, params Type[] potentialBases) {