Adds grappling gun (#16662)

This commit is contained in:
metalgearsloth
2023-05-27 14:15:15 +10:00
committed by GitHub
parent 9eb4d4edb0
commit 552fbb0585
48 changed files with 753 additions and 35 deletions

View File

@@ -22,6 +22,8 @@ public sealed partial class BallisticAmmoProviderComponent : Component
[ViewVariables(VVAccess.ReadWrite), DataField("capacity")]
public int Capacity = 30;
public int Count => UnspawnedCount + Container.ContainedEntities.Count;
[ViewVariables(VVAccess.ReadWrite), DataField("unspawnedCount")]
[AutoNetworkedField]
public int UnspawnedCount;

View File

@@ -0,0 +1,28 @@
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
namespace Content.Shared.Weapons.Ranged.Components;
// I have tried to make this as generic as possible but "delete joint on cycle / right-click reels in" is very specific behavior.
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class GrapplingGunComponent : Component
{
[DataField("jointId"), AutoNetworkedField]
public string Joint = string.Empty;
[DataField("projectile")] public EntityUid? Projectile;
[ViewVariables(VVAccess.ReadWrite), DataField("reeling"), AutoNetworkedField]
public bool Reeling;
[ViewVariables(VVAccess.ReadWrite), DataField("reelSound"), AutoNetworkedField]
public SoundSpecifier? ReelSound = new SoundPathSpecifier("/Audio/Weapons/reel.ogg")
{
Params = AudioParams.Default.WithLoop(true)
};
[ViewVariables(VVAccess.ReadWrite), DataField("cycleSound"), AutoNetworkedField]
public SoundSpecifier? CycleSound = new SoundPathSpecifier("/Audio/Weapons/Guns/MagIn/kinetic_reload.ogg");
public IPlayingAudioStream? Stream;
}

View File

@@ -0,0 +1,12 @@
using Robust.Shared.GameStates;
namespace Content.Shared.Weapons.Ranged.Components;
/// <summary>
/// Recharges ammo upon the gun being cycled.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed class RechargeCycleAmmoComponent : Component
{
}