Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 28 additions & 31 deletions SolidModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private void Player_Added(On.Celeste.Player.orig_Render orig, Player self)

void PlayerHair_Update(On.Celeste.PlayerHair.orig_Update orig, PlayerHair self)
{
if ((self.Entity as BadelineOldsite) == null && ((self.Entity as Player) != null && Settings.HairLength != HairCount))
if (!(self.Entity is BadelineOldsite) && self.Entity is Player && Settings.HairLength != HairCount))
{
Player player = self.Entity as Player;
player.Sprite.HairCount = Settings.HairLength;
Expand Down Expand Up @@ -139,12 +139,14 @@ private void Player_Update(On.Celeste.Player.orig_Update orig, Player self)
NormalHairColor.SetValue(null, Calc.HexToColor("AC3232"));
TwoDashesHairColor.SetValue(null, Calc.HexToColor("FF6DEF"));
UsedHairColor.SetValue(null, Calc.HexToColor("44B7FF"));
if (((Entity)self as BadelineOldsite) != null)
if (self is BadelineOldsite)
{
self.Sprite.HairCount = Settings.HairLength;
}
}
if ((Settings.Badeline) != (self.Sprite.Mode == PlayerSpriteMode.Badeline))
bool isBadeline = self.Sprite.Mode == PlayerSpriteMode.Badeline;

if (Settings.Badeline || (Settings.Badeline || isBadeline))
{
PlayerSpriteMode mode = self.Sprite.Mode;
self.Remove(self.Sprite);
Expand Down Expand Up @@ -318,49 +320,44 @@ public override void Unload()
// }
//}

public static void AddTrail(On.Celeste.TrailManager.orig_Add_Entity_Color_float orig, Entity self, Color color, float duration)
public static void AddTrail(On.Celeste.TrailManager.orig_Add_Entity_Color_float orig, Entity rawSelf, Color color, float duration)
{
Color colorOrig = color;

if (!(self is Player))
if (!Settings.Enabled)
{
orig(rawSelf, colorOrig, duration);
}

if (!(rawSelf is Player))
return;

Player self = (Player) rawSelf;

Color colorOrig = color;

if ((self as Player).Sprite.Mode == PlayerSpriteMode.Badeline)
if (self.Sprite.Mode == PlayerSpriteMode.Badeline)
{
orig(self, ColorFromHex("ff0019"), duration);
return;
}

Color newColor = color;

if ((self as Player).StateMachine.State == 19)
if (self.StateMachine.State == 19)
return;

if (self is Player)
{

int dashes = ((Player)self).Dashes;
int dashes = ((Player)self).Dashes;

if (dashes == 0)
newColor = ColorFromHex(Settings.Dash0Color);

if (dashes == 1)
newColor = ColorFromHex(Settings.Dash1Color);
if (dashes == 0)
newColor = ColorFromHex(Settings.Dash0Color);

if (dashes == 2)
newColor = ColorFromHex(Settings.Dash2Color);
if (dashes == 1)
newColor = ColorFromHex(Settings.Dash1Color);

}
if (dashes == 2)
newColor = ColorFromHex(Settings.Dash2Color);

color.A = colorOrig.A;
if (Settings.Enabled)
{
orig(self, newColor, duration);
}
else
{
orig(self, colorOrig, duration);
}
orig(rawSelf, newColor, duration);
}

public static Color GetTrailColor(On.Celeste.Player.orig_GetTrailColor orig, Player self, bool wasDashB)
Expand All @@ -372,7 +369,7 @@ public static Color GetTrailColor(On.Celeste.Player.orig_GetTrailColor orig, Pla
if (!(self is Player))
return colorOrig;

if ((self as Player).Sprite.Mode == PlayerSpriteMode.Badeline)
if (self.Sprite.Mode == PlayerSpriteMode.Badeline)
{
return colorOrig;
}
Expand Down Expand Up @@ -417,4 +414,4 @@ public static Color ColorFromHex(string colorcode)
}

}
}
}