You can bless more containers with a bible (#26526)
* Made more things blessable * Removed junk * Remove whatever that was * Make bowls blessable * New mixablesolution component, converted everything to work with it * Fix minor mishaps * Fix extra spaces in bottle yml * Fix last extra space, fix bottle havign the wrong solution name * Remvoe unneeded event(I think), fix alcohol bottles not being mixable * I missed cans
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Chemistry.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class MixableSolutionComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Solution name which can be mixed with methods such as blessing
|
||||
/// </summary>
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public string Solution = "default";
|
||||
}
|
||||
@@ -48,13 +48,6 @@ namespace Content.Shared.Chemistry.Components
|
||||
[DataField("canReact")]
|
||||
public bool CanReact { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// If reactions can occur via mixing.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("canMix")]
|
||||
public bool CanMix { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Volume needed to fill this container.
|
||||
/// </summary>
|
||||
|
||||
@@ -78,31 +78,15 @@ public abstract partial class SharedSolutionContainerSystem
|
||||
return TryGetSolution((entity.Owner, entity.Comp2), entity.Comp1.Solution, out soln, out solution);
|
||||
}
|
||||
|
||||
public bool TryGetMixableSolution(Entity<SolutionContainerManagerComponent?> container, [NotNullWhen(true)] out Entity<SolutionComponent>? solution)
|
||||
public bool TryGetMixableSolution(Entity<MixableSolutionComponent?, SolutionContainerManagerComponent?> entity, [NotNullWhen(true)] out Entity<SolutionComponent>? soln, [NotNullWhen(true)] out Solution? solution)
|
||||
{
|
||||
var getMixableSolutionAttempt = new GetMixableSolutionAttemptEvent(container);
|
||||
RaiseLocalEvent(container, ref getMixableSolutionAttempt);
|
||||
if (getMixableSolutionAttempt.MixedSolution != null)
|
||||
if (!Resolve(entity, ref entity.Comp1, logMissing: false))
|
||||
{
|
||||
solution = getMixableSolutionAttempt.MixedSolution;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Resolve(container, ref container.Comp, false))
|
||||
{
|
||||
solution = default!;
|
||||
(soln, solution) = (default!, null);
|
||||
return false;
|
||||
}
|
||||
|
||||
var tryGetSolution = EnumerateSolutions(container).FirstOrNull(x => x.Solution.Comp.Solution.CanMix);
|
||||
if (tryGetSolution.HasValue)
|
||||
{
|
||||
solution = tryGetSolution.Value.Solution;
|
||||
return true;
|
||||
}
|
||||
|
||||
solution = default!;
|
||||
return false;
|
||||
return TryGetSolution((entity.Owner, entity.Comp2), entity.Comp1.Solution, out soln, out solution);
|
||||
}
|
||||
|
||||
#endregion Solution Accessors
|
||||
|
||||
@@ -25,6 +25,3 @@ public sealed partial class ReactionMixerComponent : Component
|
||||
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, Entity<SolutionComponent>? MixedSolution = null);
|
||||
|
||||
Reference in New Issue
Block a user