using Content.Shared.Weapons.Ranged.Components; using Robust.Shared.GameStates; using Robust.Shared.Serialization; namespace Content.Shared._RMC14.Weapons.Ranged; [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] [Access(typeof(RMCSelectiveFireSystem))] public sealed partial class RMCSelectiveFireComponent : Component { /// /// The base fire modes available to the weapon. This will override what's set in the weapon's GunComponent. /// [DataField, AutoNetworkedField] public SelectiveFire BaseFireModes = SelectiveFire.SemiAuto; /// /// The base recoil when the weapon is wielded. /// [DataField, AutoNetworkedField] public float RecoilWielded = 1f; /// /// The base recoil when the weapon is not wielded. /// [DataField, AutoNetworkedField] public float RecoilUnwielded = 1f; /// /// Equivalent to GunComponent.AngleIncrease. /// This exists to properly reset the angle increase after switching firemodes. /// This generally should not be changed. Instead, use ShotsToMaxScatter in the relevant firemode's entry in Modifiers. /// [DataField, AutoNetworkedField] public Angle ScatterIncrease = Angle.FromDegrees(0.0); /// /// Equivalent to GunComponent.AngleDecay. /// This should not be changed. RMC guns reset their scatter to the minimum instantly after shooting. /// This is here to make sure the scatter decay doesn't get overriden by something someone sets in the weapon's GunComponent. /// [DataField, AutoNetworkedField] public Angle ScatterDecay = Angle.FromDegrees(0.0); /// /// Equivalent to GunComponent.MinAngle and GunComponent.MaxAngle /// This is the base scatter value for a wielded weapon. /// Scatter is the angle of the cone within which your shots deviate from where your cursor is. /// Conversion from 13 guns: scatter * 2 /// [DataField, AutoNetworkedField] public Angle ScatterWielded = Angle.FromDegrees(10.0); /// /// Equivalent to GunComponent.MinAngle and GunComponent.MaxAngle /// This is the base scatter value for an unwielded weapon. /// Scatter is the angle of the cone within which your shots deviate from where your cursor is. /// Conversion from 13 guns: scatter_unwielded * 2 /// [DataField, AutoNetworkedField] public Angle ScatterUnwielded = Angle.FromDegrees(10.0); /// /// Equivalent to GunComponent.FireRate. /// This is how many shots a weapon fires per second. /// Conversion from 13 guns: 1 / (fire_delay / 10) /// [DataField, AutoNetworkedField] public float BaseFireRate = 1.429f; /// /// This is the multiplier applied to the additional scatter added by a SelectiveFireModifierSet with UseBurstScatterMult set to true. /// Conversion from 13 guns: burst_scatter_mult /// [DataField, AutoNetworkedField] public double BurstScatterMult = 4.0; /// /// This is the modified burst scatter multiplier. This should not be set manually, it's handled by RMCSelectiveFireSystem. /// [DataField, AutoNetworkedField] public double BurstScatterMultModified = 4.0; /// /// This dictionary contains the modifiers used for different firemodes. /// If a firemode isn't in here, it doesn't get any of the modifiers applied to it and will not have variable scatter. /// [DataField, AutoNetworkedField] public Dictionary Modifiers = new() { { SelectiveFire.Burst, new SelectiveFireModifierSet(0.1f, 10.0, true, 2.0, 6) }, { SelectiveFire.FullAuto, new SelectiveFireModifierSet(0f, 26.0, true, 2.0, 4) } }; } [DataRecord, Serializable, NetSerializable] public record struct SelectiveFireModifierSet( /// /// Additional fire delay applied to the weapon when this mode is active. /// A weapon's fire delay is the delay in seconds between each shot. It's inversely proportionate to the weapon's rate of fire. /// Conversion from rate of fire: 1 / FireRate /// Conversion from 13 guns for burst fire: burst_delay / 10 * 0.666. Due to how burst delay is handled in 13, we need the 0.666. /// float FireDelay, /// /// A flat modifier applied to the weapon's maximum scatter. /// This is multiplied by UnwieldedScatterMultiplier if the weapon is not wielded and by BurstScatterMultModified if UseBurstScatterMult is true. /// This modifier will never reduce the weapon's scatter — only increase it or keep it the same — even if made negative by its multipliers. /// Conversion from 13 guns for burst fire: 10 /// Conversion from 13 guns for fully-automatic fire: fa_max_scatter * 2 /// double MaxScatterModifier, /// /// If this is set to true, the additional scatter added by this modifier set will be multiplied by BurstScatterMultModified. /// bool UseBurstScatterMult, /// /// The additional scatter added by this modifier set will be multiplied by this value if the weapon is not wielded. /// double UnwieldedScatterMultiplier, /// /// This determines how many shots it takes to reach maximum scatter. /// If it's set to null, the weapon will not accumulate scatter when firing. /// int? ShotsToMaxScatter );