Light replacer cleanup + examine (#16066)

This commit is contained in:
Nemanja
2023-05-03 22:09:35 -04:00
committed by GitHub
parent de5d89dad5
commit e47fb42301
5 changed files with 271 additions and 245 deletions

View File

@@ -1,45 +1,35 @@
using Content.Shared.Light.Component;
using Content.Server.Light.EntitySystems;
using Content.Shared.Storage;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Light.Components
namespace Content.Server.Light.Components;
/// <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, Access(typeof(LightReplacerSystem))]
public sealed class LightReplacerComponent : Component
{
/// <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]
public sealed class LightReplacerComponent : Component
[DataField("sound")]
public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Weapons/click.ogg")
{
[DataField("sound")]
public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Weapons/click.ogg");
/// <summary>
/// Bulbs that were inside light replacer when it spawned
/// </summary>
[DataField("contents")]
public List<LightReplacerEntity> Contents = new();
/// <summary>
/// Bulbs that were inserted inside light replacer
/// </summary>
[ViewVariables]
public IContainer InsertedBulbs = default!;
[Serializable]
[DataDefinition]
public sealed class LightReplacerEntity
Params = new()
{
[DataField("name", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string PrototypeName = default!;
[DataField("amount")]
public int Amount;
[DataField("type")]
public LightBulbType Type;
Volume = -4f
}
}
};
/// <summary>
/// Bulbs that were inserted inside light replacer
/// </summary>
[ViewVariables]
public Container InsertedBulbs = default!;
/// <summary>
/// The default starting bulbs
/// </summary>
[DataField("contents")]
public List<EntitySpawnEntry> Contents = new();
}