private static void Player_Update(On.Celeste.Player.orig_Update orig, Player self) { DreamDashController controller = self.Scene.Tracker.GetEntity <DreamDashController>(); if (controller != null) { if (Input.Dash.Pressed && Input.Aim.Value != Vector2.Zero) { controller.dreamDashRedirect(self); } } orig(self); }
private static void Player_Update(On.Celeste.Player.orig_Update orig, Player self) { DreamDashController controller = self.Scene.Tracker.GetEntity <DreamDashController>(); if (controller != null) { if (Input.Dash.Pressed && Input.Aim.Value != Vector2.Zero) { controller.dreamDashRedirect(self); } } Facings preOrigFacing = self.Facing; Vector2 preOrigScale = self.Sprite.Scale; orig(self); if (wallPlayerRotations.TryGetValue(self, out var rotationHolder)) { self.Facing = preOrigFacing; self.Sprite.Scale = preOrigScale; Vector2 inputAim = Input.Aim.Value; if (inputAim != Vector2.Zero) { float inputAngleOffset = (inputAim.Angle() - rotationHolder.value + MathHelper.TwoPi) % MathHelper.TwoPi; Facings newFacing = self.Facing; if (inputAngleOffset >= Math.PI * 0.75 && inputAngleOffset <= Math.PI * 1.25) { newFacing = Facings.Left; } else if (inputAngleOffset >= Math.PI * -0.25 && inputAngleOffset <= Math.PI * 0.25 || inputAngleOffset - MathHelper.TwoPi >= Math.PI * -0.25 && inputAngleOffset - MathHelper.TwoPi <= Math.PI * 0.25) { newFacing = Facings.Right; } if (self.Facing != newFacing) { self.Facing = newFacing; } } } }