Openable refactor (#19750)

This commit is contained in:
deltanedas
2023-09-23 03:10:04 +01:00
committed by GitHub
parent 71ab660885
commit b7cff81587
33 changed files with 842 additions and 687 deletions

View File

@@ -1,54 +1,41 @@
using Content.Server.Nutrition.EntitySystems;
using Content.Shared.DoAfter;
using Content.Shared.FixedPoint;
using JetBrains.Annotations;
using Robust.Shared.Audio;
namespace Content.Server.Nutrition.Components
namespace Content.Server.Nutrition.Components;
[RegisterComponent, Access(typeof(DrinkSystem))]
public sealed partial class DrinkComponent : Component
{
[RegisterComponent]
[Access(typeof(DrinkSystem))]
public sealed partial class DrinkComponent : Component
{
[DataField("solution")]
public string SolutionName { get; set; } = DefaultSolutionName;
public const string DefaultSolutionName = "drink";
[DataField, ViewVariables(VVAccess.ReadWrite)]
public string Solution = "drink";
[DataField("useSound")]
public SoundSpecifier UseSound = new SoundPathSpecifier("/Audio/Items/drink.ogg");
[DataField]
public SoundSpecifier UseSound = new SoundPathSpecifier("/Audio/Items/drink.ogg");
[DataField("isOpen")]
internal bool DefaultToOpened;
[DataField, ViewVariables(VVAccess.ReadWrite)]
public FixedPoint2 TransferAmount = FixedPoint2.New(5);
[ViewVariables(VVAccess.ReadWrite)]
[DataField("transferAmount")]
public FixedPoint2 TransferAmount { get; [UsedImplicitly] private set; } = FixedPoint2.New(5);
/// <summary>
/// How long it takes to drink this yourself.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float Delay = 1;
[ViewVariables(VVAccess.ReadWrite)]
public bool Opened;
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool Examinable = true;
[DataField("openSounds")]
public SoundSpecifier OpenSounds = new SoundCollectionSpecifier("canOpenSounds");
/// <summary>
/// If true, trying to drink when empty will not handle the event.
/// This means other systems such as equipping on use can run.
/// Example usecase is the bucket.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool IgnoreEmpty;
[DataField("pressurized")]
public bool Pressurized;
[DataField("burstSound")]
public SoundSpecifier BurstSound = new SoundPathSpecifier("/Audio/Effects/flash_bang.ogg");
/// <summary>
/// How long it takes to drink this yourself.
/// </summary>
[DataField("delay")]
public float Delay = 1;
[DataField("examinable")]
public bool Examinable = true;
/// <summary>
/// This is how many seconds it takes to force feed someone this drink.
/// </summary>
[DataField("forceFeedDelay")]
public float ForceFeedDelay = 3;
}
/// <summary>
/// This is how many seconds it takes to force feed someone this drink.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float ForceFeedDelay = 3;
}