From 089c9cb96786b21d2602ca0dd71fb643d116d3fa Mon Sep 17 00:00:00 2001
From: Verm <32827189+Vermidia@users.noreply.github.com>
Date: Sat, 20 Apr 2024 01:16:55 -0500
Subject: [PATCH] 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
---
.../EntitySystems/ReactionMixerSystem.cs | 2 +-
.../Components/MixableSolutionComponent.cs | 13 ++++++++++
.../Chemistry/Components/Solution.cs | 7 ------
...redSolutionContainerSystem.Capabilities.cs | 24 ++++---------------
.../Reaction/ReactionMixerComponent.cs | 3 ---
Resources/Maps/Test/dev_map.yml | 1 -
Resources/Maps/atlas.yml | 4 ++--
Resources/Maps/cluster.yml | 1 -
Resources/Maps/core.yml | 1 -
Resources/Maps/fland.yml | 1 -
Resources/Maps/saltern.yml | 3 ++-
.../Prototypes/Entities/Effects/puddle.yml | 5 +++-
.../Objects/Consumable/Drinks/drinks.yml | 2 ++
.../Objects/Consumable/Drinks/drinks_cans.yml | 2 ++
.../Objects/Consumable/Drinks/drinks_cups.yml | 3 ++-
.../Consumable/Drinks/drinks_special.yml | 2 ++
.../Consumable/Drinks/trash_drinks.yml | 4 ++++
.../Consumable/Food/Containers/bowl.yml | 2 ++
.../Objects/Specific/chemical-containers.yml | 3 ++-
.../Objects/Specific/chemistry-bottles.yml | 3 ++-
.../Objects/Specific/chemistry-vials.yml | 3 ++-
.../Entities/Objects/Specific/chemistry.yml | 8 +++----
.../Entities/Objects/Tools/bucket.yml | 2 ++
.../Structures/Piping/Atmospherics/unary.yml | 3 ++-
24 files changed, 54 insertions(+), 48 deletions(-)
create mode 100644 Content.Shared/Chemistry/Components/MixableSolutionComponent.cs
diff --git a/Content.Server/Chemistry/EntitySystems/ReactionMixerSystem.cs b/Content.Server/Chemistry/EntitySystems/ReactionMixerSystem.cs
index 032374d4a5..d5f7655f88 100644
--- a/Content.Server/Chemistry/EntitySystems/ReactionMixerSystem.cs
+++ b/Content.Server/Chemistry/EntitySystems/ReactionMixerSystem.cs
@@ -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);
diff --git a/Content.Shared/Chemistry/Components/MixableSolutionComponent.cs b/Content.Shared/Chemistry/Components/MixableSolutionComponent.cs
new file mode 100644
index 0000000000..2b1c140aa6
--- /dev/null
+++ b/Content.Shared/Chemistry/Components/MixableSolutionComponent.cs
@@ -0,0 +1,13 @@
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Chemistry.Components;
+
+[RegisterComponent, NetworkedComponent]
+public sealed partial class MixableSolutionComponent : Component
+{
+ ///
+ /// Solution name which can be mixed with methods such as blessing
+ ///
+ [DataField, ViewVariables(VVAccess.ReadWrite)]
+ public string Solution = "default";
+}
diff --git a/Content.Shared/Chemistry/Components/Solution.cs b/Content.Shared/Chemistry/Components/Solution.cs
index 1c24c860dd..4de3c369f7 100644
--- a/Content.Shared/Chemistry/Components/Solution.cs
+++ b/Content.Shared/Chemistry/Components/Solution.cs
@@ -48,13 +48,6 @@ namespace Content.Shared.Chemistry.Components
[DataField("canReact")]
public bool CanReact { get; set; } = true;
- ///
- /// If reactions can occur via mixing.
- ///
- [ViewVariables(VVAccess.ReadWrite)]
- [DataField("canMix")]
- public bool CanMix { get; set; } = false;
-
///
/// Volume needed to fill this container.
///
diff --git a/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.Capabilities.cs b/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.Capabilities.cs
index 0d4912a504..ce0cfab002 100644
--- a/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.Capabilities.cs
+++ b/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.Capabilities.cs
@@ -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 container, [NotNullWhen(true)] out Entity? solution)
+ public bool TryGetMixableSolution(Entity entity, [NotNullWhen(true)] out Entity? 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
diff --git a/Content.Shared/Chemistry/Reaction/ReactionMixerComponent.cs b/Content.Shared/Chemistry/Reaction/ReactionMixerComponent.cs
index ede73c4969..118f224061 100644
--- a/Content.Shared/Chemistry/Reaction/ReactionMixerComponent.cs
+++ b/Content.Shared/Chemistry/Reaction/ReactionMixerComponent.cs
@@ -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? MixedSolution = null);
diff --git a/Resources/Maps/Test/dev_map.yml b/Resources/Maps/Test/dev_map.yml
index 85f35719fb..48b2eddf62 100644
--- a/Resources/Maps/Test/dev_map.yml
+++ b/Resources/Maps/Test/dev_map.yml
@@ -4351,7 +4351,6 @@ entities:
solutions:
absorbed:
temperature: 293.15
- canMix: False
canReact: True
maxVol: 50
name: null
diff --git a/Resources/Maps/atlas.yml b/Resources/Maps/atlas.yml
index 7035f5ee24..eaf00d830a 100644
--- a/Resources/Maps/atlas.yml
+++ b/Resources/Maps/atlas.yml
@@ -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
diff --git a/Resources/Maps/cluster.yml b/Resources/Maps/cluster.yml
index cc12d77259..607d8fb4f3 100644
--- a/Resources/Maps/cluster.yml
+++ b/Resources/Maps/cluster.yml
@@ -32761,7 +32761,6 @@ entities:
solutions:
drink:
temperature: 293.15
- canMix: False
canReact: True
maxVol: 30
name: null
diff --git a/Resources/Maps/core.yml b/Resources/Maps/core.yml
index 9e977b9b35..fa04376cbf 100644
--- a/Resources/Maps/core.yml
+++ b/Resources/Maps/core.yml
@@ -64838,7 +64838,6 @@ entities:
solutions:
drink:
temperature: 293.15
- canMix: False
canReact: True
maxVol: 50
name: null
diff --git a/Resources/Maps/fland.yml b/Resources/Maps/fland.yml
index 451294470f..1476ef5c2d 100644
--- a/Resources/Maps/fland.yml
+++ b/Resources/Maps/fland.yml
@@ -172898,7 +172898,6 @@ entities:
solutions:
puddle:
temperature: 293.15
- canMix: False
canReact: True
maxVol: 1000
name: null
diff --git a/Resources/Maps/saltern.yml b/Resources/Maps/saltern.yml
index 84e3587945..22b08b60b6 100644
--- a/Resources/Maps/saltern.yml
+++ b/Resources/Maps/saltern.yml
@@ -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
diff --git a/Resources/Prototypes/Entities/Effects/puddle.yml b/Resources/Prototypes/Entities/Effects/puddle.yml
index 2c845e1d0f..fecf9f19a4 100644
--- a/Resources/Prototypes/Entities/Effects/puddle.yml
+++ b/Resources/Prototypes/Entities/Effects/puddle.yml
@@ -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
diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks.yml
index aac2803dd2..e8ae787636 100644
--- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks.yml
+++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks.yml
@@ -10,6 +10,8 @@
solutions:
drink:
maxVol: 30
+ - type: MixableSolution
+ solution: drink
- type: SolutionTransfer
canChangeTransferAmount: true
- type: Drink
diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml
index 7dcd3fa603..ca67e51792 100644
--- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml
+++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml
@@ -14,6 +14,8 @@
- ReagentId: Cola
Quantity: 30
maxVol: 30
+ - type: MixableSolution
+ solution: drink
- type: SolutionTransfer
canChangeTransferAmount: true
maxTransferAmount: 15
diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cups.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cups.yml
index 8242496e20..763c4210ae 100644
--- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cups.yml
+++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cups.yml
@@ -10,7 +10,8 @@
solutions:
drink:
maxVol: 20
- canMix: true
+ - type: MixableSolution
+ solution: drink
- type: FitsInDispenser
solution: drink
- type: DrawableSolution
diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_special.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_special.yml
index a7f1bdbec6..829d68279d 100644
--- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_special.yml
+++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_special.yml
@@ -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
diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/trash_drinks.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/trash_drinks.yml
index a3f5bf1903..67154963d1 100644
--- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/trash_drinks.yml
+++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/trash_drinks.yml
@@ -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
diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Food/Containers/bowl.yml b/Resources/Prototypes/Entities/Objects/Consumable/Food/Containers/bowl.yml
index 4595329635..70303cfdff 100644
--- a/Resources/Prototypes/Entities/Objects/Consumable/Food/Containers/bowl.yml
+++ b/Resources/Prototypes/Entities/Objects/Consumable/Food/Containers/bowl.yml
@@ -19,6 +19,8 @@
- map: ["enum.SolutionContainerLayers.Fill"]
state: fill-1
visible: false
+ - type: MixableSolution
+ solution: food
- type: DamageOnLand
damage:
types:
diff --git a/Resources/Prototypes/Entities/Objects/Specific/chemical-containers.yml b/Resources/Prototypes/Entities/Objects/Specific/chemical-containers.yml
index 027ff206f8..01efcfa950 100644
--- a/Resources/Prototypes/Entities/Objects/Specific/chemical-containers.yml
+++ b/Resources/Prototypes/Entities/Objects/Specific/chemical-containers.yml
@@ -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
diff --git a/Resources/Prototypes/Entities/Objects/Specific/chemistry-bottles.yml b/Resources/Prototypes/Entities/Objects/Specific/chemistry-bottles.yml
index acfb65aa54..6c81fa9466 100644
--- a/Resources/Prototypes/Entities/Objects/Specific/chemistry-bottles.yml
+++ b/Resources/Prototypes/Entities/Objects/Specific/chemistry-bottles.yml
@@ -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
diff --git a/Resources/Prototypes/Entities/Objects/Specific/chemistry-vials.yml b/Resources/Prototypes/Entities/Objects/Specific/chemistry-vials.yml
index c5de88d690..65f5fbb5d0 100644
--- a/Resources/Prototypes/Entities/Objects/Specific/chemistry-vials.yml
+++ b/Resources/Prototypes/Entities/Objects/Specific/chemistry-vials.yml
@@ -35,7 +35,8 @@
solutions:
beaker:
maxVol: 30
- canMix: true
+ - type: MixableSolution
+ solution: beaker
- type: RefillableSolution
solution: beaker
- type: DrainableSolution
diff --git a/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml b/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml
index 9e68879fb4..9ac699db5a 100644
--- a/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml
+++ b/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml
@@ -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
diff --git a/Resources/Prototypes/Entities/Objects/Tools/bucket.yml b/Resources/Prototypes/Entities/Objects/Tools/bucket.yml
index 496fd231b8..d0a3bb3702 100644
--- a/Resources/Prototypes/Entities/Objects/Tools/bucket.yml
+++ b/Resources/Prototypes/Entities/Objects/Tools/bucket.yml
@@ -26,6 +26,8 @@
solutions:
bucket:
maxVol: 250
+ - type: MixableSolution
+ solution: bucket
- type: SolutionTransfer
transferAmount: 100
maxTransferAmount: 100
diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml
index 6e4e339ae6..e046fb831a 100644
--- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml
+++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml
@@ -457,7 +457,8 @@
solutions:
tank:
maxVol: 400
- canMix: true
+ - type: MixableSolution
+ solution: tank
- type: DrainableSolution
solution: tank
- type: ExaminableSolution
--
2.52.0