mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-02-14 19:29:57 +01:00
* merged chemical into bloodstream * changed injectable to bloodstream * separated bleeding and direct blood removal * removed blood gain from protein * reduced blood gain from saline * rejuvenating fills to reference volume * fixed blood regulation * red mead requires stirring to make * reverted accidental line deletion * cleared the skeletons from the closet * additional routing * field rename for xeno * removed mention of chemstream and field rename for asteroid mobs * minor optimizations * Revert "reduced blood gain from saline" This reverts commit de26fd1c0d99f3019fe7dd1451a50230cc90f058. * Revert "removed blood gain from protein" This reverts commit 7a1648caf39fe26406db73c2a5afa389b82c612f. * removed unused component fetch * dead check mini refactor * eventized blood exclusion * quick fix * Pain * Commit of doom * COMMIT * renamed bloodMaxFactor to MaxVolumeFactor * addressed floating point error * returned vomiting chemicals * blood reagent always skips the flush * no need to mention blood reagent * fixed passing blood flush * adadsafasfasfassfasf * whoops * merge fixed injectors * Revert "adadsafasfasfassfasf" This reverts commit 0a5313a68dd6484d36d28d08930c76851b72ae38. * simplify reagent removal * enabled foreign blood transfusion * Revert "COMMIT" This reverts commit 19abd679cd7761ebd47bb242bd644176a3006a42. * simplified reagent removal when modifying blood level * removed misleading coment since the changes * documented MetabolismExclusionEvent * fixed negative negative modification of blood level * fixed hypervolemia not normalizing * constrainted blood modification * returned bloodpack stop on fully healed * forgot to stage this * band aid for diona blood * swapping GetReagent with GetPrototype * optimize blood filtering * multiplicative multi reagent blood level calculation * removed unused stuff * optimized blood calculation a tiny bit * added per reagent blood regulation * optimized (referenceVolume + bloodReagents) into referenceSolution * polished coded to proper function * forgot to stage rootable system change * clean up, unnecessary GetBloodLevel call * rename method name to TryAddToBloodstream instead of Chemicals * placed overfill safety * cleanup and final touches * final touch --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
58 lines
2.5 KiB
C#
58 lines
2.5 KiB
C#
using Content.Shared.Body.Components;
|
|
using Content.Shared.Body.Systems;
|
|
using Content.Shared.Chemistry.Reagent;
|
|
using Content.Shared.Forensics;
|
|
|
|
namespace Content.Server.Body.Systems;
|
|
|
|
public sealed class BloodstreamSystem : SharedBloodstreamSystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<BloodstreamComponent, ComponentInit>(OnComponentInit);
|
|
SubscribeLocalEvent<BloodstreamComponent, GenerateDnaEvent>(OnDnaGenerated);
|
|
}
|
|
|
|
// not sure if we can move this to shared or not
|
|
// it would certainly help if SolutionContainer was documented
|
|
// but since we usually don't add the component dynamically to entities we can keep this unpredicted for now
|
|
private void OnComponentInit(Entity<BloodstreamComponent> entity, ref ComponentInit args)
|
|
{
|
|
if (!SolutionContainer.EnsureSolution(entity.Owner,
|
|
entity.Comp.BloodSolutionName,
|
|
out var bloodSolution) ||
|
|
!SolutionContainer.EnsureSolution(entity.Owner,
|
|
entity.Comp.BloodTemporarySolutionName,
|
|
out var tempSolution))
|
|
return;
|
|
|
|
bloodSolution.MaxVolume = entity.Comp.BloodReferenceSolution.Volume * entity.Comp.MaxVolumeModifier;
|
|
tempSolution.MaxVolume = entity.Comp.BleedPuddleThreshold * 4; // give some leeway, for chemstream as well
|
|
|
|
// Fill blood solution with BLOOD
|
|
// The DNA string might not be initialized yet, but the reagent data gets updated in the GenerateDnaEvent subscription
|
|
var solution = entity.Comp.BloodReferenceSolution.Clone();
|
|
solution.ScaleTo(entity.Comp.BloodReferenceSolution.Volume - bloodSolution.Volume);
|
|
solution.SetReagentData(GetEntityBloodData(entity.Owner));
|
|
bloodSolution.AddSolution(solution, PrototypeManager);
|
|
}
|
|
|
|
// forensics is not predicted yet
|
|
private void OnDnaGenerated(Entity<BloodstreamComponent> entity, ref GenerateDnaEvent args)
|
|
{
|
|
if (SolutionContainer.ResolveSolution(entity.Owner, entity.Comp.BloodSolutionName, ref entity.Comp.BloodSolution, out var bloodSolution))
|
|
{
|
|
foreach (var reagent in bloodSolution.Contents)
|
|
{
|
|
List<ReagentData> reagentData = reagent.Reagent.EnsureReagentData();
|
|
reagentData.RemoveAll(x => x is DnaData);
|
|
reagentData.AddRange(GetEntityBloodData(entity.Owner));
|
|
}
|
|
}
|
|
else
|
|
Log.Error("Unable to set bloodstream DNA, solution entity could not be resolved");
|
|
}
|
|
}
|