Skip to content

Commit c633601

Browse files
committed
Add the 'water fix' from Isa's Grab Bag to the collab helper when needed to beat the map
... technically a side-effect of a fix for a bug that already was fixed in Everest, so it could be removed in the future. But these side-effects are required to beat a particular map, so this needs to stay for that map.
1 parent 130f603 commit c633601

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using Microsoft.Xna.Framework;
2+
using Monocle;
3+
using System.Linq;
4+
5+
namespace Celeste.Mod.SpringCollab2020.Entities {
6+
/// <summary>
7+
/// This is a replica of the "water zipping fix" from Isa's Grab Bag.
8+
/// This has side effects so this is technically a bug, but these side effects are used in ProXas's entry
9+
/// to give insane amounts of speed to the player with small spots of water.
10+
/// So this should stay in the collab where needed, even if fixed on Isa's side.
11+
/// </summary>
12+
public class WaterRocketLaunchingComponent : Component {
13+
public static void Load() {
14+
On.Celeste.Player.Added += onPlayerAdded;
15+
}
16+
17+
public static void Unload() {
18+
On.Celeste.Player.Added -= onPlayerAdded;
19+
}
20+
21+
private static void onPlayerAdded(On.Celeste.Player.orig_Added orig, Player self, Scene scene) {
22+
orig(self, scene);
23+
24+
string mapSID = self.SceneAs<Level>().Session.Area.GetSID();
25+
if (!self.Components.Any(component => component.GetType().ToString() == "Celeste.Mod.IsaGrabBag.WaterFix") &&
26+
(mapSID == "SpringCollab2020/2-Intermediate/ProXas" || mapSID == "SpringCollab2020/2-Intermediate/ZZ-HeartSide")) {
27+
28+
// Isa's Grab Bag didn't add the "water fix" and the current map needs it, so add it ourselves.
29+
self.Add(new WaterRocketLaunchingComponent(true, false));
30+
}
31+
}
32+
33+
public WaterRocketLaunchingComponent(bool active, bool visible) : base(active, visible) { }
34+
35+
private Player player;
36+
37+
public override void Update() {
38+
player = Entity as Player;
39+
if (player == null || !player.Collidable) {
40+
return;
41+
}
42+
43+
Vector2 posOffset = player.Position + player.Speed * Engine.DeltaTime * 2;
44+
45+
bool isInWater = player.CollideCheck<Water>(posOffset) || player.CollideCheck<Water>(posOffset + Vector2.UnitY * -8f);
46+
47+
if (!isInWater && player.StateMachine.State == 3 && (player.Speed.Y < 0 || Input.MoveY.Value == -1 || Input.Jump.Check)) {
48+
player.Speed.Y = (Input.MoveY.Value == -1 || Input.Jump.Check) ? -110 : 0;
49+
if (player.Speed.Y < -1) {
50+
player.Speed.X *= 1.1f;
51+
}
52+
}
53+
}
54+
}
55+
}

SpringCollab2020Module.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public override void Load() {
4040
StaticPuffer.Load();
4141
LeaveTheoBehindTrigger.Load();
4242
BadelineBounceDirectionTrigger.Load();
43+
WaterRocketLaunchingComponent.Load();
4344
Everest.Events.Level.OnLoadBackdrop += onLoadBackdrop;
4445

4546
DecalRegistry.AddPropertyHandler("scale", (decal, attrs) => {
@@ -85,6 +86,7 @@ public override void Unload() {
8586
StaticPuffer.Unload();
8687
LeaveTheoBehindTrigger.Unload();
8788
BadelineBounceDirectionTrigger.Unload();
89+
WaterRocketLaunchingComponent.Unload();
8890
Everest.Events.Level.OnLoadBackdrop -= onLoadBackdrop;
8991
}
9092

0 commit comments

Comments
 (0)