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; return;
} }
if (!_solutionContainers.TryGetMixableSolution(args.Target.Value, out var solution)) if (!_solutionContainers.TryGetMixableSolution(args.Target.Value, out var solution, out _))
return; 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); _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")] [DataField("canReact")]
public bool CanReact { get; set; } = true; 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> /// <summary>
/// Volume needed to fill this container. /// Volume needed to fill this container.
/// </summary> /// </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); 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); if (!Resolve(entity, ref entity.Comp1, logMissing: false))
RaiseLocalEvent(container, ref getMixableSolutionAttempt);
if (getMixableSolutionAttempt.MixedSolution != null)
{ {
solution = getMixableSolutionAttempt.MixedSolution; (soln, solution) = (default!, null);
return true;
}
if (!Resolve(container, ref container.Comp, false))
{
solution = default!;
return false; return false;
} }
var tryGetSolution = EnumerateSolutions(container).FirstOrNull(x => x.Solution.Comp.Solution.CanMix); return TryGetSolution((entity.Owner, entity.Comp2), entity.Comp1.Solution, out soln, out solution);
if (tryGetSolution.HasValue)
{
solution = tryGetSolution.Value.Solution;
return true;
}
solution = default!;
return false;
} }
#endregion Solution Accessors #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 record struct MixingAttemptEvent(EntityUid Mixed, bool Cancelled = false);
public readonly record struct AfterMixingEvent(EntityUid Mixed, EntityUid Mixer); 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: solutions:
absorbed: absorbed:
temperature: 293.15 temperature: 293.15
canMix: False
canReact: True canReact: True
maxVol: 50 maxVol: 50
name: null name: null

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -29,7 +29,8 @@
solutions: solutions:
drink: # This solution name and target volume is hard-coded in ChemMasterComponent drink: # This solution name and target volume is hard-coded in ChemMasterComponent
maxVol: 30 maxVol: 30
canMix: true - type: MixableSolution
solution: drink
- type: RefillableSolution - type: RefillableSolution
solution: drink solution: drink
- type: DrainableSolution - type: DrainableSolution

View File

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

View File

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

View File

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

View File

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