Skip to content

Commit

Permalink
EyeColorFix
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxoTrystan committed Oct 9, 2024
1 parent 93f2951 commit 15eb37b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Content.Server/Shadowkin/ShadowkinSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public override void Initialize()
SubscribeLocalEvent<ShadowkinComponent, OnAttemptPowerUseEvent>(OnAttemptPowerUse);
SubscribeLocalEvent<ShadowkinComponent, OnManaUpdateEvent>(OnManaUpdate);
SubscribeLocalEvent<ShadowkinComponent, RejuvenateEvent>(OnRejuvenate);
SubscribeLocalEvent<ShadowkinComponent, EyeColorInitEvent>(OnEyeColorChange);
}

private void OnInit(EntityUid uid, ShadowkinComponent component, ComponentStartup args)
Expand All @@ -47,6 +48,18 @@ private void OnInit(EntityUid uid, ShadowkinComponent component, ComponentStartu
UpdateShadowkinAlert(uid, component);
}

private void OnEyeColorChange(EntityUid uid, ShadowkinComponent component, EyeColorInitEvent args)
{
if (!TryComp<HumanoidAppearanceComponent>(uid, out var humanoid)
|| !component.BlackeyeSpawn
|| humanoid.EyeColor == component.OldEyeColor)
return;

component.OldEyeColor = humanoid.EyeColor;
humanoid.EyeColor = component.BlackEyeColor;
Dirty(humanoid);
}

private void OnExamined(EntityUid uid, ShadowkinComponent component, ExaminedEvent args)
{
if (!args.IsInDetailsRange
Expand Down
4 changes: 4 additions & 0 deletions Content.Shared/Humanoid/EyeColor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace Content.Shared.Humanoid;

[ByRefEvent]
public record struct EyeColorInitEvent();
4 changes: 3 additions & 1 deletion Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,11 @@ public virtual void LoadProfile(EntityUid uid, HumanoidCharacterProfile? profile
return;
}

humanoid.EyeColor = profile.Appearance.EyeColor;
SetSpecies(uid, profile.Species, false, humanoid);
SetSex(uid, profile.Sex, false, humanoid);
humanoid.EyeColor = profile.Appearance.EyeColor;
var ev = new EyeColorInitEvent();
RaiseLocalEvent(uid, ref ev);

SetSkinColor(uid, profile.Appearance.SkinColor, false);

Expand Down

0 comments on commit 15eb37b

Please sign in to comment.