fish-station/Content.Server/Light/Components/LightBulbComponent.cs
Matz05 919053c5f1
Light bulb brightness (and other settings) change clientside PointLights (#5869)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2022-01-05 16:25:37 +11:00

54 lines
1.6 KiB
C#

using Content.Server.Light.EntitySystems;
using Content.Shared.Acts;
using Content.Shared.Light;
using Content.Shared.Sound;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Light.Components
{
/// <summary>
/// Component that represents a light bulb. Can be broken, or burned, which turns them mostly useless.
/// </summary>
[RegisterComponent, Friend(typeof(LightBulbSystem))]
public class LightBulbComponent : Component, IBreakAct
{
public override string Name => "LightBulb";
[DataField("color")]
public Color Color = Color.White;
[DataField("bulb")]
public LightBulbType Type = LightBulbType.Tube;
[DataField("startingState")]
public LightBulbState State = LightBulbState.Normal;
[DataField("BurningTemperature")]
public int BurningTemperature = 1400;
[DataField("lightEnergy")]
public float lightEnergy = 0.8f;
[DataField("lightRadius")]
public float lightRadius = 10;
[DataField("lightSoftness")]
public float lightSoftness = 1;
[DataField("PowerUse")]
public int PowerUse = 40;
[DataField("breakSound")]
public SoundSpecifier BreakSound = new SoundCollectionSpecifier("GlassBreak");
// TODO: move me to ECS
public void OnBreak(BreakageEventArgs eventArgs)
{
EntitySystem.Get<LightBulbSystem>()
.SetState(Owner, LightBulbState.Broken, this);
}
}
}