Skip to content

Commit

Permalink
Merge branch 'Fansana:master' into Ghost-Role-Bar
Browse files Browse the repository at this point in the history
  • Loading branch information
ShatteredSwords authored Sep 4, 2024
2 parents 62c419f + 3146b31 commit 1bc4334
Show file tree
Hide file tree
Showing 22 changed files with 453 additions and 33 deletions.
9 changes: 5 additions & 4 deletions Content.Server/Body/Components/MetabolizerComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ public sealed partial class MetabolizerComponent : Component
/// </summary>
[DataField]
public bool RemoveEmpty = false;

/// <summary>
/// How many reagents can this metabolizer process at once?
/// floof
///
/// How many poisons can this metabolizer process at once?
/// Used to nerf 'stacked poisons' where having 5+ different poisons in a syringe, even at low
/// quantity, would be muuuuch better than just one poison acting.
/// </summary>
[DataField("maxReagents")]
public int MaxReagentsProcessable = 3;
[DataField("maxPoisons")]
public int MaxPoisonsProcessable = 3;

/// <summary>
/// A list of metabolism groups that this metabolizer will act on, in order of precedence.
Expand Down
15 changes: 9 additions & 6 deletions Content.Server/Body/Systems/MetabolizerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private void TryMetabolize(Entity<MetabolizerComponent, OrganComponent?, Solutio
var list = solution.Contents.ToArray();
_random.Shuffle(list);

int reagents = 0;
int poisons = 0; // floof modified
foreach (var (reagent, quantity) in list)
{
if (!_prototypeManager.TryIndex<ReagentPrototype>(reagent.Prototype, out var proto))
Expand All @@ -159,9 +159,10 @@ private void TryMetabolize(Entity<MetabolizerComponent, OrganComponent?, Solutio
continue;
}

// we're done here entirely if this is true
if (reagents >= ent.Comp1.MaxReagentsProcessable)
return;
// floof modified
// Already processed all poisons, skip to the next reagent.
if (poisons >= ent.Comp1.MaxPoisonsProcessable && proto.Metabolisms.ContainsKey("Poison"))
continue;


// loop over all our groups and see which ones apply
Expand Down Expand Up @@ -223,8 +224,10 @@ private void TryMetabolize(Entity<MetabolizerComponent, OrganComponent?, Solutio
{
solution.RemoveReagent(reagent, mostToRemove);

// We have processed a reagant, so count it towards the cap
reagents += 1;
// floof modified
// We have processed a poison, so count it towards the cap
if (proto.Metabolisms.ContainsKey("Poison"))
poisons++;
}
}

Expand Down
8 changes: 7 additions & 1 deletion Content.Server/Medical/CryoPodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,14 @@ public override void Update(float frameTime)
{
continue;
}
// floof

var solutionToInject = _solutionContainerSystem.SplitSolution(containerSolution.Value, cryoPod.BeakerTransferAmount);
// Filter out a fixed amount of each reagent from the cryo pod's beaker
var solutionToInject = _solutionContainerSystem.SplitSolutionReagentsEvenly(containerSolution.Value, cryoPod.BeakerTransferAmount);
// for every .25 units used, .5 units per second are added to the body, making cryo-pod more efficient than injections
solutionToInject.ScaleSolution(cryoPod.PotencyMultiplier);

// End floof
_bloodstreamSystem.TryAddToChemicals(patient.Value, solutionToInject, bloodstream);
_reactiveSystem.DoEntityReaction(patient.Value, solutionToInject, ReactionMethod.Injection);
}
Expand Down
58 changes: 56 additions & 2 deletions Content.Shared/Chemistry/Components/Solution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -585,10 +585,11 @@ public Solution SplitSolutionWithout(FixedPoint2 toTake, params string[] exclude

return sol;
}

/// <summary>
/// Splits a solution without the specified reagent prototypes.
/// splits the solution taking the specified amount of reagents proportionally to their quantity.
/// </summary>
/// <param name="toTake">The total amount of solution to remove and return.</param>
/// <returns>a new solution of equal proportions to the original solution</returns>
public Solution SplitSolutionWithOnly(FixedPoint2 toTake, params string[] includedPrototypes)
{
// First remove the non-included prototypes
Expand Down Expand Up @@ -677,6 +678,59 @@ public Solution SplitSolution(FixedPoint2 toTake)
return newSolution;
}

/// <summary>
/// floof
/// splits the solution taking up to the specified amount of each reagent from the solution.
/// If the solution has less of a reagent than the specified amount, it will take all of that reagent.
/// </summary>
/// <param name="toTakePer">How much of each reagent to take</param>
/// <returns>a new solution containing the reagents taken from the original solution</returns>
public Solution SplitSolutionReagentsEvenly(FixedPoint2 toTakePer)
{
var splitSolution = new Solution();

if (toTakePer <= FixedPoint2.Zero)
return splitSolution;
var reagentsCount = Contents.Count;
var reagentsToRemove = new List<ReagentQuantity>();
for (var i = 0; i < reagentsCount; i++)
{
var currentReagent = Contents[i];

if (currentReagent.Quantity <= FixedPoint2.Zero)
{
reagentsToRemove.Add(currentReagent);
continue;
}

if (currentReagent.Quantity <= toTakePer)
{
splitSolution.AddReagent(currentReagent);
reagentsToRemove.Add(currentReagent);
}
else
{
splitSolution.AddReagent(currentReagent.Reagent, toTakePer);
RemoveReagent(currentReagent.Reagent, toTakePer);
}
}

foreach (var reagent in reagentsToRemove)
{
RemoveReagent(reagent);
}
if (Volume == FixedPoint2.Zero)
RemoveAllSolution();

_heatCapacityDirty = true;
splitSolution._heatCapacityDirty = true;

ValidateSolution();
splitSolution.ValidateSolution();

return splitSolution;
}

/// <summary>
/// Variant of <see cref="SplitSolution(FixedPoint2)"/> that doesn't return a new solution containing the removed reagents.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,7 @@ public void UpdateAppearance(Entity<SolutionComponent, AppearanceComponent?> sol

/// <summary>
/// Removes part of the solution in the container.
/// </summary>
/// <param name="targetUid"></param>
/// <param name="solutionHolder"></param>
/// </summary> /// <param name="soln">The container to remove solution from.</param>
/// <param name="quantity">the volume of solution to remove.</param>
/// <returns>The solution that was removed.</returns>
public Solution SplitSolution(Entity<SolutionComponent> soln, FixedPoint2 quantity)
Expand All @@ -311,6 +309,22 @@ public Solution SplitSolution(Entity<SolutionComponent> soln, FixedPoint2 quanti
return splitSol;
}

/// <summary>
/// Splits a solution removing a specified amount of each reagent, if available.
/// </summary>
/// <param name="soln">The container to split the solution from.</param>
/// <param name="quantity">The amount of each reagent to split.</param>
/// <returns></returns>
public Solution SplitSolutionReagentsEvenly(Entity<SolutionComponent> soln, FixedPoint2 quantity)
{
var (uid, comp) = soln;
var solution = comp.Solution;

var splitSol = solution.SplitSolutionReagentsEvenly(quantity);
UpdateChemicals(soln);
return splitSol;
}

public Solution SplitStackSolution(Entity<SolutionComponent> soln, FixedPoint2 quantity, int stackCount)
{
var (uid, comp) = soln;
Expand Down
15 changes: 12 additions & 3 deletions Content.Shared/Medical/Cryogenics/CryoPodComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Robust.Shared.Containers;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
Expand Down Expand Up @@ -34,11 +34,20 @@ public sealed partial class CryoPodComponent : Component
public TimeSpan? NextInjectionTime;

/// <summary>
/// How many units to transfer per tick from the beaker to the mob?
/// How many units of each reagent to transfer per tick from the beaker to the mob?
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("beakerTransferAmount")]
public float BeakerTransferAmount = 1f;
public float BeakerTransferAmount = .25f;// floof: 1<0.25

/// <summary>
/// Frontier
/// How potent (multiplier) the reagents are when transferred from the beaker to the mob.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("PotencyAmount")]
public float PotencyMultiplier = 2f;


/// <summary>
/// Delay applied when inserting a mob in the pod.
Expand Down
24 changes: 24 additions & 0 deletions Resources/Changelog/Floof.yml
Original file line number Diff line number Diff line change
Expand Up @@ -821,3 +821,27 @@ Entries:
message: Sex Toy Crate price increased to 2000.
id: 112
time: '2024-09-03T20:08:29.0000000+00:00'
- author: ShatteredSwords
changes:
- type: Fix
message: You can now be headpat and not be referred to in the third person.
id: 113
time: '2024-09-03T21:33:48.0000000+00:00'
- author: Fansana
changes:
- type: Add
message: Added colorful glowing gems
id: 114
time: '2024-09-03T21:53:54.0000000+00:00'
- author: neuPanda
changes:
- type: Add
message: new cryo chems
- type: Tweak
message: old cryo chems
- type: Fix
message: death
- type: Remove
message: metabolism restrictions
id: 115
time: '2024-09-04T05:12:40.0000000+00:00'
5 changes: 5 additions & 0 deletions Resources/Locale/en-US/Floof/reagents/meta/chemicals.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
reagent-name-salicylicacid = salicylic acid
reagent-desc-salicylicacid = A powdery substance used for dermatological treatments.
reagent-name-formaldehyde = formaldehyde
reagent-desc-formaldehyde = A yellowish substance used for peservation of tissue.
5 changes: 5 additions & 0 deletions Resources/Locale/en-US/Floof/reagents/meta/medicine.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
reagent-name-traumoxadone = traumoxadone
reagent-desc-traumoxadone = A cryogenics chemical. Used to treat severe trauma via regeneration of the damaged tissue. Works regardless of the patient being alive or dead. Product of Mystic Medical
reagent-name-stelloxadone = stelloxadone
reagent-desc-stelloxadone = A cryogenics chemical. Used to aggressively dissolve toxins from the body. Works regardless of the patient being alive or dead. Product of Mystic Medical
2 changes: 1 addition & 1 deletion Resources/Locale/en-US/interaction/verbs/noop.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interaction-Hug-success-others-popup = {THE($user)} hugs {THE($target)}.
interaction-Pet-name = Pet
interaction-Pet-description = Pet your co-worker to ease their stress.
interaction-Pet-success-self-popup = You pet {THE($target)} on {POSS-ADJ($target)} head.
interaction-Pet-success-target-popup = {THE($user)} pets you on {POSS-ADJ($target)} head.
interaction-Pet-success-target-popup = {THE($user)} pets you on your head.
interaction-Pet-success-others-popup = {THE($user)} pets {THE($target)}.
interaction-KnockOn-name = Knock
Expand Down
6 changes: 4 additions & 2 deletions Resources/Locale/en-US/reagents/meta/medicine.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ reagent-desc-arithrazine = A mildly unstable medication used for the most extrem
reagent-name-bicaridine = bicaridine
reagent-desc-bicaridine = An analgesic which is highly effective at treating brute damage. It's useful for stabilizing people who have been severely beaten, as well as treating less life-threatening injuries.
# Floof: consistent cryogenics descriptors
reagent-name-cryoxadone = cryoxadone
reagent-desc-cryoxadone = Required for the proper function of cryogenics. Heals all standard types of damage, but only works in temperatures under 213K. It can treat and rejuvenate plants when applied in small doses.
reagent-desc-cryoxadone = Required for the proper function of cryogenics. Useful in treating asphyxiation and bloodloss, but only works in temperatures under 213K. It can treat and rejuvenate plants when applied in small doses. Works regardless of the patient being alive or dead.
reagent-name-doxarubixadone = doxarubixadone
reagent-desc-doxarubixadone = A cryogenics chemical. Heals certain types of cellular damage done by Slimes and improper use of other chemicals.
reagent-desc-doxarubixadone = A cryogenics chemical. Heals certain types of cellular damage done by Slimes and improper use of other chemicals. Works regardless of the patient being alive or dead.
# End Floof

reagent-name-dermaline = dermaline
reagent-desc-dermaline = An advanced chemical that is more effective at treating burn damage than kelotane.
Expand Down
Loading

0 comments on commit 1bc4334

Please sign in to comment.