2021-10-27 04:24:22 +03:00
|
|
|
using Content.Server.Light.EntitySystems;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Acts;
|
2021-10-27 04:24:22 +03:00
|
|
|
using Content.Shared.Light;
|
2021-07-10 17:35:33 +02:00
|
|
|
using Content.Shared.Sound;
|
2021-10-27 04:24:22 +03:00
|
|
|
using Robust.Shared.Analyzers;
|
2019-04-15 21:11:38 -06:00
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.Maths;
|
2021-03-05 01:08:38 +01:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2019-03-22 23:59:13 +01:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Light.Components
|
2019-03-22 23:59:13 +01:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Component that represents a light bulb. Can be broken, or burned, which turns them mostly useless.
|
|
|
|
|
/// </summary>
|
2021-10-27 04:24:22 +03:00
|
|
|
[RegisterComponent, Friend(typeof(LightBulbSystem))]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class LightBulbComponent : Component, IBreakAct
|
2019-03-22 23:59:13 +01:00
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("color")]
|
2021-10-27 04:24:22 +03:00
|
|
|
public Color Color = Color.White;
|
2019-03-22 23:59:13 +01:00
|
|
|
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("bulb")]
|
2019-03-22 23:59:13 +01:00
|
|
|
public LightBulbType Type = LightBulbType.Tube;
|
|
|
|
|
|
2021-10-27 04:24:22 +03:00
|
|
|
[DataField("startingState")]
|
|
|
|
|
public LightBulbState State = LightBulbState.Normal;
|
|
|
|
|
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("BurningTemperature")]
|
2021-10-27 04:24:22 +03:00
|
|
|
public int BurningTemperature = 1400;
|
2019-04-06 17:11:51 +02:00
|
|
|
|
2022-01-04 22:25:37 -07:00
|
|
|
[DataField("lightEnergy")]
|
2022-01-09 20:10:36 -08:00
|
|
|
public float LightEnergy = 0.8f;
|
2022-01-04 22:25:37 -07:00
|
|
|
|
|
|
|
|
[DataField("lightRadius")]
|
2022-01-09 20:10:36 -08:00
|
|
|
public float LightRadius = 10;
|
2022-01-04 22:25:37 -07:00
|
|
|
|
|
|
|
|
[DataField("lightSoftness")]
|
2022-01-09 20:10:36 -08:00
|
|
|
public float LightSoftness = 1;
|
2022-01-04 22:25:37 -07:00
|
|
|
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("PowerUse")]
|
2022-01-27 00:01:32 +00:00
|
|
|
public int PowerUse = 60;
|
2019-04-06 17:11:51 +02:00
|
|
|
|
2021-07-10 17:35:33 +02:00
|
|
|
[DataField("breakSound")]
|
2021-10-27 04:24:22 +03:00
|
|
|
public SoundSpecifier BreakSound = new SoundCollectionSpecifier("GlassBreak");
|
2020-04-13 01:44:05 +02:00
|
|
|
|
2021-10-27 04:24:22 +03:00
|
|
|
// TODO: move me to ECS
|
2021-01-08 18:06:36 -07:00
|
|
|
public void OnBreak(BreakageEventArgs eventArgs)
|
|
|
|
|
{
|
2021-10-27 04:24:22 +03:00
|
|
|
EntitySystem.Get<LightBulbSystem>()
|
2021-12-03 15:53:09 +01:00
|
|
|
.SetState(Owner, LightBulbState.Broken, this);
|
2021-02-16 11:40:43 +03:00
|
|
|
}
|
2019-03-22 23:59:13 +01:00
|
|
|
}
|
|
|
|
|
}
|