diff --git a/Content.Client/Nutrition/EntitySystems/DrinkSystem.cs b/Content.Client/Nutrition/EntitySystems/DrinkSystem.cs new file mode 100644 index 000000000000..16dbecb79361 --- /dev/null +++ b/Content.Client/Nutrition/EntitySystems/DrinkSystem.cs @@ -0,0 +1,7 @@ +using Content.Shared.Nutrition.EntitySystems; + +namespace Content.Client.Nutrition.EntitySystems; + +public sealed class DrinkSystem : SharedDrinkSystem +{ +} diff --git a/Content.Server/Nutrition/Components/PressurizedDrinkComponent.cs b/Content.Server/Nutrition/Components/PressurizedDrinkComponent.cs deleted file mode 100644 index aafb3bc1065f..000000000000 --- a/Content.Server/Nutrition/Components/PressurizedDrinkComponent.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Content.Server.Nutrition.EntitySystems; -using Robust.Shared.Audio; - -namespace Content.Server.Nutrition.Components; - -/// -/// Lets a drink burst open when thrown while closed. -/// Requires and to work. -/// -[RegisterComponent, Access(typeof(DrinkSystem))] -public sealed partial class PressurizedDrinkComponent : Component -{ - /// - /// Chance for the drink to burst when thrown while closed. - /// - [DataField, ViewVariables(VVAccess.ReadWrite)] - public float BurstChance = 0.25f; - - /// - /// Sound played when the drink bursts. - /// - [DataField] - public SoundSpecifier BurstSound = new SoundPathSpecifier("/Audio/Effects/flash_bang.ogg") - { - Params = AudioParams.Default.WithVolume(-4) - }; -} diff --git a/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs b/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs index 74637d481370..aa2ed71d8f36 100644 --- a/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs @@ -5,7 +5,6 @@ using Content.Server.Fluids.EntitySystems; using Content.Server.Forensics; using Content.Server.Inventory; -using Content.Server.Nutrition.Components; using Content.Server.Popups; using Content.Shared.Administration.Logs; using Content.Shared.Body.Components; @@ -16,7 +15,6 @@ using Content.Shared.Chemistry.Reagent; using Content.Shared.Database; using Content.Shared.DoAfter; -using Content.Shared.Examine; using Content.Shared.FixedPoint; using Content.Shared.IdentityManagement; using Content.Shared.Interaction; @@ -25,24 +23,21 @@ using Content.Shared.Nutrition; using Content.Shared.Nutrition.Components; using Content.Shared.Nutrition.EntitySystems; -using Content.Shared.Throwing; using Content.Shared.Verbs; using Robust.Shared.Audio; using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Prototypes; -using Robust.Shared.Random; using Robust.Shared.Utility; namespace Content.Server.Nutrition.EntitySystems; -public sealed class DrinkSystem : EntitySystem +public sealed class DrinkSystem : SharedDrinkSystem { [Dependency] private readonly BodySystem _body = default!; [Dependency] private readonly FlavorProfileSystem _flavorProfile = default!; [Dependency] private readonly FoodSystem _food = default!; [Dependency] private readonly IPrototypeManager _proto = default!; - [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly MobStateSystem _mobState = default!; [Dependency] private readonly OpenableSystem _openable = default!; @@ -66,33 +61,10 @@ public override void Initialize() SubscribeLocalEvent(OnDrinkInit); // run before inventory so for bucket it always tries to drink before equipping (when empty) // run after openable so its always open -> drink - SubscribeLocalEvent(OnUse, before: new[] { typeof(ServerInventorySystem) }, after: new[] { typeof(OpenableSystem) }); + SubscribeLocalEvent(OnUse, before: [typeof(ServerInventorySystem)], after: [typeof(OpenableSystem)]); SubscribeLocalEvent(AfterInteract); SubscribeLocalEvent>(AddDrinkVerb); - // put drink amount after opened - SubscribeLocalEvent(OnExamined, after: new[] { typeof(OpenableSystem) }); SubscribeLocalEvent(OnDoAfter); - - SubscribeLocalEvent(OnPressurizedDrinkLand); - } - - private FixedPoint2 DrinkVolume(EntityUid uid, DrinkComponent? component = null) - { - if (!Resolve(uid, ref component)) - return FixedPoint2.Zero; - - if (!_solutionContainer.TryGetSolution(uid, component.Solution, out _, out var sol)) - return FixedPoint2.Zero; - - return sol.Volume; - } - - public bool IsEmpty(EntityUid uid, DrinkComponent? component = null) - { - if (!Resolve(uid, ref component)) - return true; - - return DrinkVolume(uid, component) <= 0; } /// @@ -129,38 +101,6 @@ public float TotalHydration(EntityUid uid, DrinkComponent? comp = null) return total; } - private void OnExamined(Entity entity, ref ExaminedEvent args) - { - TryComp(entity, out var openable); - if (_openable.IsClosed(entity.Owner, null, openable) || !args.IsInDetailsRange || !entity.Comp.Examinable) - return; - - var empty = IsEmpty(entity, entity.Comp); - if (empty) - { - args.PushMarkup(Loc.GetString("drink-component-on-examine-is-empty")); - return; - } - - if (HasComp(entity)) - { - //provide exact measurement for beakers - args.PushText(Loc.GetString("drink-component-on-examine-exact-volume", ("amount", DrinkVolume(entity, entity.Comp)))); - } - else - { - //general approximation - var remainingString = (int) _solutionContainer.PercentFull(entity) switch - { - 100 => "drink-component-on-examine-is-full", - > 66 => "drink-component-on-examine-is-mostly-full", - > 33 => HalfEmptyOrHalfFull(args), - _ => "drink-component-on-examine-is-mostly-empty", - }; - args.PushMarkup(Loc.GetString(remainingString)); - } - } - private void AfterInteract(Entity entity, ref AfterInteractEvent args) { if (args.Handled || args.Target == null || !args.CanReach) @@ -177,25 +117,6 @@ private void OnUse(Entity entity, ref UseInHandEvent args) args.Handled = TryDrink(args.User, args.User, entity.Comp, entity); } - private void OnPressurizedDrinkLand(Entity entity, ref LandEvent args) - { - if (!TryComp(entity, out var drink) || !TryComp(entity, out var openable)) - return; - - if (!openable.Opened && - _random.Prob(entity.Comp.BurstChance) && - _solutionContainer.TryGetSolution(entity.Owner, drink.Solution, out var soln, out var interactions)) - { - // using SetOpen instead of TryOpen to not play 2 sounds - _openable.SetOpen(entity, true, openable); - - var solution = _solutionContainer.SplitSolution(soln.Value, interactions.Volume); - _puddle.TrySpillAt(entity, solution, out _); - - _audio.PlayPvs(entity.Comp.BurstSound, entity); - } - } - private void OnDrinkInit(Entity entity, ref ComponentInit args) { if (TryComp(entity, out var existingDrainable)) @@ -433,16 +354,4 @@ private void AddDrinkVerb(Entity entity, ref GetVerbsEvent(args.Examiner, out var examiner) && examiner.EntityName.Length > 0 - && string.Compare(examiner.EntityName.Substring(0, 1), "m", StringComparison.InvariantCultureIgnoreCase) > 0) - remainingString = "drink-component-on-examine-is-half-empty"; - - return remainingString; - } } diff --git a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs index 5d6d9d21208e..df1b1aa20b49 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs @@ -104,6 +104,13 @@ public sealed partial class ReagentPrototype : IPrototype, IInheritingPrototype [DataField] public bool Slippery; + /// + /// How easily this reagent becomes fizzy when aggitated. + /// 0 - completely flat, 1 - fizzes up when nudged. + /// + [DataField] + public float Fizziness; + /// /// How much reagent slows entities down if it's part of a puddle. /// 0 - no slowdown; 1 - can't move. diff --git a/Content.Server/Nutrition/Components/DrinkComponent.cs b/Content.Shared/Nutrition/Components/DrinkComponent.cs similarity index 66% rename from Content.Server/Nutrition/Components/DrinkComponent.cs rename to Content.Shared/Nutrition/Components/DrinkComponent.cs index 20d47cda88c9..17baaef5a37c 100644 --- a/Content.Server/Nutrition/Components/DrinkComponent.cs +++ b/Content.Shared/Nutrition/Components/DrinkComponent.cs @@ -1,28 +1,30 @@ -using Content.Server.Nutrition.EntitySystems; +using Content.Shared.Nutrition.EntitySystems; using Content.Shared.FixedPoint; using Robust.Shared.Audio; +using Robust.Shared.GameStates; -namespace Content.Server.Nutrition.Components; +namespace Content.Shared.Nutrition.Components; -[RegisterComponent, Access(typeof(DrinkSystem))] +[NetworkedComponent, AutoGenerateComponentState] +[RegisterComponent, Access(typeof(SharedDrinkSystem))] public sealed partial class DrinkComponent : Component { - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField] public string Solution = "drink"; - [DataField] + [DataField, AutoNetworkedField] public SoundSpecifier UseSound = new SoundPathSpecifier("/Audio/Items/drink.ogg"); - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField, AutoNetworkedField] public FixedPoint2 TransferAmount = FixedPoint2.New(5); /// /// How long it takes to drink this yourself. /// - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField, AutoNetworkedField] public float Delay = 1; - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField, AutoNetworkedField] public bool Examinable = true; /// @@ -30,12 +32,12 @@ public sealed partial class DrinkComponent : Component /// This means other systems such as equipping on use can run. /// Example usecase is the bucket. /// - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField] public bool IgnoreEmpty; /// /// This is how many seconds it takes to force feed someone this drink. /// - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField, AutoNetworkedField] public float ForceFeedDelay = 3; } diff --git a/Content.Shared/Nutrition/Components/PressurizedSolutionComponent.cs b/Content.Shared/Nutrition/Components/PressurizedSolutionComponent.cs new file mode 100644 index 000000000000..7060f3bf799c --- /dev/null +++ b/Content.Shared/Nutrition/Components/PressurizedSolutionComponent.cs @@ -0,0 +1,106 @@ +using Content.Shared.Nutrition.EntitySystems; +using Robust.Shared.Audio; +using Robust.Shared.GameStates; + +namespace Content.Shared.Nutrition.Components; + +/// +/// Represents a solution container that can hold the pressure from a solution that +/// gets fizzy when aggitated, and can spray the solution when opened or thrown. +/// Handles simulating the fizziness of the solution, responding to aggitating events, +/// and spraying the solution out when opening or throwing the entity. +/// +[NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] +[RegisterComponent, Access(typeof(PressurizedSolutionSystem))] +public sealed partial class PressurizedSolutionComponent : Component +{ + /// + /// The name of the solution to use. + /// + [DataField] + public string Solution = "drink"; + + /// + /// The sound to play when the solution sprays out of the container. + /// + [DataField] + public SoundSpecifier SpraySound = new SoundPathSpecifier("/Audio/Items/soda_spray.ogg"); + + /// + /// The longest amount of time that the solution can remain fizzy after being aggitated. + /// Put another way, how long the solution will remain fizzy when aggitated the maximum amount. + /// Used to calculate the current fizziness level. + /// + [DataField] + public TimeSpan FizzinessMaxDuration = TimeSpan.FromSeconds(120); + + /// + /// The time at which the solution will be fully settled after being shaken. + /// + [DataField, AutoNetworkedField, AutoPausedField] + public TimeSpan FizzySettleTime; + + /// + /// How much to increase the solution's fizziness each time it's shaken. + /// This assumes the solution has maximum fizzability. + /// A value of 1 will maximize it with a single shake, and a value of + /// 0.5 will increase it by half with each shake. + /// + [DataField] + public float FizzinessAddedOnShake = 1.0f; + + /// + /// How much to increase the solution's fizziness when it lands after being thrown. + /// This assumes the solution has maximum fizzability. + /// + [DataField] + public float FizzinessAddedOnLand = 0.25f; + + /// + /// How much to modify the chance of spraying when the entity is opened. + /// Increasing this effectively increases the fizziness value when checking if it should spray. + /// + [DataField] + public float SprayChanceModOnOpened = -0.01f; // Just enough to prevent spraying at 0 fizziness + + /// + /// How much to modify the chance of spraying when the entity is shaken. + /// Increasing this effectively increases the fizziness value when checking if it should spray. + /// + [DataField] + public float SprayChanceModOnShake = -1; // No spraying when shaken by default + + /// + /// How much to modify the chance of spraying when the entity lands after being thrown. + /// Increasing this effectively increases the fizziness value when checking if it should spray. + /// + [DataField] + public float SprayChanceModOnLand = 0.25f; + + /// + /// Holds the current randomly-rolled threshold value for spraying. + /// If fizziness exceeds this value when the entity is opened, it will spray. + /// By rolling this value when the entity is aggitated, we can have randomization + /// while still having prediction! + /// + [DataField, AutoNetworkedField] + public float SprayFizzinessThresholdRoll; + + /// + /// Popup message shown to user when sprayed by the solution. + /// + [DataField] + public LocId SprayHolderMessageSelf = "pressurized-solution-spray-holder-self"; + + /// + /// Popup message shown to others when a user is sprayed by the solution. + /// + [DataField] + public LocId SprayHolderMessageOthers = "pressurized-solution-spray-holder-others"; + + /// + /// Popup message shown above the entity when the solution sprays without a target. + /// + [DataField] + public LocId SprayGroundMessage = "pressurized-solution-spray-ground"; +} diff --git a/Content.Shared/Nutrition/Components/ShakeableComponent.cs b/Content.Shared/Nutrition/Components/ShakeableComponent.cs new file mode 100644 index 000000000000..cc1c08a9b232 --- /dev/null +++ b/Content.Shared/Nutrition/Components/ShakeableComponent.cs @@ -0,0 +1,50 @@ +using Robust.Shared.Audio; +using Robust.Shared.GameStates; + +namespace Content.Shared.Nutrition.Components; + +/// +/// 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. +/// +[RegisterComponent, NetworkedComponent] +public sealed partial class ShakeableComponent : Component +{ + /// + /// How long it takes to shake this item. + /// + [DataField] + public TimeSpan ShakeDuration = TimeSpan.FromSeconds(1f); + + /// + /// Does the entity need to be in the user's hand in order to be shaken? + /// + [DataField] + public bool RequireInHand; + + /// + /// Label to display in the verbs menu for this item's shake action. + /// + [DataField] + public LocId ShakeVerbText = "shakeable-verb"; + + /// + /// Text that will be displayed to the user when shaking this item. + /// + [DataField] + public LocId ShakePopupMessageSelf = "shakeable-popup-message-self"; + + /// + /// Text that will be displayed to other users when someone shakes this item. + /// + [DataField] + public LocId ShakePopupMessageOthers = "shakeable-popup-message-others"; + + /// + /// The sound that will be played when shaking this item. + /// + [DataField] + public SoundSpecifier ShakeSound = new SoundPathSpecifier("/Audio/Items/soda_shake.ogg"); +} diff --git a/Content.Shared/Nutrition/EntitySystems/OpenableSystem.cs b/Content.Shared/Nutrition/EntitySystems/OpenableSystem.cs index 0ad0877d2220..2934ced8b4a7 100644 --- a/Content.Shared/Nutrition/EntitySystems/OpenableSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/OpenableSystem.cs @@ -16,9 +16,9 @@ namespace Content.Shared.Nutrition.EntitySystems; /// public sealed partial class OpenableSystem : EntitySystem { - [Dependency] protected readonly SharedAppearanceSystem Appearance = default!; - [Dependency] protected readonly SharedAudioSystem Audio = default!; - [Dependency] protected readonly SharedPopupSystem Popup = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] private readonly SharedPopupSystem _popup = default!; public override void Initialize() { @@ -31,6 +31,8 @@ public override void Initialize() SubscribeLocalEvent(HandleIfClosed); SubscribeLocalEvent>(AddOpenCloseVerbs); SubscribeLocalEvent(OnTransferAttempt); + SubscribeLocalEvent(OnAttemptShake); + SubscribeLocalEvent(OnAttemptAddFizziness); } private void OnInit(EntityUid uid, OpenableComponent comp, ComponentInit args) @@ -100,6 +102,20 @@ private void OnTransferAttempt(Entity ent, ref SolutionTransf } } + private void OnAttemptShake(Entity entity, ref AttemptShakeEvent args) + { + // Prevent shaking open containers + if (entity.Comp.Opened) + args.Cancelled = true; + } + + private void OnAttemptAddFizziness(Entity entity, ref AttemptAddFizzinessEvent args) + { + // Can't add fizziness to an open container + if (entity.Comp.Opened) + args.Cancelled = true; + } + /// /// Returns true if the entity either does not have OpenableComponent or it is opened. /// Drinks that don't have OpenableComponent are automatically open, so it returns true. @@ -126,7 +142,7 @@ public bool IsClosed(EntityUid uid, EntityUid? user = null, OpenableComponent? c return false; if (user != null) - Popup.PopupEntity(Loc.GetString(comp.ClosedPopup, ("owner", uid)), user.Value, user.Value); + _popup.PopupEntity(Loc.GetString(comp.ClosedPopup, ("owner", uid)), user.Value, user.Value); return true; } @@ -139,13 +155,13 @@ public void UpdateAppearance(EntityUid uid, OpenableComponent? comp = null, Appe if (!Resolve(uid, ref comp)) return; - Appearance.SetData(uid, OpenableVisuals.Opened, comp.Opened, appearance); + _appearance.SetData(uid, OpenableVisuals.Opened, comp.Opened, appearance); } /// /// Sets the opened field and updates open visuals. /// - public void SetOpen(EntityUid uid, bool opened = true, OpenableComponent? comp = null) + public void SetOpen(EntityUid uid, bool opened = true, OpenableComponent? comp = null, EntityUid? user = null) { if (!Resolve(uid, ref comp, false) || opened == comp.Opened) return; @@ -155,12 +171,12 @@ public void SetOpen(EntityUid uid, bool opened = true, OpenableComponent? comp = if (opened) { - var ev = new OpenableOpenedEvent(); + var ev = new OpenableOpenedEvent(user); RaiseLocalEvent(uid, ref ev); } else { - var ev = new OpenableClosedEvent(); + var ev = new OpenableClosedEvent(user); RaiseLocalEvent(uid, ref ev); } @@ -176,8 +192,8 @@ public bool TryOpen(EntityUid uid, OpenableComponent? comp = null, EntityUid? us if (!Resolve(uid, ref comp, false) || comp.Opened) return false; - SetOpen(uid, true, comp); - Audio.PlayPredicted(comp.Sound, uid, user); + SetOpen(uid, true, comp, user); + _audio.PlayPredicted(comp.Sound, uid, user); return true; } @@ -190,9 +206,9 @@ public bool TryClose(EntityUid uid, OpenableComponent? comp = null, EntityUid? u if (!Resolve(uid, ref comp, false) || !comp.Opened || !comp.Closeable) return false; - SetOpen(uid, false, comp); + SetOpen(uid, false, comp, user); if (comp.CloseSound != null) - Audio.PlayPredicted(comp.CloseSound, uid, user); + _audio.PlayPredicted(comp.CloseSound, uid, user); return true; } } @@ -201,10 +217,10 @@ public bool TryClose(EntityUid uid, OpenableComponent? comp = null, EntityUid? u /// Raised after an Openable is opened. /// [ByRefEvent] -public record struct OpenableOpenedEvent; +public record struct OpenableOpenedEvent(EntityUid? User = null); /// /// Raised after an Openable is closed. /// [ByRefEvent] -public record struct OpenableClosedEvent; +public record struct OpenableClosedEvent(EntityUid? User = null); diff --git a/Content.Shared/Nutrition/EntitySystems/PressurizedSolutionSystem.cs b/Content.Shared/Nutrition/EntitySystems/PressurizedSolutionSystem.cs new file mode 100644 index 000000000000..d63b8e7326c9 --- /dev/null +++ b/Content.Shared/Nutrition/EntitySystems/PressurizedSolutionSystem.cs @@ -0,0 +1,285 @@ +using Content.Shared.Chemistry.Reagent; +using Content.Shared.Chemistry.EntitySystems; +using Content.Shared.Hands.EntitySystems; +using Content.Shared.Nutrition.Components; +using Content.Shared.Throwing; +using Content.Shared.IdentityManagement; +using Robust.Shared.Audio.Systems; +using Robust.Shared.Random; +using Robust.Shared.Timing; +using Robust.Shared.Prototypes; +using Robust.Shared.Network; +using Content.Shared.Fluids; +using Content.Shared.Popups; + +namespace Content.Shared.Nutrition.EntitySystems; + +public sealed partial class PressurizedSolutionSystem : EntitySystem +{ + [Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!; + [Dependency] private readonly OpenableSystem _openable = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] private readonly SharedHandsSystem _hands = default!; + [Dependency] private readonly SharedPopupSystem _popup = default!; + [Dependency] private readonly SharedPuddleSystem _puddle = default!; + [Dependency] private readonly INetManager _net = default!; + [Dependency] private readonly IGameTiming _timing = default!; + [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnMapInit); + SubscribeLocalEvent(OnShake); + SubscribeLocalEvent(OnOpened); + SubscribeLocalEvent(OnLand); + SubscribeLocalEvent(OnSolutionUpdate); + } + + /// + /// Helper method for checking if the solution's fizziness is high enough to spray. + /// is added to the actual fizziness for the comparison. + /// + private bool SprayCheck(Entity entity, float chanceMod = 0) + { + return Fizziness((entity, entity.Comp)) + chanceMod > entity.Comp.SprayFizzinessThresholdRoll; + } + + /// + /// Calculates how readily the contained solution becomes fizzy. + /// + private float SolutionFizzability(Entity entity) + { + if (!_solutionContainer.TryGetSolution(entity.Owner, entity.Comp.Solution, out var _, out var solution)) + return 0; + + // An empty solution can't be fizzy + if (solution.Volume <= 0) + return 0; + + var totalFizzability = 0f; + + // Check each reagent in the solution + foreach (var reagent in solution.Contents) + { + if (_prototypeManager.TryIndex(reagent.Reagent.Prototype, out ReagentPrototype? reagentProto) && reagentProto != null) + { + // What portion of the solution is this reagent? + var proportion = (float) (reagent.Quantity / solution.Volume); + totalFizzability += reagentProto.Fizziness * proportion; + } + } + + return totalFizzability; + } + + /// + /// Increases the fizziness level of the solution by the given amount, + /// scaled by the solution's fizzability. + /// 0 will result in no change, and 1 will maximize fizziness. + /// Also rerolls the spray threshold. + /// + private void AddFizziness(Entity entity, float amount) + { + var fizzability = SolutionFizzability(entity); + + // Can't add fizziness if the solution isn't fizzy + if (fizzability <= 0) + return; + + // Make sure nothing is preventing fizziness from being added + var attemptEv = new AttemptAddFizzinessEvent(entity, amount); + RaiseLocalEvent(entity, ref attemptEv); + if (attemptEv.Cancelled) + return; + + // Scale added fizziness by the solution's fizzability + amount *= fizzability; + + // Convert fizziness to time + var duration = amount * entity.Comp.FizzinessMaxDuration; + + // Add to the existing settle time, if one exists. Otherwise, add to the current time + var start = entity.Comp.FizzySettleTime > _timing.CurTime ? entity.Comp.FizzySettleTime : _timing.CurTime; + var newTime = start + duration; + + // Cap the maximum fizziness + var maxEnd = _timing.CurTime + entity.Comp.FizzinessMaxDuration; + if (newTime > maxEnd) + newTime = maxEnd; + + entity.Comp.FizzySettleTime = newTime; + + // Roll a new fizziness threshold + RollSprayThreshold(entity); + } + + /// + /// Helper method. Performs a . If it passes, calls . If it fails, . + /// + private void SprayOrAddFizziness(Entity entity, float chanceMod = 0, float fizzinessToAdd = 0, EntityUid? user = null) + { + if (SprayCheck(entity, chanceMod)) + TrySpray((entity, entity.Comp), user); + else + AddFizziness(entity, fizzinessToAdd); + } + + /// + /// Randomly generates a new spray threshold. + /// This is the value used to compare fizziness against when doing . + /// Since RNG will give different results between client and server, this is run on the server + /// and synced to the client by marking the component dirty. + /// We roll this in advance, rather than during , so that the value (hopefully) + /// has time to get synced to the client, so we can try be accurate with prediction. + /// + private void RollSprayThreshold(Entity entity) + { + // Can't predict random, so we wait for the server to tell us + if (!_net.IsServer) + return; + + entity.Comp.SprayFizzinessThresholdRoll = _random.NextFloat(); + Dirty(entity, entity.Comp); + } + + #region Public API + + /// + /// Does the entity contain a solution capable of being fizzy? + /// + public bool CanSpray(Entity entity) + { + if (!Resolve(entity, ref entity.Comp, false)) + return false; + + return SolutionFizzability((entity, entity.Comp)) > 0; + } + + /// + /// Attempts to spray the solution onto the given entity, or the ground if none is given. + /// Fails if the solution isn't able to be sprayed. + /// + public bool TrySpray(Entity entity, EntityUid? target = null) + { + if (!Resolve(entity, ref entity.Comp)) + return false; + + if (!CanSpray(entity)) + return false; + + if (!_solutionContainer.TryGetSolution(entity.Owner, entity.Comp.Solution, out var soln, out var interactions)) + return false; + + // If the container is openable, open it + _openable.SetOpen(entity, true); + + // Get the spray solution from the container + var solution = _solutionContainer.SplitSolution(soln.Value, interactions.Volume); + + // Spray the solution onto the ground and anyone nearby + if (TryComp(entity, out var transform)) + _puddle.TrySplashSpillAt(entity, transform.Coordinates, solution, out _, sound: false); + + var drinkName = Identity.Entity(entity, EntityManager); + + if (target != null) + { + var victimName = Identity.Entity(target.Value, EntityManager); + + var selfMessage = Loc.GetString(entity.Comp.SprayHolderMessageSelf, ("victim", victimName), ("drink", drinkName)); + var othersMessage = Loc.GetString(entity.Comp.SprayHolderMessageOthers, ("victim", victimName), ("drink", drinkName)); + _popup.PopupPredicted(selfMessage, othersMessage, target.Value, target.Value); + } + else + { + // Show a popup to everyone in PVS range + if (_timing.IsFirstTimePredicted) + _popup.PopupEntity(Loc.GetString(entity.Comp.SprayGroundMessage, ("drink", drinkName)), entity); + } + + _audio.PlayPredicted(entity.Comp.SpraySound, entity, target); + + // We just used all our fizziness, so clear it + TryClearFizziness(entity); + + return true; + } + + /// + /// What is the current fizziness level of the solution, from 0 to 1? + /// + public double Fizziness(Entity entity) + { + // No component means no fizz + if (!Resolve(entity, ref entity.Comp, false)) + return 0; + + // No negative fizziness + if (entity.Comp.FizzySettleTime <= _timing.CurTime) + return 0; + + var currentDuration = entity.Comp.FizzySettleTime - _timing.CurTime; + return Easings.InOutCubic((float) Math.Min(currentDuration / entity.Comp.FizzinessMaxDuration, 1)); + } + + /// + /// Attempts to clear any fizziness in the solution. + /// + /// Rolls a new spray threshold. + public void TryClearFizziness(Entity entity) + { + if (!Resolve(entity, ref entity.Comp)) + return; + + entity.Comp.FizzySettleTime = TimeSpan.Zero; + + // Roll a new fizziness threshold + RollSprayThreshold((entity, entity.Comp)); + } + + #endregion + + #region Event Handlers + private void OnMapInit(Entity entity, ref MapInitEvent args) + { + RollSprayThreshold(entity); + } + + private void OnOpened(Entity entity, ref OpenableOpenedEvent args) + { + // Make sure the opener is actually holding the drink + var held = args.User != null && _hands.IsHolding(args.User.Value, entity, out _); + + SprayOrAddFizziness(entity, entity.Comp.SprayChanceModOnOpened, -1, held ? args.User : null); + } + + private void OnShake(Entity entity, ref ShakeEvent args) + { + SprayOrAddFizziness(entity, entity.Comp.SprayChanceModOnShake, entity.Comp.FizzinessAddedOnShake, args.Shaker); + } + + private void OnLand(Entity entity, ref LandEvent args) + { + SprayOrAddFizziness(entity, entity.Comp.SprayChanceModOnLand, entity.Comp.FizzinessAddedOnLand); + } + + private void OnSolutionUpdate(Entity entity, ref SolutionContainerChangedEvent args) + { + if (args.SolutionId != entity.Comp.Solution) + return; + + // If the solution is no longer capable of being fizzy, clear any built up fizziness + if (SolutionFizzability(entity) <= 0) + TryClearFizziness((entity, entity.Comp)); + } + + #endregion +} + +[ByRefEvent] +public record struct AttemptAddFizzinessEvent(Entity Entity, float Amount) +{ + public bool Cancelled; +} diff --git a/Content.Shared/Nutrition/EntitySystems/ShakeableSystem.cs b/Content.Shared/Nutrition/EntitySystems/ShakeableSystem.cs new file mode 100644 index 000000000000..39890aada93b --- /dev/null +++ b/Content.Shared/Nutrition/EntitySystems/ShakeableSystem.cs @@ -0,0 +1,155 @@ +using Content.Shared.DoAfter; +using Content.Shared.Hands.EntitySystems; +using Content.Shared.IdentityManagement; +using Content.Shared.Nutrition.Components; +using Content.Shared.Popups; +using Content.Shared.Verbs; +using Robust.Shared.Audio.Systems; +using Robust.Shared.Serialization; + +namespace Content.Shared.Nutrition.EntitySystems; + +public sealed partial class ShakeableSystem : EntitySystem +{ + [Dependency] private readonly SharedPopupSystem _popup = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] private readonly SharedDoAfterSystem _doAfter = default!; + [Dependency] private readonly SharedHandsSystem _hands = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent>(AddShakeVerb); + SubscribeLocalEvent(OnShakeDoAfter); + } + + private void AddShakeVerb(EntityUid uid, ShakeableComponent component, GetVerbsEvent args) + { + if (args.Hands == null || !args.CanAccess || !args.CanInteract) + return; + + if (!CanShake((uid, component), args.User)) + return; + + var shakeVerb = new Verb() + { + Text = Loc.GetString(component.ShakeVerbText), + Act = () => TryStartShake((args.Target, component), args.User) + }; + args.Verbs.Add(shakeVerb); + } + + private void OnShakeDoAfter(Entity entity, ref ShakeDoAfterEvent args) + { + if (args.Handled || args.Cancelled) + return; + + TryShake((entity, entity.Comp), args.User); + } + + /// + /// Attempts to start the doAfter to shake the entity. + /// Fails and returns false if the entity cannot be shaken for any reason. + /// If successful, displays popup messages, plays shake sound, and starts the doAfter. + /// + public bool TryStartShake(Entity entity, EntityUid user) + { + if (!Resolve(entity, ref entity.Comp)) + return false; + + if (!CanShake(entity, user)) + return false; + + var doAfterArgs = new DoAfterArgs(EntityManager, + user, + entity.Comp.ShakeDuration, + new ShakeDoAfterEvent(), + eventTarget: entity, + target: user, + used: entity) + { + NeedHand = true, + BreakOnDamage = true, + DistanceThreshold = 1, + MovementThreshold = 0.01f, + BreakOnHandChange = entity.Comp.RequireInHand, + }; + if (entity.Comp.RequireInHand) + doAfterArgs.BreakOnHandChange = true; + + if (!_doAfter.TryStartDoAfter(doAfterArgs)) + return false; + + var userName = Identity.Entity(user, EntityManager); + var shakeableName = Identity.Entity(entity, EntityManager); + + var selfMessage = Loc.GetString(entity.Comp.ShakePopupMessageSelf, ("user", userName), ("shakeable", shakeableName)); + var othersMessage = Loc.GetString(entity.Comp.ShakePopupMessageOthers, ("user", userName), ("shakeable", shakeableName)); + _popup.PopupPredicted(selfMessage, othersMessage, user, user); + + _audio.PlayPredicted(entity.Comp.ShakeSound, entity, user); + + return true; + } + + /// + /// Attempts to shake the entity, skipping the doAfter. + /// Fails and returns false if the entity cannot be shaken for any reason. + /// If successful, raises a ShakeEvent on the entity. + /// + public bool TryShake(Entity entity, EntityUid? user = null) + { + if (!Resolve(entity, ref entity.Comp)) + return false; + + if (!CanShake(entity, user)) + return false; + + var ev = new ShakeEvent(user); + RaiseLocalEvent(entity, ref ev); + + return true; + } + + + /// + /// Is it possible for the given user to shake the entity? + /// + public bool CanShake(Entity entity, EntityUid? user = null) + { + if (!Resolve(entity, ref entity.Comp, false)) + return false; + + // If required to be in hand, fail if the user is not holding this entity + if (user != null && entity.Comp.RequireInHand && !_hands.IsHolding(user.Value, entity, out _)) + return false; + + var attemptEv = new AttemptShakeEvent(); + RaiseLocalEvent(entity, ref attemptEv); + if (attemptEv.Cancelled) + return false; + return true; + } +} + +/// +/// Raised when a ShakeableComponent is shaken, after the doAfter completes. +/// +[ByRefEvent] +public record struct ShakeEvent(EntityUid? Shaker); + +/// +/// Raised when trying to shake a ShakeableComponent. If cancelled, the +/// entity will not be shaken. +/// +[ByRefEvent] +public record struct AttemptShakeEvent() +{ + public bool Cancelled; +} + +[Serializable, NetSerializable] +public sealed partial class ShakeDoAfterEvent : SimpleDoAfterEvent +{ +} diff --git a/Content.Shared/Nutrition/EntitySystems/SharedDrinkSystem.cs b/Content.Shared/Nutrition/EntitySystems/SharedDrinkSystem.cs new file mode 100644 index 000000000000..7cae3b920866 --- /dev/null +++ b/Content.Shared/Nutrition/EntitySystems/SharedDrinkSystem.cs @@ -0,0 +1,90 @@ +using Content.Shared.Chemistry.Components.SolutionManager; +using Content.Shared.Chemistry.EntitySystems; +using Content.Shared.Examine; +using Content.Shared.FixedPoint; +using Content.Shared.Nutrition.Components; + +namespace Content.Shared.Nutrition.EntitySystems; + +public abstract partial class SharedDrinkSystem : EntitySystem +{ + [Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!; + [Dependency] private readonly OpenableSystem _openable = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnAttemptShake); + SubscribeLocalEvent(OnExamined); + } + + protected void OnAttemptShake(Entity entity, ref AttemptShakeEvent args) + { + if (IsEmpty(entity, entity.Comp)) + args.Cancelled = true; + } + + protected void OnExamined(Entity entity, ref ExaminedEvent args) + { + TryComp(entity, out var openable); + if (_openable.IsClosed(entity.Owner, null, openable) || !args.IsInDetailsRange || !entity.Comp.Examinable) + return; + + var empty = IsEmpty(entity, entity.Comp); + if (empty) + { + args.PushMarkup(Loc.GetString("drink-component-on-examine-is-empty")); + return; + } + + if (HasComp(entity)) + { + //provide exact measurement for beakers + args.PushText(Loc.GetString("drink-component-on-examine-exact-volume", ("amount", DrinkVolume(entity, entity.Comp)))); + } + else + { + //general approximation + var remainingString = (int) _solutionContainer.PercentFull(entity) switch + { + 100 => "drink-component-on-examine-is-full", + > 66 => "drink-component-on-examine-is-mostly-full", + > 33 => HalfEmptyOrHalfFull(args), + _ => "drink-component-on-examine-is-mostly-empty", + }; + args.PushMarkup(Loc.GetString(remainingString)); + } + } + + protected FixedPoint2 DrinkVolume(EntityUid uid, DrinkComponent? component = null) + { + if (!Resolve(uid, ref component)) + return FixedPoint2.Zero; + + if (!_solutionContainer.TryGetSolution(uid, component.Solution, out _, out var sol)) + return FixedPoint2.Zero; + + return sol.Volume; + } + + protected bool IsEmpty(EntityUid uid, DrinkComponent? component = null) + { + if (!Resolve(uid, ref component)) + return true; + + return DrinkVolume(uid, component) <= 0; + } + + // some see half empty, and others see half full + private string HalfEmptyOrHalfFull(ExaminedEvent args) + { + string remainingString = "drink-component-on-examine-is-half-full"; + + if (TryComp(args.Examiner, out var examiner) && examiner.EntityName.Length > 0 + && string.Compare(examiner.EntityName.Substring(0, 1), "m", StringComparison.InvariantCultureIgnoreCase) > 0) + remainingString = "drink-component-on-examine-is-half-empty"; + + return remainingString; + } +} diff --git a/Resources/Audio/Items/attributions.yml b/Resources/Audio/Items/attributions.yml index c6fea50bd250..675e4fff24ed 100644 --- a/Resources/Audio/Items/attributions.yml +++ b/Resources/Audio/Items/attributions.yml @@ -93,6 +93,16 @@ copyright: "User Hanbaal on freesound.org. Converted to ogg by TheShuEd" source: "https://freesound.org/people/Hanbaal/sounds/178669/" +- files: ["soda_shake.ogg"] + license: "CC-BY-NC-4.0" + copyright: "User mcmast on freesound.org. Converted and edited by Tayrtahn" + source: "https://freesound.org/people/mcmast/sounds/456703/" + +- files: ["soda_spray.ogg"] + license: "CC0-1.0" + copyright: "User Hajisounds on freesound.org. Converted and edited by Tayrtahn" + source: "https://freesound.org/people/Hajisounds/sounds/709149/" + - files: ["newton_cradle.ogg"] license: "CC-BY-4.0" copyright: "User LoafDV on freesound.org. Converted to ogg end edited by lzk228" diff --git a/Resources/Audio/Items/soda_shake.ogg b/Resources/Audio/Items/soda_shake.ogg new file mode 100644 index 000000000000..a596379c93a8 Binary files /dev/null and b/Resources/Audio/Items/soda_shake.ogg differ diff --git a/Resources/Audio/Items/soda_spray.ogg b/Resources/Audio/Items/soda_spray.ogg new file mode 100644 index 000000000000..f4a5a3e803f0 Binary files /dev/null and b/Resources/Audio/Items/soda_spray.ogg differ diff --git a/Resources/Locale/en-US/nutrition/components/pressurized-solution-component.ftl b/Resources/Locale/en-US/nutrition/components/pressurized-solution-component.ftl new file mode 100644 index 000000000000..a227d811f6e9 --- /dev/null +++ b/Resources/Locale/en-US/nutrition/components/pressurized-solution-component.ftl @@ -0,0 +1,3 @@ +pressurized-solution-spray-holder-self = { CAPITALIZE(THE($drink)) } sprays on you! +pressurized-solution-spray-holder-others = { CAPITALIZE(THE($drink)) } sprays on { THE($victim) }! +pressurized-solution-spray-ground = The contents of { THE($drink) } spray out! diff --git a/Resources/Locale/en-US/nutrition/components/shakeable-component.ftl b/Resources/Locale/en-US/nutrition/components/shakeable-component.ftl new file mode 100644 index 000000000000..acc1ecd8489c --- /dev/null +++ b/Resources/Locale/en-US/nutrition/components/shakeable-component.ftl @@ -0,0 +1,3 @@ +shakeable-verb = Shake +shakeable-popup-message-others = { CAPITALIZE(THE($user)) } shakes { THE($shakeable) } +shakeable-popup-message-self = You shake { THE($shakeable) } diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks-cartons.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks-cartons.yml index d60134fce0eb..aef0c5a8f5ad 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks-cartons.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks-cartons.yml @@ -15,6 +15,9 @@ solutions: drink: maxVol: 50 + - type: PressurizedSolution + solution: drink + - type: Shakeable - type: Sprite state: icon - type: Item diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_bottles.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_bottles.yml index 0c7707c5f205..73b1e06f9bbb 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_bottles.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_bottles.yml @@ -39,6 +39,9 @@ - type: PhysicalComposition materialComposition: Plastic: 100 + - type: PressurizedSolution + solution: drink + - type: Shakeable - type: entity parent: DrinkBottlePlasticBaseFull diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml index 585e5ed14d91..7dcd3fa6039e 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml @@ -6,7 +6,7 @@ components: - type: Drink - type: Openable - - type: PressurizedDrink + - type: Shakeable - type: SolutionContainerManager solutions: drink: @@ -34,6 +34,8 @@ solution: drink - type: DrainableSolution solution: drink + - type: PressurizedSolution + solution: drink - type: Appearance - type: GenericVisualizer visuals: diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_fun.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_fun.yml index 2fd2331f91ef..ef6208b69d40 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_fun.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_fun.yml @@ -146,6 +146,9 @@ - type: RandomFillSolution solution: drink weightedRandomId: RandomFillMopwata + - type: PressurizedSolution + solution: drink + - type: Shakeable - type: Appearance - type: GenericVisualizer visuals: diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_special.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_special.yml index c80398e34966..a7f1bdbec6bc 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_special.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_special.yml @@ -9,6 +9,7 @@ drink: maxVol: 100 - type: Drink + - type: Shakeable # Doesn't do anything, but I mean... - type: FitsInDispenser solution: drink - type: DrawableSolution diff --git a/Resources/Prototypes/Reagents/Consumable/Drink/alcohol.yml b/Resources/Prototypes/Reagents/Consumable/Drink/alcohol.yml index 44eba0f848c7..ef0216116552 100644 --- a/Resources/Prototypes/Reagents/Consumable/Drink/alcohol.yml +++ b/Resources/Prototypes/Reagents/Consumable/Drink/alcohol.yml @@ -39,6 +39,7 @@ metamorphicMaxFillLevels: 5 metamorphicFillBaseName: fill- metamorphicChangeColor: false + fizziness: 0.6 - type: reagent id: Beer @@ -55,6 +56,7 @@ metamorphicMaxFillLevels: 6 metamorphicFillBaseName: fill- metamorphicChangeColor: true + fizziness: 0.6 - type: reagent id: BlueCuracao @@ -458,6 +460,7 @@ - !type:AdjustReagent reagent: Ethanol amount: 0.3 + fizziness: 0.8 # Mixed Alcohol @@ -675,6 +678,7 @@ - !type:AdjustReagent reagent: Ethanol amount: 0.15 + fizziness: 0.3 - type: reagent id: BlackRussian @@ -814,6 +818,7 @@ - !type:AdjustReagent reagent: Ethanol amount: 0.07 + fizziness: 0.2 - type: reagent id: DemonsBlood @@ -829,6 +834,7 @@ metamorphicMaxFillLevels: 4 metamorphicFillBaseName: fill- metamorphicChangeColor: true + fizziness: 0.3 - type: reagent id: DevilsKiss @@ -916,6 +922,7 @@ metamorphicMaxFillLevels: 5 metamorphicFillBaseName: fill- metamorphicChangeColor: true + fizziness: 0.15 - type: reagent id: GargleBlaster @@ -962,6 +969,7 @@ - !type:AdjustReagent reagent: Ethanol amount: 0.07 + fizziness: 0.4 # A little high, but it has fizz in the name - type: reagent id: GinTonic @@ -985,6 +993,7 @@ - !type:AdjustReagent reagent: Ethanol amount: 0.07 + fizziness: 0.4 - type: reagent id: Gildlager @@ -1062,6 +1071,7 @@ metamorphicMaxFillLevels: 6 metamorphicFillBaseName: fill- metamorphicChangeColor: false + fizziness: 0.6 - type: reagent id: IrishCarBomb @@ -1199,6 +1209,7 @@ metamorphicMaxFillLevels: 2 metamorphicFillBaseName: fill- metamorphicChangeColor: false + fizziness: 0.7 - type: reagent id: Margarita @@ -1252,6 +1263,7 @@ metamorphicMaxFillLevels: 5 metamorphicFillBaseName: fill- metamorphicChangeColor: true + fizziness: 0.4 - type: reagent id: Mojito @@ -1267,6 +1279,7 @@ metamorphicMaxFillLevels: 6 metamorphicFillBaseName: fill- metamorphicChangeColor: false + fizziness: 0.3 - type: reagent id: Moonshine @@ -1371,6 +1384,7 @@ metamorphicMaxFillLevels: 5 metamorphicFillBaseName: fill- metamorphicChangeColor: true + fizziness: 0.4 - type: reagent id: PinaColada @@ -1500,6 +1514,7 @@ metamorphicMaxFillLevels: 6 metamorphicFillBaseName: fill- metamorphicChangeColor: true + fizziness: 0.3 - type: reagent id: SuiDream @@ -1515,6 +1530,7 @@ metamorphicMaxFillLevels: 5 metamorphicFillBaseName: fill- metamorphicChangeColor: false + fizziness: 0.2 - type: reagent id: SyndicateBomb @@ -1530,6 +1546,7 @@ metamorphicMaxFillLevels: 6 metamorphicFillBaseName: fill- metamorphicChangeColor: true + fizziness: 0.6 - type: reagent id: TequilaSunrise @@ -1568,6 +1585,7 @@ metamorphicMaxFillLevels: 3 metamorphicFillBaseName: fill- metamorphicChangeColor: false + fizziness: 0.2 - type: reagent id: ThreeMileIsland @@ -1655,6 +1673,7 @@ - !type:AdjustReagent reagent: Ethanol amount: 0.07 + fizziness: 0.4 - type: reagent id: WhiskeyCola @@ -1678,6 +1697,7 @@ - !type:AdjustReagent reagent: Ethanol amount: 0.07 + fizziness: 0.3 - type: reagent id: WhiskeySoda @@ -1701,6 +1721,7 @@ - !type:AdjustReagent reagent: Ethanol amount: 0.07 + fizziness: 0.4 - type: reagent id: WhiteGilgamesh @@ -1718,6 +1739,7 @@ - !type:AdjustReagent reagent: Ethanol amount: 0.15 + fizziness: 0.5 - type: reagent id: WhiteRussian diff --git a/Resources/Prototypes/Reagents/Consumable/Drink/base_drink.yml b/Resources/Prototypes/Reagents/Consumable/Drink/base_drink.yml index 9984b4c0cf67..19a5e1bf8f15 100644 --- a/Resources/Prototypes/Reagents/Consumable/Drink/base_drink.yml +++ b/Resources/Prototypes/Reagents/Consumable/Drink/base_drink.yml @@ -40,6 +40,7 @@ collection: FootstepSticky params: volume: 6 + fizziness: 0.5 - type: reagent id: BaseAlcohol @@ -75,4 +76,4 @@ footstepSound: collection: FootstepSticky params: - volume: 6 \ No newline at end of file + volume: 6 diff --git a/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml b/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml index 5c09b3c909b5..71de67adb990 100644 --- a/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml +++ b/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml @@ -322,6 +322,7 @@ damage: types: Poison: 1 + fizziness: 0.5 - type: reagent id: SodaWater @@ -331,6 +332,7 @@ physicalDesc: reagent-physical-desc-fizzy flavor: fizzy color: "#619494" + fizziness: 0.8 - type: reagent id: SoyLatte @@ -373,6 +375,7 @@ physicalDesc: reagent-physical-desc-fizzy flavor: tonicwater color: "#0064C8" + fizziness: 0.4 - type: reagent id: Water @@ -467,6 +470,7 @@ effects: - !type:SatiateThirst factor: 1 + fizziness: 0.3 - type: reagent id: Posca @@ -491,6 +495,7 @@ metamorphicMaxFillLevels: 3 metamorphicFillBaseName: fill- metamorphicChangeColor: false + fizziness: 0.3 - type: reagent id: Rewriter @@ -506,6 +511,7 @@ metamorphicMaxFillLevels: 5 metamorphicFillBaseName: fill- metamorphicChangeColor: true + fizziness: 0.3 - type: reagent id: Mopwata diff --git a/Resources/Prototypes/Reagents/Consumable/Drink/soda.yml b/Resources/Prototypes/Reagents/Consumable/Drink/soda.yml index ba5adc4f2aec..3dda5b5329ac 100644 --- a/Resources/Prototypes/Reagents/Consumable/Drink/soda.yml +++ b/Resources/Prototypes/Reagents/Consumable/Drink/soda.yml @@ -59,6 +59,7 @@ - !type:AdjustReagent reagent: Theobromine amount: 0.05 + fizziness: 0.4 - type: reagent id: GrapeSoda @@ -84,6 +85,7 @@ metamorphicMaxFillLevels: 5 metamorphicFillBaseName: fill- metamorphicChangeColor: true + fizziness: 0 - type: reagent id: LemonLime @@ -102,6 +104,7 @@ physicalDesc: reagent-physical-desc-fizzy flavor: pwrgamesoda color: "#9385bf" + fizziness: 0.9 # gamers crave the fizz - type: reagent id: RootBeer @@ -132,6 +135,7 @@ metamorphicMaxFillLevels: 7 metamorphicFillBaseName: fill- metamorphicChangeColor: false + fizziness: 0.4 - type: reagent id: SolDry