return;
}
- if (!_solutionContainers.TryGetMixableSolution(args.Target.Value, out var solution))
+ if (!_solutionContainers.TryGetMixableSolution(args.Target.Value, out var solution, out _))
return;
_popup.PopupEntity(Loc.GetString(entity.Comp.MixMessage, ("mixed", Identity.Entity(args.Target.Value, EntityManager)), ("mixer", Identity.Entity(entity.Owner, EntityManager))), args.User, args.User);
--- /dev/null
+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";
+}
[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>
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)
- {
- solution = getMixableSolutionAttempt.MixedSolution;
- return true;
- }
-
- if (!Resolve(container, ref container.Comp, false))
+ if (!Resolve(entity, ref entity.Comp1, logMissing: 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
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);
solutions:
absorbed:
temperature: 293.15
- canMix: False
canReact: True
maxVol: 50
name: null
solutions:
beaker:
temperature: 293.15
- canMix: True
canReact: True
maxVol: 50
name: null
- data: null
ReagentId: Leporazine
Quantity: 50
+ - type: MixableSolution
+ solution: beaker
- proto: Bed
entities:
- uid: 247
solutions:
drink:
temperature: 293.15
- canMix: False
canReact: True
maxVol: 30
name: null
solutions:
drink:
temperature: 293.15
- canMix: False
canReact: True
maxVol: 30
name: null
solutions:
drink:
temperature: 293.15
- canMix: False
canReact: True
maxVol: 50
name: null
solutions:
puddle:
temperature: 293.15
- canMix: False
canReact: True
maxVol: 1000
name: null
solutions:
beaker:
temperature: 293.15
- canMix: True
canReact: True
maxVol: 50
name: null
- data: null
ReagentId: Leporazine
Quantity: 40
+ - type: MixableSolution
+ solution: beaker
- uid: 10800
components:
- type: Transform
mode: CardinalFlags
- type: SolutionContainerManager
solutions:
- puddle: { maxVol: 1000 }
+ puddle:
+ maxVol: 1000
- type: Puddle
+ - type: MixableSolution
+ solution: puddle
- type: Appearance
- type: ActiveEdgeSpreader
- type: EdgeSpreader
solutions:
drink:
maxVol: 30
+ - type: MixableSolution
+ solution: drink
- type: SolutionTransfer
canChangeTransferAmount: true
- type: Drink
- ReagentId: Cola
Quantity: 30
maxVol: 30
+ - type: MixableSolution
+ solution: drink
- type: SolutionTransfer
canChangeTransferAmount: true
maxTransferAmount: 15
solutions:
drink:
maxVol: 20
- canMix: true
+ - type: MixableSolution
+ solution: drink
- type: FitsInDispenser
solution: drink
- type: DrawableSolution
solutions:
drink:
maxVol: 100
+ - type: MixableSolution
+ solution: drink
- type: Drink
- type: Shakeable # Doesn't do anything, but I mean...
- type: FitsInDispenser
damage:
types:
Blunt: 0
+ - type: MixableSolution
+ solution: drink
- type: Spillable
solution: drink
- type: FitsInDispenser
solutions:
drink:
maxVol: 50
+ - type: MixableSolution
+ solution: drink
- type: SolutionTransfer
canChangeTransferAmount: true
maxTransferAmount: 5
- map: ["enum.SolutionContainerLayers.Fill"]
state: fill-1
visible: false
+ - type: MixableSolution
+ solution: food
- type: DamageOnLand
damage:
types:
solutions:
beaker:
maxVol: 200
- canMix: true
- type: Sprite
sprite: Objects/Specific/Chemistry/jug.rsi
layers:
- type: Item
size: Normal
sprite: Objects/Specific/Chemistry/jug.rsi
+ - type: MixableSolution
+ solution: beaker
- type: RefillableSolution
solution: beaker
- type: DrainableSolution
solutions:
drink: # This solution name and target volume is hard-coded in ChemMasterComponent
maxVol: 30
- canMix: true
+ - type: MixableSolution
+ solution: drink
- type: RefillableSolution
solution: drink
- type: DrainableSolution
solutions:
beaker:
maxVol: 30
- canMix: true
+ - type: MixableSolution
+ solution: beaker
- type: RefillableSolution
solution: beaker
- type: DrainableSolution
solutions:
beaker:
maxVol: 50
- canMix: true
+ - type: MixableSolution
+ solution: beaker
- type: FitsInDispenser
solution: beaker
- type: RefillableSolution
solutions:
beaker:
maxVol: 50
- canMix: true
+ - type: MixableSolution
+ solution: beaker
- type: FitsInDispenser
solution: beaker
- type: RefillableSolution
solutions:
beaker:
maxVol: 100
- canMix: true
- type: Appearance
- type: SolutionContainerVisuals
maxFillLevels: 6
solutions:
beaker:
maxVol: 1000
- canMix: true
- type: entity
name: dropper
solutions:
bucket:
maxVol: 250
+ - type: MixableSolution
+ solution: bucket
- type: SolutionTransfer
transferAmount: 100
maxTransferAmount: 100
solutions:
tank:
maxVol: 400
- canMix: true
+ - type: MixableSolution
+ solution: tank
- type: DrainableSolution
solution: tank
- type: ExaminableSolution