adds the ability to "mix" solutions (reactions caused by using an item on a solution holder) (#13015)

* everything for mixing aside from yaml changes

* add recipe and canmix to bottles and the holy mixer tag to the bible

* fixes as a result of testing

* remove unused usings

* remove emptylines that are not required

Co-authored-by: 0x6273 <0x40@keemail.me>

* more empty line removal!

Co-authored-by: 0x6273 <0x40@keemail.me>

* add single space between if statement and condition

Co-authored-by: 0x6273 <0x40@keemail.me>

* fixes indentation on TryGetMixableSolution

* raise new AfterMixingEvent after attempting to mix a solution

* before mixing event and attempt get mixable solution event

* update reaction tests to be a beaker that can be mixed, and then pass a mixer component in to simulate mixing

* make two more beaker types mixable, add attribute for mixing feedback

* bible mix message

* mixing feedback on success

* updates test to use SpawnEntity over new as per feedback

Co-authored-by: 0x6273 <0x40@keemail.me>
This commit is contained in:
Timothy Teakettle
2022-12-20 04:05:02 +00:00
committed by GitHub
parent a497167e45
commit c046666578
14 changed files with 168 additions and 9 deletions

View File

@@ -0,0 +1,29 @@
using Content.Shared.Chemistry.Components;
namespace Content.Shared.Chemistry.Reaction;
[RegisterComponent]
public sealed class ReactionMixerComponent : Component
{
/// <summary>
/// A list of IDs for categories of reactions that can be mixed (i.e. HOLY for a bible, DRINK for a spoon)
/// </summary>
[ViewVariables]
[DataField("reactionTypes")]
public List<string> ReactionTypes = default!;
/// <summary>
/// A string which identifies the string to be sent when successfully mixing a solution
/// </summary>
[ViewVariables]
[DataField("mixMessage")]
public string MixMessage = "default-mixing-success";
}
[ByRefEvent]
public record struct MixingAttemptEvent(EntityUid Mixed, bool Cancelled = false);
public readonly record struct AfterMixingEvent(EntityUid Mixed, EntityUid Mixer);
[ByRefEvent]
public record struct GetMixableSolutionAttemptEvent(EntityUid Mixed, Solution? MixedSolution = null);