Fix kitsune fox fires being too dark. (#3726)

Fix kitsune fox fires being too dark
This commit is contained in:
SolStar 2025-05-13 00:10:00 -04:00 committed by GitHub
parent 3a131fccc5
commit 514eeef9ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 1 deletions

View File

@ -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.

View File

@ -30,6 +30,12 @@ public sealed partial class KitsuneComponent : Component
[DataField, AutoNetworkedField] public List<EntityUid> ActiveFoxFires = [];
[DataField, AutoNetworkedField] public Color? Color;
/// <summary>
/// Represents a light coming from a light source.
/// As such it has its value maximised while not touching hue or saturation.
/// </summary>
[DataField, AutoNetworkedField] public Color? ColorLight;
}
[Serializable, NetSerializable]

View File

@ -31,6 +31,22 @@ public abstract class SharedKitsuneSystem : EntitySystem
if (TryComp<HumanoidAppearanceComponent>(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<FoxfireComponent> ent, ref ComponentShutdown args)