Fix kitsune fox fires being too dark. (#3726)
Fix kitsune fox fires being too dark
This commit is contained in:
parent
3a131fccc5
commit
514eeef9ef
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue