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,50 @@
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
namespace Content.Shared.Nutrition.Components;
/// <summary>
/// Adds a "Shake" verb to the entity's verb menu.
/// Handles checking the entity can be shaken, displaying popups when shaking,
/// and raising a ShakeEvent when a shake occurs.
/// Reacting to being shaken is left up to other components.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class ShakeableComponent : Component
{
/// <summary>
/// How long it takes to shake this item.
/// </summary>
[DataField]
public TimeSpan ShakeDuration = TimeSpan.FromSeconds(1f);
/// <summary>
/// Does the entity need to be in the user's hand in order to be shaken?
/// </summary>
[DataField]
public bool RequireInHand;
/// <summary>
/// Label to display in the verbs menu for this item's shake action.
/// </summary>
[DataField]
public LocId ShakeVerbText = "shakeable-verb";
/// <summary>
/// Text that will be displayed to the user when shaking this item.
/// </summary>
[DataField]
public LocId ShakePopupMessageSelf = "shakeable-popup-message-self";
/// <summary>
/// Text that will be displayed to other users when someone shakes this item.
/// </summary>
[DataField]
public LocId ShakePopupMessageOthers = "shakeable-popup-message-others";
/// <summary>
/// The sound that will be played when shaking this item.
/// </summary>
[DataField]
public SoundSpecifier ShakeSound = new SoundPathSpecifier("/Audio/Items/soda_shake.ogg");
}