Move entity effects definitions to shared (#35614)
* 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>
This commit is contained in:
committed by
GitHub
parent
7ba81173bd
commit
bf41de18aa
48
Content.Shared/EntityEffects/Effects/Glow.cs
Normal file
48
Content.Shared/EntityEffects/Effects/Glow.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
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";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user