Skip to content

Commit 3c689c6

Browse files
authored
Merge pull request #167 from EverestAPI/fix_stomp_custom_color
Fix stomp particle color for seekers with custom colors
2 parents f62ad24 + d8c8fd2 commit 3c689c6

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

Entities/SeekerCustomColors.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,29 @@ namespace Celeste.Mod.SpringCollab2020.Entities {
77
[CustomEntity("SpringCollab2020/SeekerCustomColors")]
88
[TrackedAs(typeof(Seeker))]
99
class SeekerCustomColors : Seeker {
10+
public static void Load() {
11+
On.Celeste.Seeker.GotBouncedOn += modGotBouncedOn;
12+
}
13+
14+
public static void Unload() {
15+
On.Celeste.Seeker.GotBouncedOn -= modGotBouncedOn;
16+
}
17+
18+
private static void modGotBouncedOn(On.Celeste.Seeker.orig_GotBouncedOn orig, Seeker self, Entity entity) {
19+
// if the seeker is one with custom colors, switch out the "stomp" particle that will be used by vanilla code.
20+
bool hasCustomColor = self is SeekerCustomColors;
21+
if (hasCustomColor) {
22+
P_Stomp = (self as SeekerCustomColors).pStomp;
23+
}
24+
25+
orig(self, entity);
26+
27+
// restore the stomp particle.
28+
if (hasCustomColor) {
29+
P_Stomp = basePStomp;
30+
}
31+
}
32+
1033
private static ParticleType basePAttack;
1134
private static ParticleType basePHitWall;
1235
private static ParticleType basePStomp;
@@ -54,17 +77,17 @@ public SeekerCustomColors(EntityData data, Vector2 offset) : base(data, offset)
5477
public override void Update() {
5578
P_Attack = pAttack;
5679
P_HitWall = pHitWall;
57-
P_Stomp = pStomp;
5880
P_Regen = pRegen;
5981
self["TrailColor"] = trailColor;
6082

6183
base.Update();
6284

6385
P_Attack = basePAttack;
6486
P_HitWall = basePHitWall;
65-
P_Stomp = basePStomp;
6687
P_Regen = basePRegen;
6788
self["TrailColor"] = baseTrailColor;
6889
}
90+
91+
6992
}
7093
}

SpringCollab2020Module.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public override void Load() {
3131
MadelineSilhouetteTrigger.Load();
3232
BlockJellySpawnTrigger.Load();
3333
StrawberryIgnoringLighting.Load();
34+
SeekerCustomColors.Load();
3435
}
3536

3637
public override void LoadContent(bool firstLoad) {
@@ -57,6 +58,7 @@ public override void Unload() {
5758
MadelineSilhouetteTrigger.Unload();
5859
BlockJellySpawnTrigger.Unload();
5960
StrawberryIgnoringLighting.Unload();
61+
SeekerCustomColors.Unload();
6062
}
6163

6264
public override void PrepareMapDataProcessors(MapDataFixup context) {

0 commit comments

Comments
 (0)