Moves buckling and vehicles to shared, some cleanup (#15923)
This commit is contained in:
@@ -1,92 +1,113 @@
|
||||
using Content.Shared.Actions.ActionTypes;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Vehicle.Components
|
||||
namespace Content.Shared.Vehicle.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This is particularly for vehicles that use
|
||||
/// buckle. Stuff like clown cars may need a different
|
||||
/// component at some point.
|
||||
/// All vehicles should have Physics, Strap, and SharedPlayerInputMover components.
|
||||
/// </summary>
|
||||
[AutoGenerateComponentState]
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[Access(typeof(SharedVehicleSystem))]
|
||||
public sealed partial class VehicleComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// This is particularly for vehicles that use
|
||||
/// buckle. Stuff like clown cars may need a different
|
||||
/// component at some point.
|
||||
/// All vehicles should have Physics, Strap, and SharedPlayerInputMover components.
|
||||
/// The entity currently riding the vehicle.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class VehicleComponent : Component
|
||||
[ViewVariables]
|
||||
[AutoNetworkedField]
|
||||
public EntityUid? Rider;
|
||||
|
||||
[ViewVariables]
|
||||
[AutoNetworkedField]
|
||||
public EntityUid? LastRider;
|
||||
|
||||
/// <summary>
|
||||
/// The base offset for the vehicle (when facing east)
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public Vector2 BaseBuckleOffset = Vector2.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// The sound that the horn makes
|
||||
/// </summary>
|
||||
[DataField("hornSound")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public SoundSpecifier? HornSound = new SoundPathSpecifier("/Audio/Effects/Vehicle/carhorn.ogg")
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether someone is currently riding the vehicle
|
||||
/// </summary>
|
||||
public bool HasRider => Rider != null;
|
||||
Params = AudioParams.Default.WithVolume(-3f)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The entity currently riding the vehicle.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public EntityUid? Rider;
|
||||
[ViewVariables]
|
||||
public IPlayingAudioStream? HonkPlayingStream;
|
||||
|
||||
/// <summary>
|
||||
/// The base offset for the vehicle (when facing east)
|
||||
/// </summary>
|
||||
public Vector2 BaseBuckleOffset = Vector2.Zero;
|
||||
/// Use ambient sound component for the idle sound.
|
||||
|
||||
/// <summary>
|
||||
/// The sound that the horn makes
|
||||
/// </summary>
|
||||
[DataField("hornSound")] public SoundSpecifier? HornSound =
|
||||
new SoundPathSpecifier("/Audio/Effects/Vehicle/carhorn.ogg")
|
||||
{
|
||||
Params = AudioParams.Default.WithVolume(-3f)
|
||||
};
|
||||
/// <summary>
|
||||
/// The action for the horn (if any)
|
||||
/// </summary>
|
||||
[DataField("hornAction")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public InstantAction HornAction = new()
|
||||
{
|
||||
UseDelay = TimeSpan.FromSeconds(3.4),
|
||||
Icon = new SpriteSpecifier.Texture(new("Objects/Fun/bikehorn.rsi/icon.png")),
|
||||
DisplayName = "action-name-honk",
|
||||
Description = "action-desc-honk",
|
||||
Event = new HonkActionEvent(),
|
||||
};
|
||||
|
||||
public IPlayingAudioStream? HonkPlayingStream;
|
||||
/// <summary>
|
||||
/// Whether the vehicle has a key currently inside it or not.
|
||||
/// </summary>
|
||||
[DataField("hasKey")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool HasKey;
|
||||
|
||||
/// Use ambient sound component for the idle sound.
|
||||
/// <summary>
|
||||
/// Determines from which side the vehicle will be displayed on top of the player.
|
||||
/// </summary>
|
||||
|
||||
/// <summary>
|
||||
/// The action for the horn (if any)
|
||||
/// </summary>
|
||||
[DataField("hornAction")]
|
||||
public InstantAction HornAction = new()
|
||||
{
|
||||
UseDelay = TimeSpan.FromSeconds(3.4),
|
||||
Icon = new SpriteSpecifier.Texture(new("Objects/Fun/bikehorn.rsi/icon.png")),
|
||||
DisplayName = "action-name-honk",
|
||||
Description = "action-desc-honk",
|
||||
Event = new HonkActionEvent(),
|
||||
};
|
||||
[DataField("southOver")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool SouthOver;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the vehicle has a key currently inside it or not.
|
||||
/// </summary>
|
||||
[DataField("hasKey")]
|
||||
public bool HasKey = false;
|
||||
[DataField("northOver")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool NorthOver;
|
||||
|
||||
/// <summary>
|
||||
/// Determines from which side the vehicle will be displayed on top of the player.
|
||||
/// </summary>
|
||||
[DataField("westOver")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool WestOver;
|
||||
|
||||
[DataField("southOver")]
|
||||
public bool SouthOver = false;
|
||||
[DataField("eastOver")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool EastOver;
|
||||
|
||||
[DataField("northOver")]
|
||||
public bool NorthOver = false;
|
||||
/// <summary>
|
||||
/// What the y buckle offset should be in north / south
|
||||
/// </summary>
|
||||
[DataField("northOverride")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float NorthOverride;
|
||||
|
||||
[DataField("westOver")]
|
||||
public bool WestOver = false;
|
||||
/// <summary>
|
||||
/// What the y buckle offset should be in north / south
|
||||
/// </summary>
|
||||
[DataField("southOverride")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float SouthOverride;
|
||||
|
||||
[DataField("eastOver")]
|
||||
public bool EastOver = false;
|
||||
[DataField("autoAnimate")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool AutoAnimate = true;
|
||||
|
||||
/// <summary>
|
||||
/// What the y buckle offset should be in north / south
|
||||
/// </summary>
|
||||
[DataField("northOverride")]
|
||||
public float NorthOverride = 0f;
|
||||
|
||||
/// <summary>
|
||||
/// What the y buckle offset should be in north / south
|
||||
/// </summary>
|
||||
[DataField("southOverride")]
|
||||
public float SouthOverride = 0f;
|
||||
}
|
||||
[DataField("hideRider")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool HideRider;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user