Files
Remuchi e2b6002076 Merge remote-tracking branch 'origin/master' into upstream
# Conflicts:
#	Content.Server/Antag/AntagSelectionSystem.cs
#	Content.Server/Changeling/ChangelingRuleSystem.cs
#	Content.Server/Changeling/ChangelingSystem.Abilities.cs
#	Content.Server/Doors/Systems/DoorSystem.cs
#	Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs
#	Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs
#	Content.Server/GameTicking/Rules/TraitorRuleSystem.cs
#	Content.Server/GameTicking/Rules/ZombieRuleSystem.cs
#	Content.Server/Holosign/HolosignSystem.cs
#	Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs
#	Content.Server/_White/Cult/GameRule/CultRuleComponent.cs
#	Content.Server/_White/Cult/GameRule/CultRuleSystem.cs
#	Content.Server/_White/Cult/Runes/Systems/CultSystem.Rune.cs
#	Content.Server/_White/Keyhole/KeyholeSystem.cs
#	Content.Server/_White/MeatyOre/MeatyOreStoreSystem.cs
#	Content.Shared/Projectiles/SharedProjectileSystem.cs
#	Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs
#	Content.Shared/_White/Keyhole/Components/KeyBaseComponent.cs
#	Resources/Locale/ru-RU/White/stuff.ftl/runes-entities.ftl
#	Resources/Locale/ru-RU/_white/cult/blood-spear.ftl
#	Resources/Locale/ru-RU/_white/cult/bolt-barrage.ftl
#	Resources/Locale/ru-RU/_white/cult/cult.ftl
#	Resources/Locale/ru-RU/_white/cult/gui.ftl
#	Resources/Locale/ru-RU/cult/cult-structure.ftl
#	Resources/Locale/ru-RU/cult/pylon.ftl
#	Resources/Maps/White/Scoupidia.yml
#	Resources/Maps/White/Void.yml
#	Resources/Maps/White/WonderBox.yml
#	Resources/Prototypes/Actions/types.yml
#	Resources/Prototypes/Atmospherics/gases.yml
#	Resources/Prototypes/Catalog/Cargo/cargo_atmospherics.yml
#	Resources/Prototypes/Catalog/Cargo/cargo_vending.yml
#	Resources/Prototypes/Catalog/Fills/Lockers/dressers.yml
#	Resources/Prototypes/Catalog/Fills/Lockers/heads.yml
#	Resources/Prototypes/Catalog/Fills/Lockers/misc.yml
#	Resources/Prototypes/Catalog/uplink_catalog.yml
#	Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml
#	Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml
#	Resources/Prototypes/Entities/Objects/Tools/jaws_of_life.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Melee/sledgehammer.yml
#	Resources/Prototypes/Entities/Objects/Weapons/Melee/sword.yml
#	Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_assembly.yml
#	Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml
#	Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml
#	Resources/Prototypes/Entities/Structures/Doors/Firelocks/frame.yml
#	Resources/Prototypes/Entities/Structures/Doors/SecretDoor/secret_door.yml
#	Resources/Prototypes/Entities/Structures/Doors/Windoors/assembly.yml
#	Resources/Prototypes/Entities/Structures/Doors/Windoors/base_structurewindoors.yml
#	Resources/Prototypes/Entities/Structures/Furniture/dresser.yml
#	Resources/Prototypes/Entities/Structures/Lighting/base_lighting.yml
#	Resources/Prototypes/Entities/Structures/Power/cable_terminal.yml
#	Resources/Prototypes/Entities/Structures/Walls/grille.yml
#	Resources/Prototypes/Entities/Structures/Walls/walls.yml
#	Resources/Prototypes/Entities/Structures/stairs.yml
#	Resources/Prototypes/_White/Entities/Objects/Misc/books.yml
2024-04-13 13:59:00 +07:00

260 lines
7.5 KiB
C#

