From 3422b6ed22af83a96ca99d129b6ae9580f7ca8c5 Mon Sep 17 00:00:00 2001 From: Samah Date: Sun, 22 Dec 2024 16:41:42 +1030 Subject: [PATCH 1/5] Add support for ceiling boosters with Gravity Helper --- Code/Entities/FloorBooster.cs | 49 ++++++++++++++++++++------- Code/Misc/GravityHelperInterop.cs | 15 +++++++++ Code/VortexHelperModule.cs | 3 ++ Loenn/entities/floor_booster.lua | 56 +++++++++++++++++++++++++------ Loenn/lang/en_gb.lang | 5 ++- 5 files changed, 104 insertions(+), 24 deletions(-) create mode 100644 Code/Misc/GravityHelperInterop.cs diff --git a/Code/Entities/FloorBooster.cs b/Code/Entities/FloorBooster.cs index 4938a40..5d4babf 100644 --- a/Code/Entities/FloorBooster.cs +++ b/Code/Entities/FloorBooster.cs @@ -32,6 +32,7 @@ private enum DisableMode public bool IceMode; public bool NoRefillsOnIce; + public bool Ceiling; private DisableMode disableMode; @@ -41,9 +42,12 @@ private enum DisableMode public int MoveSpeed; public FloorBooster(EntityData data, Vector2 offset) - : this(data.Position + offset, data.Width, data.Bool("left"), data.Int("speed"), data.Bool("iceMode"), data.Bool("noRefillOnIce"), data.Bool("notAttached")) { } + : this(data.Position + offset, data.Width, data.Bool("left"), data.Int("speed"), data.Bool("iceMode"), data.Bool("noRefillOnIce"), data.Bool("notAttached"), data.Bool("ceiling")) { } public FloorBooster(Vector2 position, int width, bool left, int speed, bool iceMode, bool noRefillOnIce, bool notAttached) + : this(position, width, left, speed, iceMode, noRefillOnIce, notAttached, false) { } + + public FloorBooster(Vector2 position, int width, bool left, int speed, bool iceMode, bool noRefillOnIce, bool notAttached, bool ceiling) : base(position) { this.Tag = Tags.TransitionUpdate; @@ -54,8 +58,9 @@ public FloorBooster(Vector2 position, int width, bool left, int speed, bool iceM this.IceMode = iceMode; this.MoveSpeed = (int) Calc.Max(0, speed); this.Facing = left ? Facings.Left : Facings.Right; + this.Ceiling = ceiling; - this.Collider = new Hitbox(width, 3, 0, 5); + this.Collider = new Hitbox(width, 3, 0, ceiling ? 0 : 5); if (!this.notCoreMode) Add(new CoreModeListener(OnChangeMode)); @@ -74,7 +79,7 @@ public FloorBooster(Vector2 position, int width, bool left, int speed, bool iceM }); } - this.tiles = BuildSprite(left); + this.tiles = BuildSprite(left, ceiling); } public void SetColor(Color color) @@ -109,7 +114,7 @@ private void OnDisable() this.Visible = false; } - private List BuildSprite(bool left) + private List BuildSprite(bool left, bool ceiling) { var list = new List(); for (int i = 0; i < this.Width; i += 8) @@ -128,6 +133,8 @@ private List BuildSprite(bool left) Sprite sprite = VortexHelperModule.FloorBoosterSpriteBank.Create("FloorBooster" + id); if (!left) sprite.FlipX = true; + if (ceiling) + sprite.FlipY = true; sprite.Position = new Vector2(i, 0); list.Add(sprite); @@ -151,11 +158,11 @@ private void OnChangeMode(Session.CoreModes mode) this.idleSfx.Play(SFX.env_loc_09_conveyer_idle); } - private bool IsRiding(JumpThru jumpThru) => CollideCheckOutside(jumpThru, this.Position + Vector2.UnitY); + private bool IsRiding(JumpThru jumpThru) => CollideCheckOutside(jumpThru, this.Position + (this.Ceiling ? -Vector2.UnitY : Vector2.UnitY)); private bool IsRiding(Solid solid) { - if (CollideCheckOutside(solid, this.Position + Vector2.UnitY)) + if (CollideCheckOutside(solid, this.Position + (this.Ceiling ? -Vector2.UnitY : Vector2.UnitY))) { this.disableMode = (solid is CassetteBlock or SwitchBlock) ? DisableMode.ColorFade : DisableMode.Disappear; return true; @@ -192,8 +199,10 @@ public override void Update() bool isUsed = false; base.Update(); - if (player is not null && CollideCheck(player) && player.OnGround() && player.Bottom <= this.Bottom) - isUsed = true; + var matchGravity = this.Ceiling == GravityHelperInterop.IsPlayerInverted(); + + if (matchGravity && player is not null && CollideCheck(player) && player.OnGround()) + isUsed = this.Ceiling ? player.Top >= this.Top : player.Bottom <= this.Bottom; PlayActivateSfx(this.IceMode || !isUsed); } @@ -224,7 +233,7 @@ private void PositionSfx(Player entity) return; this.idleSfx.Position = Calc.ClosestPointOnLine(this.Position, this.Position + new Vector2(this.Width, 0f), entity.Center) - this.Position; - this.idleSfx.Position.Y += 7; + if (!this.Ceiling) this.idleSfx.Position.Y += 7; this.activateSfx.Position = this.idleSfx.Position; this.idleSfx.UpdateSfxPosition(); this.activateSfx.UpdateSfxPosition(); } @@ -258,13 +267,18 @@ private static bool Player_RefillDash(On.Celeste.Player.orig_RefillDash orig, Pl if (level.Transitioning) return orig(self); + var playerInverted = GravityHelperInterop.IsPlayerInverted(); + foreach (FloorBooster entity in self.Scene.Tracker.GetEntities()) { if (!entity.IceMode) continue; + if (entity.Ceiling != playerInverted) + continue; + if (self.CollideCheck(entity) && self.OnGround() - && self.Bottom <= entity.Bottom + && (entity.Ceiling ? self.Top >= entity.Top : self.Bottom <= entity.Bottom) && entity.NoRefillsOnIce) return false; } @@ -289,8 +303,9 @@ private static int Player_NormalUpdate(On.Celeste.Player.orig_NormalUpdate orig, playerData.Set("lastFloorBooster", null); FloorBooster lastFloorBooster = playerData.Get("lastFloorBooster"); + var playerInverted = GravityHelperInterop.IsPlayerInverted(); - if (lastFloorBooster is not null && !self.CollideCheck(lastFloorBooster)) + if (lastFloorBooster is not null && (lastFloorBooster.Ceiling != playerInverted || !self.CollideCheck(lastFloorBooster))) { Vector2 vec = Vector2.UnitX * playerData.Get("floorBoosterSpeed") @@ -310,8 +325,11 @@ private static int Player_NormalUpdate(On.Celeste.Player.orig_NormalUpdate orig, { if (entity.IceMode) continue; + + if (entity.Ceiling != playerInverted) + continue; - if (self.CollideCheck(entity) && self.OnGround() && self.StateMachine != Player.StClimb && self.Bottom <= entity.Bottom) + if (self.CollideCheck(entity) && self.OnGround() && self.StateMachine != Player.StClimb && (entity.Ceiling ? self.Top >= entity.Top : self.Bottom <= entity.Bottom)) { if (!touchedFloorBooster) { @@ -349,14 +367,19 @@ private static float GetPlayerFriction() { if (!Util.TryGetPlayer(out Player player)) return 1.0f; + + var playerInverted = GravityHelperInterop.IsPlayerInverted(); foreach (FloorBooster entity in player.Scene.Tracker.GetEntities()) { if (!entity.IceMode) continue; + + if (entity.Ceiling != playerInverted) + continue; if (player.CollideCheck(entity) && player.OnGround() && player.StateMachine != Player.StClimb - && player.Bottom <= entity.Bottom) + && (entity.Ceiling ? player.Top >= entity.Top : player.Bottom <= entity.Bottom)) return player.SceneAs().CoreMode is Session.CoreModes.Cold ? 0.4f : 0.2f; } diff --git a/Code/Misc/GravityHelperInterop.cs b/Code/Misc/GravityHelperInterop.cs new file mode 100644 index 0000000..91d6b83 --- /dev/null +++ b/Code/Misc/GravityHelperInterop.cs @@ -0,0 +1,15 @@ +using MonoMod.ModInterop; +using System; + +namespace Celeste.Mod.VortexHelper.Misc; + +internal static class GravityHelperInterop +{ + [ModImportName("GravityHelper")] + internal static class Imports + { + public static Func IsPlayerInverted; + } + + public static bool IsPlayerInverted() => Imports.IsPlayerInverted?.Invoke() ?? false; +} \ No newline at end of file diff --git a/Code/VortexHelperModule.cs b/Code/VortexHelperModule.cs index 22c14e3..c5fd84d 100644 --- a/Code/VortexHelperModule.cs +++ b/Code/VortexHelperModule.cs @@ -2,6 +2,7 @@ using Celeste.Mod.VortexHelper.Misc; using Microsoft.Xna.Framework; using Monocle; +using MonoMod.ModInterop; using System; using System.Reflection; @@ -69,6 +70,8 @@ public override void Load() MiscHooks.Hook(); Util.LoadDelegates(); + + typeof(GravityHelperInterop.Imports).ModInterop(); } public override void Unload() diff --git a/Loenn/entities/floor_booster.lua b/Loenn/entities/floor_booster.lua index d9f41f9..aadafa7 100644 --- a/Loenn/entities/floor_booster.lua +++ b/Loenn/entities/floor_booster.lua @@ -20,6 +20,7 @@ floorBooster.placements = { data = { width = 8, left = false, + ceiling = false, iceMode = false, speed = 110, noRefillOnIce = true, @@ -32,6 +33,33 @@ floorBooster.placements = { data = { width = 8, left = true, + ceiling = false, + iceMode = false, + speed = 110, + noRefillOnIce = true, + notAttached = false + } + }, + { + name = "right_ceiling", + placementType = "rectangle", + data = { + width = 8, + left = false, + ceiling = true, + iceMode = false, + speed = 110, + noRefillOnIce = true, + notAttached = false + } + }, + { + name = "left_ceiling", + placementType = "rectangle", + data = { + width = 8, + left = true, + ceiling = true, iceMode = false, speed = 110, noRefillOnIce = true, @@ -60,9 +88,11 @@ function floorBooster.sprite(room, entity) local sprites = {} local left = entity.left + local ceiling = entity.ceiling ~= nil and entity.ceiling local width = entity.width or 8 local tileWidth = math.floor(width / 8) - local scale = left and 1 or -1 + local xScale = left and 1 or -1 + local yScale = ceiling and -1 or 1 local offset = left and 0 or 8 local leftTexture, middleTexture, rightTexture = getTextures(entity) @@ -73,9 +103,9 @@ function floorBooster.sprite(room, entity) for i = 2, tileWidth - 1 do local middleSprite = drawableSprite.fromTexture(middleTexture, entity) - middleSprite:addPosition((i - 1) * 8 + offset, 0) - middleSprite:setScale(scale, 1) - middleSprite:setJustification(0.0, 0.0) + middleSprite:addPosition((i - 1) * 8 + offset, 4) + middleSprite:setScale(xScale, yScale) + middleSprite:setJustification(0.0, 0.5) table.insert(sprites, middleSprite) end @@ -83,13 +113,13 @@ function floorBooster.sprite(room, entity) local leftSprite = drawableSprite.fromTexture(leftTexture, entity) local rightSprite = drawableSprite.fromTexture(rightTexture, entity) - leftSprite:addPosition(offset, 0) - leftSprite:setScale(scale, 1) - leftSprite:setJustification(0.0, 0.0) + leftSprite:addPosition(offset, 4) + leftSprite:setScale(xScale, yScale) + leftSprite:setJustification(0.0, 0.5) - rightSprite:addPosition((tileWidth - 1) * 8 + offset, 0) - rightSprite:setScale(scale, 1) - rightSprite:setJustification(0.0, 0.0) + rightSprite:addPosition((tileWidth - 1) * 8 + offset, 4) + rightSprite:setScale(xScale, yScale) + rightSprite:setJustification(0.0, 0.5) table.insert(sprites, leftSprite) table.insert(sprites, rightSprite) @@ -101,4 +131,10 @@ function floorBooster.rectangle(room, entity) return utils.rectangle(entity.x, entity.y, entity.width or 8, 8) end +function floorBooster.flip(room, entity, horizontal, vertical) + if vertical then entity.ceiling = not entity.ceiling end + if horizontal then entity.left = not entity.left end + return true +end + return floorBooster diff --git a/Loenn/lang/en_gb.lang b/Loenn/lang/en_gb.lang index cd6422f..8466e0e 100644 --- a/Loenn/lang/en_gb.lang +++ b/Loenn/lang/en_gb.lang @@ -50,10 +50,13 @@ entities.VortexHelper/DashBubble.attributes.description.spiked=Adds spikes to th entities.VortexHelper/DashBubble.attributes.description.singleUse=Makes this bubble usable only once. entities.VortexHelper/DashBubble.attributes.description.wobble=Allows this bubble to wobble around its position, and to react to the player bouncing on it. -# Floor Booster +# Floor/Ceiling Booster entities.VortexHelper/FloorBooster.placements.name.right=Floor Booster (Right) entities.VortexHelper/FloorBooster.placements.name.left=Floor Booster (Left) +entities.VortexHelper/FloorBooster.placements.name.right_ceiling=Ceiling Booster (Right) +entities.VortexHelper/FloorBooster.placements.name.left_ceiling=Ceiling Booster (Left) entities.VortexHelper/FloorBooster.attributes.description.left=Makes this Floor Booster push towards the left. +entities.VortexHelper/FloorBooster.attributes.description.ceiling=Whether the Floor Booster should attach to the ceiling. Only applies to Gravity Helper. entities.VortexHelper/FloorBooster.attributes.description.iceMode=Whether the Floor Booster should ignore the current Core mode and default to ice variant. entities.VortexHelper/FloorBooster.attributes.description.speed=The speed of this Floor Booster. entities.VortexHelper/FloorBooster.attributes.description.noRefillOnIce=Whether the ice variant should prevent dash refills when stood on. From 8dad60ccbd704246e4ef7747d89cd4eaa392cd09 Mon Sep 17 00:00:00 2001 From: Samah Date: Sun, 22 Dec 2024 17:44:50 +1030 Subject: [PATCH 2/5] Fix puffer offset and floor booster field order --- Loenn/entities/bowl_puffer.lua | 2 +- Loenn/entities/floor_booster.lua | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Loenn/entities/bowl_puffer.lua b/Loenn/entities/bowl_puffer.lua index 226d2cc..6d30087 100644 --- a/Loenn/entities/bowl_puffer.lua +++ b/Loenn/entities/bowl_puffer.lua @@ -29,7 +29,7 @@ bowlPuffer.placements = { } bowlPuffer.texture = "objects/VortexHelper/pufferBowl/idle00" -bowlPuffer.offset = {32, 35} +bowlPuffer.offset = {0, 3} function bowlPuffer.selection(room, entity) return utils.rectangle((entity.x or 0) - 11, (entity.y or 0) - 11, 21, 19) diff --git a/Loenn/entities/floor_booster.lua b/Loenn/entities/floor_booster.lua index aadafa7..a860883 100644 --- a/Loenn/entities/floor_booster.lua +++ b/Loenn/entities/floor_booster.lua @@ -13,6 +13,13 @@ floorBooster.fieldInformation = { } } +floorBooster.fieldOrder = { + "x", "y", + "width", "speed", + "iceMode", "left", "noRefillOnIce", "notAttached", + "ceiling" +} + floorBooster.placements = { { name = "right", @@ -134,7 +141,7 @@ end function floorBooster.flip(room, entity, horizontal, vertical) if vertical then entity.ceiling = not entity.ceiling end if horizontal then entity.left = not entity.left end - return true + return vertical or horizontal end return floorBooster From 9f5af235d25f196f0d8abe3b8a098def4367793a Mon Sep 17 00:00:00 2001 From: Samah Date: Tue, 24 Dec 2024 13:04:49 +1030 Subject: [PATCH 3/5] Fix puffer bowl visuals when inverted --- Code/Entities/BowlPuffer.cs | 28 +++++++++++++++++++++++++++- Code/Misc/GravityHelperInterop.cs | 2 ++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Code/Entities/BowlPuffer.cs b/Code/Entities/BowlPuffer.cs index 7709752..eb6422d 100644 --- a/Code/Entities/BowlPuffer.cs +++ b/Code/Entities/BowlPuffer.cs @@ -1,4 +1,5 @@ using Celeste.Mod.Entities; +using Celeste.Mod.VortexHelper.Misc; using Microsoft.Xna.Framework; using Monocle; using System; @@ -341,7 +342,7 @@ private void OnRelease(Vector2 force) #endregion - #region Explosiong + #region Explosion private void Explode(bool playsound = true) { @@ -764,6 +765,21 @@ public override void Render() { this.puffer.Scale = this.scale * (1f + this.inflateWiggler.Value * 0.4f); this.puffer.FlipX = false; + + // gravity helper forces a scale change on the default Sprite + if (Get() is { } sprite) sprite.Scale.Y = Math.Abs(sprite.Scale.Y); + + // invert sprites if required + var inverted = GravityHelperInterop.IsActorInverted(this); + if (inverted) + { + this.puffer.Y *= -1; + this.pufferBowlTop.Y *= -1; + this.pufferBowlBottom.Y *= -1; + this.pufferBowlTop.Scale.Y *= -1; + this.pufferBowlBottom.Scale.Y *= -1; + this.puffer.Scale.Y *= -1; + } Vector2 position = this.Position; this.Position.Y -= 6.0f; @@ -792,6 +808,16 @@ public override void Render() Draw.Point(p, Color.Lerp(Color.OrangeRed, Color.LawnGreen, a / (float) Math.PI)); } } + + if (inverted) + { + this.puffer.Y *= -1; + this.pufferBowlTop.Y *= -1; + this.pufferBowlBottom.Y *= -1; + this.pufferBowlTop.Scale.Y *= -1; + this.pufferBowlBottom.Scale.Y *= -1; + this.puffer.Scale.Y *= -1; + } } public static void InitializeParticles() diff --git a/Code/Misc/GravityHelperInterop.cs b/Code/Misc/GravityHelperInterop.cs index 91d6b83..1e5b693 100644 --- a/Code/Misc/GravityHelperInterop.cs +++ b/Code/Misc/GravityHelperInterop.cs @@ -9,7 +9,9 @@ internal static class GravityHelperInterop internal static class Imports { public static Func IsPlayerInverted; + public static Func IsActorInverted; } public static bool IsPlayerInverted() => Imports.IsPlayerInverted?.Invoke() ?? false; + public static bool IsActorInverted(Actor actor) => Imports.IsActorInverted?.Invoke(actor) ?? false; } \ No newline at end of file From ddc2f38e86ce8bc37a5143c8f0f0886d01118bad Mon Sep 17 00:00:00 2001 From: Samah Date: Sun, 29 Dec 2024 11:14:41 +1030 Subject: [PATCH 4/5] Add Gravity Helper support for purple and lavender boosters --- Code/Entities/PurpleBooster.cs | 27 +++++++++++++++++++++------ Code/Misc/GravityHelperInterop.cs | 8 +++++++- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/Code/Entities/PurpleBooster.cs b/Code/Entities/PurpleBooster.cs index 24f0e9d..eb9b39e 100644 --- a/Code/Entities/PurpleBooster.cs +++ b/Code/Entities/PurpleBooster.cs @@ -254,6 +254,8 @@ public override void Update() { base.Update(); + var inverted = GravityHelperInterop.IsPlayerInverted(); + this.actualLinkPercent = Calc.Approach(this.actualLinkPercent, this.linkPercent, 5f * Engine.DeltaTime); if (this.cannotUseTimer > 0f) @@ -271,7 +273,10 @@ public override void Update() Vector2 target = Vector2.Zero; Player entity = this.Scene.Tracker.GetEntity(); if (entity is not null && CollideCheck(entity)) - target = entity.Center + Booster.playerOffset - this.Position; + { + var playerOffset = new Vector2(Booster.playerOffset.X, inverted ? -Booster.playerOffset.Y : Booster.playerOffset.Y); + target = entity.Center + playerOffset - this.Position; + } this.sprite.Position = Calc.Approach(this.sprite.Position, target, 80f * Engine.DeltaTime); } @@ -377,8 +382,10 @@ public static int PurpleBoostUpdate(Player player) Vector2 value = Input.Aim.Value * 3f; Vector2 vector = Calc.Approach(player.ExactPosition, boostTarget - player.Collider.Center + value, 80f * Engine.DeltaTime); + GravityHelperInterop.BeginOverride(); player.MoveToX(vector.X, null); player.MoveToY(vector.Y, null); + GravityHelperInterop.EndOverride(); if (Vector2.DistanceSquared(player.Center, boostTarget) >= 275f) { @@ -403,9 +410,11 @@ public static int PurpleBoostUpdate(Player player) public static void PurpleBoostEnd(Player player) { + GravityHelperInterop.BeginOverride(); Vector2 vector = (player.boostTarget - player.Collider.Center).Floor(); player.MoveToX(vector.X, null); player.MoveToY(vector.Y, null); + GravityHelperInterop.EndOverride(); } public static IEnumerator PurpleBoostCoroutine(Player player) @@ -414,12 +423,12 @@ public static IEnumerator PurpleBoostCoroutine(Player player) player.StateMachine.State = VortexHelperModule.PurpleBoosterDashState; } - // Arc Motion + // Arc Motion public static void PurpleDashingBegin(Player player) { Celeste.Freeze(0.05f); // this freeze makes fastbubbling much more lenient DynamicData playerData = DynamicData.For(player); - player.DashDir = Input.GetAimVector(player.Facing); + player.DashDir = GravityHelperInterop.InvertIfRequired(Input.GetAimVector(player.Facing)); playerData.Set(POSSIBLE_EARLY_DASHSPEED, Vector2.Zero); foreach (PurpleBooster b in player.Scene.Tracker.GetEntities()) @@ -469,14 +478,15 @@ public static IEnumerator PurpleDashingCoroutine(Player player) Vector2 origin = player.boostTarget; if(VortexHelperModule.SessionProperties.BoosterQoL) { yield return null; - player.DashDir = player.lastAim; + player.DashDir = GravityHelperInterop.InvertIfRequired(player.lastAim); } Vector2 earlyExitBoost = Vector2.Zero; while (t < 1f) { t = Calc.Approach(t, 1.0f, Engine.DeltaTime * 1.5f); - Vector2 vec = origin + Vector2.UnitY * 6f + player.DashDir * 60f * (float) Math.Sin(t * Math.PI); + float offset = GravityHelperInterop.IsPlayerInverted() ? -6f : 6f; + Vector2 vec = origin + Vector2.UnitY * offset + player.DashDir * 60f * (float) Math.Sin(t * Math.PI); if(VortexHelperModule.SessionProperties.BoosterQoL) { @@ -484,7 +494,8 @@ public static IEnumerator PurpleDashingCoroutine(Player player) { // frame 0: mimics speed at launch exit exactly, Input.MoveX.Value == -Math.Sign(player.DashDir) ? 300 : 250 earlyExitBoost = 250f * -player.DashDir; - Vector2 aim = Input.GetAimVector(player.Facing).EightWayNormal().Sign(); + Vector2 aim = GravityHelperInterop.InvertIfRequired(Input.GetAimVector(player.Facing)); + aim = aim.EightWayNormal().Sign(); if (aim.X == Math.Sign(earlyExitBoost.X)) earlyExitBoost.X *= 1.2f; if (aim.Y == Math.Sign(earlyExitBoost.Y)) earlyExitBoost.Y *= 1.2f; } else if(t > 0.93f) @@ -505,7 +516,9 @@ public static IEnumerator PurpleDashingCoroutine(Player player) player.StateMachine.State = Player.StNormal; yield break; } + GravityHelperInterop.BeginOverride(); player.MoveToX(vec.X); player.MoveToY(vec.Y); + GravityHelperInterop.EndOverride(); yield return null; } @@ -531,6 +544,8 @@ public static void PurpleBoosterExplodeLaunch(Player player, Vector2 from, Vecto level.Shake(0.15f); Vector2 vector = (player.Center - from).SafeNormalize(-Vector2.UnitY); + vector = GravityHelperInterop.InvertIfRequired(vector); + if (Math.Abs(vector.X) < 1f && Math.Abs(vector.Y) < 1f) vector *= 1.1f; diff --git a/Code/Misc/GravityHelperInterop.cs b/Code/Misc/GravityHelperInterop.cs index 1e5b693..4591d5b 100644 --- a/Code/Misc/GravityHelperInterop.cs +++ b/Code/Misc/GravityHelperInterop.cs @@ -1,4 +1,5 @@ -using MonoMod.ModInterop; +using Microsoft.Xna.Framework; +using MonoMod.ModInterop; using System; namespace Celeste.Mod.VortexHelper.Misc; @@ -10,8 +11,13 @@ internal static class Imports { public static Func IsPlayerInverted; public static Func IsActorInverted; + public static Action BeginOverride; + public static Action EndOverride; } public static bool IsPlayerInverted() => Imports.IsPlayerInverted?.Invoke() ?? false; public static bool IsActorInverted(Actor actor) => Imports.IsActorInverted?.Invoke(actor) ?? false; + public static void BeginOverride() => Imports.BeginOverride?.Invoke(); + public static void EndOverride() => Imports.EndOverride?.Invoke(); + public static Vector2 InvertIfRequired(Vector2 v) => IsPlayerInverted() ? new Vector2(v.X, -v.Y) : v; } \ No newline at end of file From 5a5dc7d3a341170afe48ea01891b0308357ad126 Mon Sep 17 00:00:00 2001 From: Samah Date: Sun, 29 Dec 2024 14:58:14 +1030 Subject: [PATCH 5/5] Add GravityHelper as optional dependency --- everest.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/everest.yaml b/everest.yaml index 4d909dc..811bbbc 100644 --- a/everest.yaml +++ b/everest.yaml @@ -4,3 +4,6 @@ Dependencies: - Name: EverestCore Version: 1.4465.0 + OptionalDependencies: + - Name: GravityHelper + Version: 1.2.10 \ No newline at end of file