Skip to content

Commit

Permalink
changed up reactions to allow DNA transfers, added preserveDNA tag to…
Browse files Browse the repository at this point in the history
… reaction recipes, changed recipes accordingly
  • Loading branch information
Kandiyaki committed Sep 21, 2024
1 parent 4b6f42d commit b6867a3
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
28 changes: 21 additions & 7 deletions Content.Shared/Chemistry/Reaction/ChemicalReactionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Content.Shared.Database;
using Content.Shared.EntityEffects;
using Content.Shared.FixedPoint;
using Content.Shared.Implants.Components;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
Expand Down Expand Up @@ -167,8 +166,27 @@ private List<string> PerformReaction(Entity<SolutionComponent> soln, ReactionPro

var energy = reaction.ConserveEnergy ? solution.GetThermalEnergy(_prototypeManager) : 0;

List<ReagentData> dnaDataList = new List<ReagentData>();

//save reactant DNA to DNAlist
if (reaction.PreserveDNA)
{

foreach (var reagent in solution.Contents)
{

foreach (var data in reagent.Reagent.EnsureReagentData())
{
if (data is DnaData)
{
dnaDataList.Add((data));
}
}
}
}

//Remove reactants
foreach (var reactant in reaction.Reactants)
foreach (KeyValuePair<string, ReactantPrototype> reactant in reaction.Reactants)
{
if (!reactant.Value.Catalyst)
{
Expand All @@ -182,7 +200,7 @@ private List<string> PerformReaction(Entity<SolutionComponent> soln, ReactionPro
foreach (var product in reaction.Products)
{
products.Add(product.Key);
solution.AddReagent(product.Key, product.Value * unitReactions);
solution.AddReagent(new ReagentId(product.Key, dnaDataList), product.Value * unitReactions);
}

if (reaction.ConserveEnergy)
Expand All @@ -192,10 +210,6 @@ private List<string> PerformReaction(Entity<SolutionComponent> soln, ReactionPro
solution.Temperature = energy / newCap;
}

if(reaction.preserveDNA)
{

}

OnReaction(soln, reaction, null, unitReactions);

Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Chemistry/Reaction/ReactionPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public sealed partial class ReactionPrototype : IPrototype, IComparable<Reaction
/// If true, this reaction will attempt to transfer any DNA from the input chemicals to the output chemical.
/// </summary>
[DataField("preserveDNA")]
public bool preserveDNA = false;
public bool PreserveDNA = false;

/// <summary>
/// How dangerous is this effect? Stuff like bicaridine should be low, while things like methamphetamine
Expand Down
3 changes: 3 additions & 0 deletions Resources/Prototypes/Recipes/Reactions/drinks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@

- type: reaction
id: DemonsBlood
preserveDNA: true
requiredMixerCategories:
- Stir
reactants:
Expand All @@ -310,6 +311,7 @@

- type: reaction
id: DevilsKiss
preserveDNA: true
requiredMixerCategories:
- Stir
reactants:
Expand Down Expand Up @@ -824,6 +826,7 @@

- type: reaction
id: RedMead
preserveDNA: true
reactants:
Mead:
amount: 1
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Recipes/Reactions/fun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@

- type: reaction
id: SpaceGlue
preserveDNA: true
minTemp: 370
reactants:
SpaceLube:
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Recipes/Reactions/medicine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@

- type: reaction
id: Ambuzol
preserveDNA: true
reactants:
Dylovene:
amount: 1
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Recipes/Reactions/single_reagent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

- type: reaction
id: BloodToWine
preserveDNA: true
impact: Low
requiredMixerCategories:
- Holy
Expand Down

0 comments on commit b6867a3

Please sign in to comment.