* Move entity effects to shared * relocate spawning to server * Generic version of EntityEffect for just raising event. * genericise everything * oops forgot to push you * some condensation * finish rebas * unwhite the space * oops forgot nuke * bad rebase fix * useless annotations begone --------- Co-authored-by: EmoGarbage404 <retron404@gmail.com>
49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
using Content.Shared.EntityEffects;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Random;
|
|
|
|
namespace Content.Shared.EntityEffects.Effects;
|
|
|
|
/// <summary>
|
|
/// Makes a mob glow.
|
|
/// </summary>
|
|
public sealed partial class Glow : EntityEffect
|
|
{
|
|
[DataField]
|
|
public float Radius = 2f;
|
|
|
|
[DataField]
|
|
public Color Color = Color.Black;
|
|
|
|
private static readonly List<Color> Colors = new()
|
|
{
|
|
Color.White,
|
|
Color.Red,
|
|
Color.Yellow,
|
|
Color.Green,
|
|
Color.Blue,
|
|
Color.Purple,
|
|
Color.Pink
|
|
};
|
|
|
|
public override void Effect(EntityEffectBaseArgs args)
|
|
{
|
|
if (Color == Color.Black)
|
|
{
|
|
var random = IoCManager.Resolve<IRobustRandom>();
|
|
Color = random.Pick(Colors);
|
|
}
|
|
|
|
var lightSystem = args.EntityManager.System<SharedPointLightSystem>();
|
|
var light = lightSystem.EnsureLight(args.TargetEntity);
|
|
lightSystem.SetRadius(args.TargetEntity, Radius, light);
|
|
lightSystem.SetColor(args.TargetEntity, Color, light);
|
|
lightSystem.SetCastShadows(args.TargetEntity, false, light); // this is expensive, and botanists make lots of plants
|
|
}
|
|
|
|
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
|
|
{
|
|
return "TODO";
|
|
}
|
|
}
|