2021-06-09 22:19:39 +02:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2021-10-27 04:24:22 +03:00
|
|
|
using Content.Shared.Light;
|
2021-08-13 21:31:37 -07:00
|
|
|
using Content.Shared.Sound;
|
2021-04-08 16:28:06 +04:00
|
|
|
using Robust.Shared.Containers;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.Prototypes;
|
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
|
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Light.Components
|
2021-04-08 16:28:06 +04:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Device that allows user to quikly change bulbs in <see cref="PoweredLightComponent"/>
|
|
|
|
|
/// Can be reloaded by new light tubes or light bulbs
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RegisterComponent]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class LightReplacerComponent : Component
|
2021-04-08 16:28:06 +04:00
|
|
|
{
|
2021-10-28 05:36:09 +03:00
|
|
|
[DataField("sound")]
|
|
|
|
|
public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Weapons/click.ogg");
|
2021-04-08 16:28:06 +04:00
|
|
|
|
2021-10-28 05:36:09 +03:00
|
|
|
/// <summary>
|
|
|
|
|
/// Bulbs that were inside light replacer when it spawned
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("contents")]
|
|
|
|
|
public List<LightReplacerEntity> Contents = new();
|
2021-04-08 16:28:06 +04:00
|
|
|
|
2021-10-28 05:36:09 +03:00
|
|
|
/// <summary>
|
|
|
|
|
/// Bulbs that were inserted inside light replacer
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public IContainer InsertedBulbs = default!;
|
2021-04-08 16:28:06 +04:00
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
[DataDefinition]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class LightReplacerEntity
|
2021-04-08 16:28:06 +04:00
|
|
|
{
|
|
|
|
|
[DataField("name", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
2021-10-28 05:36:09 +03:00
|
|
|
public string PrototypeName = default!;
|
2021-04-08 16:28:06 +04:00
|
|
|
|
|
|
|
|
[DataField("amount")]
|
|
|
|
|
public int Amount;
|
|
|
|
|
|
|
|
|
|
[DataField("type")]
|
|
|
|
|
public LightBulbType Type;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|