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:
Verm
2024-04-20 01:16:55 -05:00
committed by GitHub
parent c85bdef7f1
commit 089c9cb967
24 changed files with 54 additions and 48 deletions

View File

@@ -30,7 +30,7 @@ public sealed partial class ReactionMixerSystem : EntitySystem
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);

View File

@@ -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";
}

View File

@@ -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>

View File

@@ -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

View File

@@ -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);

View File

@@ -4351,7 +4351,6 @@ entities:
solutions:
absorbed:
temperature: 293.15
canMix: False
canReact: True
maxVol: 50
name: null

View File

@@ -4542,7 +4542,6 @@ entities:
solutions:
beaker:
temperature: 293.15
canMix: True
canReact: True
maxVol: 50
name: null
@@ -4550,6 +4549,8 @@ entities:
- data: null
ReagentId: Leporazine
Quantity: 50
- type: MixableSolution
solution: beaker
- proto: Bed
entities:
- uid: 247
@@ -22184,7 +22185,6 @@ entities:
solutions:
drink:
temperature: 293.15
canMix: False
canReact: True
maxVol: 30
name: null

View File

@@ -32761,7 +32761,6 @@ entities:
solutions:
drink:
temperature: 293.15
canMix: False
canReact: True
maxVol: 30
name: null

View File

@@ -64838,7 +64838,6 @@ entities:
solutions:
drink:
temperature: 293.15
canMix: False
canReact: True
maxVol: 50
name: null

View File

@@ -172898,7 +172898,6 @@ entities:
solutions:
puddle:
temperature: 293.15
canMix: False
canReact: True
maxVol: 1000
name: null

View File

@@ -6112,7 +6112,6 @@ entities:
solutions:
beaker:
temperature: 293.15
canMix: True
canReact: True
maxVol: 50
name: null
@@ -6120,6 +6119,8 @@ entities:
- data: null
ReagentId: Leporazine
Quantity: 40
- type: MixableSolution
solution: beaker
- uid: 10800
components:
- type: Transform

View File

@@ -142,8 +142,11 @@
mode: CardinalFlags
- type: SolutionContainerManager
solutions:
puddle: { maxVol: 1000 }
puddle:
maxVol: 1000
- type: Puddle
- type: MixableSolution
solution: puddle
- type: Appearance
- type: ActiveEdgeSpreader
- type: EdgeSpreader

View File

@@ -10,6 +10,8 @@
solutions:
drink:
maxVol: 30
- type: MixableSolution
solution: drink
- type: SolutionTransfer
canChangeTransferAmount: true
- type: Drink

View File

@@ -14,6 +14,8 @@
- ReagentId: Cola
Quantity: 30
maxVol: 30
- type: MixableSolution
solution: drink
- type: SolutionTransfer
canChangeTransferAmount: true
maxTransferAmount: 15

View File

@@ -10,7 +10,8 @@
solutions:
drink:
maxVol: 20
canMix: true
- type: MixableSolution
solution: drink
- type: FitsInDispenser
solution: drink
- type: DrawableSolution

View File

@@ -8,6 +8,8 @@
solutions:
drink:
maxVol: 100
- type: MixableSolution
solution: drink
- type: Drink
- type: Shakeable # Doesn't do anything, but I mean...
- type: FitsInDispenser

View File

@@ -25,6 +25,8 @@
damage:
types:
Blunt: 0
- type: MixableSolution
solution: drink
- type: Spillable
solution: drink
- type: FitsInDispenser
@@ -102,6 +104,8 @@
solutions:
drink:
maxVol: 50
- type: MixableSolution
solution: drink
- type: SolutionTransfer
canChangeTransferAmount: true
maxTransferAmount: 5

View File

@@ -19,6 +19,8 @@
- map: ["enum.SolutionContainerLayers.Fill"]
state: fill-1
visible: false
- type: MixableSolution
solution: food
- type: DamageOnLand
damage:
types:

View File

@@ -8,7 +8,6 @@
solutions:
beaker:
maxVol: 200
canMix: true
- type: Sprite
sprite: Objects/Specific/Chemistry/jug.rsi
layers:
@@ -19,6 +18,8 @@
- type: Item
size: Normal
sprite: Objects/Specific/Chemistry/jug.rsi
- type: MixableSolution
solution: beaker
- type: RefillableSolution
solution: beaker
- type: DrainableSolution

View File

@@ -29,7 +29,8 @@
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

View File

@@ -35,7 +35,8 @@
solutions:
beaker:
maxVol: 30
canMix: true
- type: MixableSolution
solution: beaker
- type: RefillableSolution
solution: beaker
- type: DrainableSolution

View File

@@ -25,7 +25,8 @@
solutions:
beaker:
maxVol: 50
canMix: true
- type: MixableSolution
solution: beaker
- type: FitsInDispenser
solution: beaker
- type: RefillableSolution
@@ -117,7 +118,8 @@
solutions:
beaker:
maxVol: 50
canMix: true
- type: MixableSolution
solution: beaker
- type: FitsInDispenser
solution: beaker
- type: RefillableSolution
@@ -200,7 +202,6 @@
solutions:
beaker:
maxVol: 100
canMix: true
- type: Appearance
- type: SolutionContainerVisuals
maxFillLevels: 6
@@ -244,7 +245,6 @@
solutions:
beaker:
maxVol: 1000
canMix: true
- type: entity
name: dropper

View File

@@ -26,6 +26,8 @@
solutions:
bucket:
maxVol: 250
- type: MixableSolution
solution: bucket
- type: SolutionTransfer
transferAmount: 100
maxTransferAmount: 100

View File

@@ -457,7 +457,8 @@
solutions:
tank:
maxVol: 400
canMix: true
- type: MixableSolution
solution: tank
- type: DrainableSolution
solution: tank
- type: ExaminableSolution