Add ability to shake fizzy drinks so they spray in peoples' faces (#25574)

* Implemented Shakeable

* Prevent shaking open Openables

* Prevent shaking empty drinks. Moved part of DrinkSystem to Shared.

* DrinkSystem can have a little more prediction, as a treat

* Cleanup

* Overhauled PressurizedDrink

* Make soda cans/bottles and champagne shakeable. The drink shaker too, for fun.

* We do a little refactoring.
PressurizedDrink is now PressurizedSolution, and fizziness now only works on solutions containing a reagent marked as fizzy.

* Documentation, cleanup, and tweaks.

* Changed fizziness calculation to use a cubic-out easing curve.

* Removed broken YAML that has avoid the linter's wrath for far too long

* Changed reagent fizzy bool to fizziness float.
Solution fizzability now scales with reagent proportion.

* Rename file to match changed class name

* DoAfter improvements. Cancel if the user moves away; block if no hands.

* Match these filenames too

* And this one

* guh

* Updated to use Shared puddle methods

* Various fixes and improvements.

* Made AttemptShakeEvent a struct

* AttemptAddFizzinessEvent too
This commit is contained in:
Tayrtahn
2024-04-17 21:49:58 -04:00
committed by GitHub
parent 8d64d2bc1e
commit cfa94be4c2
25 changed files with 807 additions and 146 deletions

View File

@@ -0,0 +1,43 @@
using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.FixedPoint;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
namespace Content.Shared.Nutrition.Components;
[NetworkedComponent, AutoGenerateComponentState]
[RegisterComponent, Access(typeof(SharedDrinkSystem))]
public sealed partial class DrinkComponent : Component
{
[DataField]
public string Solution = "drink";
[DataField, AutoNetworkedField]
public SoundSpecifier UseSound = new SoundPathSpecifier("/Audio/Items/drink.ogg");
[DataField, AutoNetworkedField]
public FixedPoint2 TransferAmount = FixedPoint2.New(5);
/// <summary>
/// How long it takes to drink this yourself.
/// </summary>
[DataField, AutoNetworkedField]
public float Delay = 1;
[DataField, AutoNetworkedField]
public bool Examinable = true;
/// <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]
public bool IgnoreEmpty;
/// <summary>
/// This is how many seconds it takes to force feed someone this drink.
/// </summary>
[DataField, AutoNetworkedField]
public float ForceFeedDelay = 3;
}