Files
Delta-v/Content.Shared/_EE/Flight/Components/FlightComponent.cs
T
e945f5869a Harpies Flightless No More! (#4888)
* Initial port of EE Harpy flying (#919)

* Added better friction and acceleration modifiers.

* Moved server's flight system to shared. I don't know why it isn't in the first place.

* Shifting things around.

* Code tweaks to make it better

* Comment fixes

* Fixed footsteps and footstep sounds

* Added a quick conditional if InitialStaminaCost greater than zero

* Removed a pop-up that wasn't showing

* Additional adjustments

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixed a few more systems to call the Flying system instead of the component

* Comment consistency. DeltaV comments where I made it better. EE comments where they originally had things

* YAML fixes

* Guidebook

* Apply suggestions from code review

Co-authored-by: Tobias Berger <toby@tobot.dev>
Signed-off-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com>

* Removed DoAfterDashEvent

* Fixed suggestions

* Updated comment

* Added new copyright free wingflaps with proper attribution

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Appeased YAML gods

---------

Signed-off-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tobias Berger <toby@tobot.dev>
2025-12-08 14:58:52 +01:00

120 lines
3.3 KiB
C#

using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared._EE.Flight;
/// <summary>
/// Adds an action that allows the user to become temporarily
/// weightless at the cost of stamina and hand usage.
/// </summary>
[RegisterComponent, NetworkedComponent(), AutoGenerateComponentState]
public sealed partial class FlightComponent : Component
{
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? ToggleAction = "ActionToggleFlight";
[DataField, AutoNetworkedField]
public EntityUid? ToggleActionEntity;
/// <summary>
/// Is the user flying right now?
/// </summary>
[DataField, AutoNetworkedField]
public bool IsCurrentlyFlying;
/// <summary>
/// Stamina drain per second when flying
/// </summary>
[DataField, AutoNetworkedField]
public float StaminaDrainRate = 10.0f;
/// <summary>
/// DeltaV - Stamina cost when taking off.
/// </summary>
[DataField, AutoNetworkedField]
public float InitialStaminaCost = 0f;
/// <summary>
/// DoAfter delay until the user becomes weightless.
/// </summary>
[DataField, AutoNetworkedField]
public float ActivationDelay = 0.5f;
/// <summary>
/// Speed modifier while in flight
/// </summary>
[DataField, AutoNetworkedField]
public float SpeedModifier = 2.0f;
/// <summary>
/// DeltaV - Friction modifier while in flight. Should be less than one so
/// they have less control while flying. Also applies to friction with no inputs.
/// </summary>
[DataField, AutoNetworkedField]
public float FrictionModifier = 1f;
/// <summary>
/// DeltaV - Acceleration modifer while in flight.
/// </summary>
[DataField, AutoNetworkedField]
public float AccelerationModifer = 1.5f;
/// <summary>
/// Path to a sound specifier or collection for the noises made during flight
/// </summary>
[DataField]
public SoundSpecifier FlapSound = new SoundCollectionSpecifier("WingFlaps");
/// <summary>
/// Is the flight animated?
/// </summary>
[DataField]
public bool IsAnimated = true;
/// <summary>
/// Does the animation animate a layer?.
/// </summary>
[DataField]
public bool IsLayerAnimated;
/// <summary>
/// Which RSI layer path does this animate?
/// </summary>
[DataField]
public string? Layer;
/// <summary>
/// Whats the speed of the shader?
/// </summary>
[DataField]
public float ShaderSpeed = 6.0f;
/// <summary>
/// How much are the values in the shader's calculations multiplied by?
/// </summary>
[DataField]
public float ShaderMultiplier = 0.02f;
/// <summary>
/// What is the offset on the shader?
/// </summary>
[DataField]
public float ShaderOffset = 0.25f;
/// <summary>
/// What animation does the flight use?
/// </summary>
[DataField]
public string AnimationKey = "default";
/// <summary>
/// Time between sounds being played
/// </summary>
[DataField]
public float FlapInterval = 1.0f;
public float TimeUntilFlap;
}