using Content.Shared.Damage;
using Content.Shared.Tag;
using Content.Shared.Weapons.Ranged.Events;
using Content.Shared.Weapons.Ranged.Systems;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Weapons.Ranged.Components;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause]
[Access(typeof(SharedGunSystem))]
public sealed partial class GunComponent : Component
{
#region Sound
/// <summary>
/// The base sound to use when the gun is fired.
/// </summary>
[DataField]
public SoundSpecifier? SoundGunshot = new SoundPathSpecifier("/Audio/Weapons/Guns/Gunshots/smg.ogg");
/// <summary>
/// The sound to use when the gun is fired.
/// <seealso cref="GunRefreshModifiersEvent"/>
/// </summary>
[AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier? SoundGunshotModified;
[DataField]
public SoundSpecifier? SoundEmpty = new SoundPathSpecifier("/Audio/Weapons/Guns/Empty/empty.ogg");
/// <summary>
/// Sound played when toggling the <see cref="SelectedMode"/> for this gun.
/// </summary>
[DataField]
public SoundSpecifier? SoundMode = new SoundPathSpecifier("/Audio/Weapons/Guns/Misc/selector.ogg");
#endregion
#region Recoil
// These values are very small for now until we get a debug overlay and fine tune it
/// <summary>
/// The base scalar value applied to the vector governing camera recoil.
/// </summary>
[DataField, AutoNetworkedField]
public float CameraRecoilScalar = 1f;
/// <summary>
/// A scalar value applied to the vector governing camera recoil.
/// If 0, there will be no camera recoil.
/// <seealso cref="GunRefreshModifiersEvent"/>
/// </summary>
[AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public float CameraRecoilScalarModified = 1f;
/// <summary>
/// Last time the gun fired.
/// Used for recoil purposes.
/// </summary>
[DataField]
public TimeSpan LastFire = TimeSpan.Zero;
/// <summary>
/// What the current spread is for shooting. This gets changed every time the gun fires.
/// </summary>
[DataField]
[AutoNetworkedField]
public Angle CurrentAngle;
/// <summary>
/// The base value for how much the spread increases every time the gun fires.
/// </summary>
[DataField]
public Angle AngleIncrease = Angle.FromDegrees(0.5);
/// <summary>
/// How much the spread increases every time the gun fires.
/// <seealso cref="GunRefreshModifiersEvent"/>
/// </summary>
[AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public Angle AngleIncreaseModified;
/// <summary>
/// The base value for how much the <see cref="CurrentAngle"/> decreases per second.
/// </summary>
[DataField]
public Angle AngleDecay = Angle.FromDegrees(4);
/// <summary>
/// How much the <see cref="CurrentAngle"/> decreases per second.
/// <seealso cref="GunRefreshModifiersEvent"/>
/// </summary>
[AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public Angle AngleDecayModified;
/// <summary>
/// The base value for the maximum angle allowed for <see cref="CurrentAngle"/>
/// </summary>
[DataField]
[AutoNetworkedField]
public Angle MaxAngle = Angle.FromDegrees(2);
/// <summary>
/// The maximum angle allowed for <see cref="CurrentAngle"/>
/// <seealso cref="GunRefreshModifiersEvent"/>
/// </summary>
[AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public Angle MaxAngleModified;
/// <summary>
/// The base value for the minimum angle allowed for <see cref="CurrentAngle"/>
/// </summary>
[DataField]
[AutoNetworkedField]
public Angle MinAngle = Angle.FromDegrees(1);
/// <summary>
/// The minimum angle allowed for <see cref="CurrentAngle"/>.
/// <seealso cref="GunRefreshModifiersEvent"/>
/// </summary>
[AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public Angle MinAngleModified;
#endregion
/// <summary>
/// Whether this gun is shot via the use key or the alt-use key.
/// </summary>
[DataField, AutoNetworkedField]
public bool UseKey = true;
/// <summary>
/// Where the gun is being requested to shoot.
/// </summary>
[ViewVariables]
public EntityCoordinates? ShootCoordinates = null;
/// <summary>
/// The base value for how many shots to fire per burst.
/// </summary>
[DataField, AutoNetworkedField]
public int ShotsPerBurst = 3;
/// <summary>
/// How many shots to fire per burst.
/// <seealso cref="GunRefreshModifiersEvent"/>
/// </summary>
[AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public int ShotsPerBurstModified = 3;
/// <summary>
/// Used for tracking semi-auto / burst
/// </summary>
[ViewVariables]
[AutoNetworkedField]
public int ShotCounter = 0;
/// <summary>
/// The base value for how many times it shoots per second.
/// </summary>
[DataField]
[AutoNetworkedField]
public float FireRate = 8f;
/// <summary>
/// How many times it shoots per second.
/// <seealso cref="GunRefreshModifiersEvent"/>
/// </summary>
[AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public float FireRateModified;
/// <summary>
/// Starts fire cooldown when equipped if true.
/// </summary>
[DataField]
public bool ResetOnHandSelected = true;
/// <summary>
/// The base value for how fast the projectile moves.
/// </summary>
[DataField]
public float ProjectileSpeed = 25f;
/// <summary>
/// How fast the projectile moves.
/// <seealso cref="GunRefreshModifiersEvent"/>
/// </summary>
[AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public float ProjectileSpeedModified;
/// <summary>
/// When the gun is next available to be shot.
/// Can be set multiple times in a single tick due to guns firing faster than a single tick time.
/// </summary>
[DataField(customTypeSerializer:typeof(TimeOffsetSerializer))]
[AutoNetworkedField]
[AutoPausedField]
public TimeSpan NextFire = TimeSpan.Zero;
/// <summary>
/// What firemodes can be selected.
/// </summary>
[DataField]
[AutoNetworkedField]
public SelectiveFire AvailableModes = SelectiveFire.SemiAuto;
/// <summary>
/// What firemode is currently selected.
/// </summary>
[DataField]
[AutoNetworkedField]
public SelectiveFire SelectedMode = SelectiveFire.SemiAuto;
/// <summary>
/// Whether or not information about
/// the gun will be shown on examine.
/// </summary>
[DataField]
public bool ShowExamineText = true;
/// <summary>
/// Whether or not someone with the
/// clumsy trait can shoot this
/// </summary>
[DataField]
public bool ClumsyProof = false;
// WD START
public EntityUid? Target;
[DataField("forceThrowingAngle")]
[ViewVariables(VVAccess.ReadWrite)]
public bool ForceThrowingAngle;
[DataField("angle")]
[ViewVariables(VVAccess.ReadWrite)]
public Angle Angle;
// WD END
}
[Flags]
public enum SelectiveFire : byte
{
Invalid = 0,
// Combat mode already functions as the equivalent of Safety
SemiAuto = 1 << 0,
Burst = 1 << 1,
FullAuto = 1 << 2, // Not in the building!
//Miracle edit
PullItem = 1 << 3,
PullMob = 1 << 4
//Miracle edit end
}