diff --git a/Content.Server/_DV/Abilities/Kitsune/KitsuneSystem.cs b/Content.Server/_DV/Abilities/Kitsune/KitsuneSystem.cs index 7ab0084e10..df0649af81 100644 --- a/Content.Server/_DV/Abilities/Kitsune/KitsuneSystem.cs +++ b/Content.Server/_DV/Abilities/Kitsune/KitsuneSystem.cs @@ -39,6 +39,7 @@ public sealed class KitsuneSystem : SharedKitsuneSystem return; newKitsune.Color = oldKitsune.Color; + newKitsune.ColorLight = oldKitsune.ColorLight; _appearance.SetData(newEntity, KitsuneColorVisuals.Color, newKitsune.Color ?? Color.Orange); // Ensure that the fox fire action state is transferred properly. diff --git a/Content.Shared/_DV/Abilities/Kitsune/KitsuneComponent.cs b/Content.Shared/_DV/Abilities/Kitsune/KitsuneComponent.cs index aa00f1bdba..67479cf9a4 100644 --- a/Content.Shared/_DV/Abilities/Kitsune/KitsuneComponent.cs +++ b/Content.Shared/_DV/Abilities/Kitsune/KitsuneComponent.cs @@ -30,6 +30,12 @@ public sealed partial class KitsuneComponent : Component [DataField, AutoNetworkedField] public List ActiveFoxFires = []; [DataField, AutoNetworkedField] public Color? Color; + + /// + /// Represents a light coming from a light source. + /// As such it has its value maximised while not touching hue or saturation. + /// + [DataField, AutoNetworkedField] public Color? ColorLight; } [Serializable, NetSerializable] diff --git a/Content.Shared/_DV/Abilities/Kitsune/SharedKitsuneSystem.cs b/Content.Shared/_DV/Abilities/Kitsune/SharedKitsuneSystem.cs index 1219411ce3..e9728557ca 100644 --- a/Content.Shared/_DV/Abilities/Kitsune/SharedKitsuneSystem.cs +++ b/Content.Shared/_DV/Abilities/Kitsune/SharedKitsuneSystem.cs @@ -31,6 +31,22 @@ public abstract class SharedKitsuneSystem : EntitySystem if (TryComp(ent, out var humanComp)) { ent.Comp.Color = humanComp.EyeColor; + + var lightColor = ent.Comp.Color.Value; + var max = MathF.Max(lightColor.R, MathF.Max(lightColor.G, lightColor.B)); + // Don't let it divide by 0 + if (max == 0) + { + lightColor = new Color(1, 1, 1, lightColor.A); + } + else + { + var factor = 1 / max; + lightColor.R *= factor; + lightColor.G *= factor; + lightColor.B *= factor; + } + ent.Comp.ColorLight = lightColor; } } @@ -71,7 +87,7 @@ public abstract class SharedKitsuneSystem : EntitySystem Dirty(fireEnt, fireComp); Dirty(ent); - _light.SetColor(fireEnt, ent.Comp.Color ?? Color.Purple); + _light.SetColor(fireEnt, ent.Comp.ColorLight ?? Color.Purple); } private void OnFoxfireShutdown(Entity ent, ref ComponentShutdown args)