CatStation/Content.Shared/Weapons/Ranged/Components/RevolverAmmoProviderComponent.cs
deltanedas cf7fde3d62
Big prototype and datafield cleanup (#45202)
* giant protoid cleanup

* yml changes

* !

---------

Co-authored-by: deltanedas <@deltanedas:goida.zip>
2026-08-12 02:07:22 +00:00

51 lines
1.7 KiB
C#

using Content.Shared.Whitelist;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.Weapons.Ranged.Components;
[RegisterComponent, NetworkedComponent]
public sealed partial class RevolverAmmoProviderComponent : AmmoProviderComponent
{
/*
* Revolver has an array of its slots of which we can fire from any index.
* We also keep a separate array of slots we haven't spawned entities for, Chambers. This means that rather than creating
* for example 7 entities when revolver spawns (1 for the revolver and 6 cylinders) we can instead defer it.
*/
[DataField]
public EntityWhitelist? Whitelist;
[ViewVariables]
public Container AmmoContainer = default!;
[DataField("currentSlot")]
public int CurrentIndex;
[DataField]
public int Capacity = 6;
// Like BallisticAmmoProvider we defer spawning until necessary
// AmmoSlots is the instantiated ammo and Chambers is the unspawned ammo (that may or may not have been shot).
// TODO: Using an array would be better but this throws!
[DataField]
public List<EntityUid?> AmmoSlots = new();
[DataField]
public bool?[] Chambers = Array.Empty<bool?>();
[DataField("proto")]
public EntProtoId? FillPrototype = "CartridgeMagnum";
[DataField]
public SoundSpecifier? SoundEject = new SoundPathSpecifier("/Audio/Weapons/Guns/MagOut/revolver_magout.ogg");
[DataField]
public SoundSpecifier? SoundInsert = new SoundPathSpecifier("/Audio/Weapons/Guns/MagIn/revolver_magin.ogg");
[DataField]
public SoundSpecifier? SoundSpin = new SoundPathSpecifier("/Audio/Weapons/Guns/Misc/revolver_spin.ogg");
}