Revert 'Revert 'Solution Entities'' (#23168)

This commit is contained in:
TemporalOroboros
2023-12-29 04:47:43 -08:00
committed by GitHub
parent 93e1af2f8d
commit d23c8d5c19
180 changed files with 3541 additions and 2956 deletions

View File

@@ -5,6 +5,7 @@ using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.Unary.EntitySystems;
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Medical.Components;
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
@@ -16,7 +17,6 @@ using Content.Server.UserInterface;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Climbing.Systems;
using Content.Shared.Containers.ItemSlots;
@@ -28,7 +28,6 @@ using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Medical.Cryogenics;
using Content.Shared.MedicalScanner;
using Content.Shared.Tools;
using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using Robust.Shared.Timing;
@@ -36,7 +35,7 @@ using SharedToolSystem = Content.Shared.Tools.Systems.SharedToolSystem;
namespace Content.Server.Medical;
public sealed partial class CryoPodSystem: SharedCryoPodSystem
public sealed partial class CryoPodSystem : SharedCryoPodSystem
{
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly GasCanisterSystem _gasCanisterSystem = default!;
@@ -105,14 +104,15 @@ public sealed partial class CryoPodSystem: SharedCryoPodSystem
&& fitsInDispenserQuery.TryGetComponent(container, out var fitsInDispenserComponent)
&& solutionContainerManagerQuery.TryGetComponent(container,
out var solutionContainerManagerComponent)
&& _solutionContainerSystem.TryGetFitsInDispenser(container.Value, out var containerSolution, dispenserFits: fitsInDispenserComponent, solutionManager: solutionContainerManagerComponent))
&& _solutionContainerSystem.TryGetFitsInDispenser((container.Value, fitsInDispenserComponent, solutionContainerManagerComponent),
out var containerSolution, out _))
{
if (!bloodStreamQuery.TryGetComponent(patient, out var bloodstream))
{
continue;
}
var solutionToInject = _solutionContainerSystem.SplitSolution(container.Value, containerSolution, cryoPod.BeakerTransferAmount);
var solutionToInject = _solutionContainerSystem.SplitSolution(containerSolution.Value, cryoPod.BeakerTransferAmount);
_bloodstreamSystem.TryAddToChemicals(patient.Value, solutionToInject, bloodstream);
_reactiveSystem.DoEntityReaction(patient.Value, solutionToInject, ReactionMethod.Injection);
}
@@ -123,7 +123,7 @@ public sealed partial class CryoPodSystem: SharedCryoPodSystem
{
if (!Resolve(uid, ref cryoPodComponent))
return null;
if (cryoPodComponent.BodyContainer.ContainedEntity is not {Valid: true} contained)
if (cryoPodComponent.BodyContainer.ContainedEntity is not { Valid: true } contained)
return null;
base.EjectBody(uid, cryoPodComponent);
_climbSystem.ForciblySetClimbing(contained, uid);
@@ -132,12 +132,12 @@ public sealed partial class CryoPodSystem: SharedCryoPodSystem
#region Interaction
private void HandleDragDropOn(EntityUid uid, CryoPodComponent cryoPodComponent, ref DragDropTargetEvent args)
private void HandleDragDropOn(Entity<CryoPodComponent> entity, ref DragDropTargetEvent args)
{
if (cryoPodComponent.BodyContainer.ContainedEntity != null)
if (entity.Comp.BodyContainer.ContainedEntity != null)
return;
var doAfterArgs = new DoAfterArgs(EntityManager, args.User, cryoPodComponent.EntryDelay, new CryoPodDragFinished(), uid, target: args.Dragged, used: uid)
var doAfterArgs = new DoAfterArgs(EntityManager, args.User, entity.Comp.EntryDelay, new CryoPodDragFinished(), entity, target: args.Dragged, used: entity)
{
BreakOnDamage = true,
BreakOnTargetMove = true,
@@ -148,61 +148,65 @@ public sealed partial class CryoPodSystem: SharedCryoPodSystem
args.Handled = true;
}
private void OnDragFinished(EntityUid uid, CryoPodComponent component, CryoPodDragFinished args)
private void OnDragFinished(Entity<CryoPodComponent> entity, ref CryoPodDragFinished args)
{
if (args.Cancelled || args.Handled || args.Args.Target == null)
return;
if (InsertBody(uid, args.Args.Target.Value, component))
if (InsertBody(entity.Owner, args.Args.Target.Value, entity.Comp))
{
if (!TryComp(uid, out CryoPodAirComponent? cryoPodAir))
if (!TryComp(entity.Owner, out CryoPodAirComponent? cryoPodAir))
_adminLogger.Add(LogType.Action, LogImpact.Medium,
$"{ToPrettyString(args.User)} inserted {ToPrettyString(args.Args.Target.Value)} into {ToPrettyString(uid)}");
$"{ToPrettyString(args.User)} inserted {ToPrettyString(args.Args.Target.Value)} into {ToPrettyString(entity.Owner)}");
_adminLogger.Add(LogType.Action, LogImpact.Medium,
$"{ToPrettyString(args.User)} inserted {ToPrettyString(args.Args.Target.Value)} into {ToPrettyString(uid)} which contains gas: {cryoPodAir!.Air.ToPrettyString():gasMix}");
$"{ToPrettyString(args.User)} inserted {ToPrettyString(args.Args.Target.Value)} into {ToPrettyString(entity.Owner)} which contains gas: {cryoPodAir!.Air.ToPrettyString():gasMix}");
}
args.Handled = true;
}
private void OnActivateUIAttempt(EntityUid uid, CryoPodComponent cryoPodComponent, ActivatableUIOpenAttemptEvent args)
private void OnActivateUIAttempt(Entity<CryoPodComponent> entity, ref ActivatableUIOpenAttemptEvent args)
{
if (args.Cancelled)
{
return;
}
var containedEntity = cryoPodComponent.BodyContainer.ContainedEntity;
if (containedEntity == null || containedEntity == args.User || !HasComp<ActiveCryoPodComponent>(uid))
var containedEntity = entity.Comp.BodyContainer.ContainedEntity;
if (containedEntity == null || containedEntity == args.User || !HasComp<ActiveCryoPodComponent>(entity))
{
args.Cancel();
}
}
private void OnActivateUI(EntityUid uid, CryoPodComponent cryoPodComponent, AfterActivatableUIOpenEvent args)
private void OnActivateUI(Entity<CryoPodComponent> entity, ref AfterActivatableUIOpenEvent args)
{
TryComp<TemperatureComponent>(cryoPodComponent.BodyContainer.ContainedEntity, out var temp);
TryComp<BloodstreamComponent>(cryoPodComponent.BodyContainer.ContainedEntity, out var bloodstream);
TryComp<TemperatureComponent>(entity.Comp.BodyContainer.ContainedEntity, out var temp);
TryComp<BloodstreamComponent>(entity.Comp.BodyContainer.ContainedEntity, out var bloodstream);
_userInterfaceSystem.TrySendUiMessage(
uid,
entity.Owner,
HealthAnalyzerUiKey.Key,
new HealthAnalyzerScannedUserMessage(GetNetEntity(cryoPodComponent.BodyContainer.ContainedEntity),
temp?.CurrentTemperature ?? 0, bloodstream != null ? bloodstream.BloodSolution.FillFraction : 0));
new HealthAnalyzerScannedUserMessage(GetNetEntity(entity.Comp.BodyContainer.ContainedEntity),
temp?.CurrentTemperature ?? 0,
(bloodstream != null && _solutionContainerSystem.ResolveSolution(entity.Owner, bloodstream.BloodSolutionName, ref bloodstream.BloodSolution, out var bloodSolution))
? bloodSolution.FillFraction
: 0
));
}
private void OnInteractUsing(EntityUid uid, CryoPodComponent cryoPodComponent, InteractUsingEvent args)
private void OnInteractUsing(Entity<CryoPodComponent> entity, ref InteractUsingEvent args)
{
if (args.Handled || !cryoPodComponent.Locked || cryoPodComponent.BodyContainer.ContainedEntity == null)
if (args.Handled || !entity.Comp.Locked || entity.Comp.BodyContainer.ContainedEntity == null)
return;
args.Handled = _toolSystem.UseTool(args.Used, args.User, uid, cryoPodComponent.PryDelay, "Prying", new CryoPodPryFinished());
args.Handled = _toolSystem.UseTool(args.Used, args.User, entity.Owner, entity.Comp.PryDelay, "Prying", new CryoPodPryFinished());
}
private void OnExamined(EntityUid uid, CryoPodComponent component, ExaminedEvent args)
private void OnExamined(Entity<CryoPodComponent> entity, ref ExaminedEvent args)
{
var container = _itemSlotsSystem.GetItemOrNull(uid, component.SolutionContainerName);
if (args.IsInDetailsRange && container != null && _solutionContainerSystem.TryGetFitsInDispenser(container.Value, out var containerSolution))
var container = _itemSlotsSystem.GetItemOrNull(entity.Owner, entity.Comp.SolutionContainerName);
if (args.IsInDetailsRange && container != null && _solutionContainerSystem.TryGetFitsInDispenser(container.Value, out _, out var containerSolution))
{
args.PushMarkup(Loc.GetString("cryo-pod-examine", ("beaker", Name(container.Value))));
if (containerSolution.Volume == 0)
@@ -212,64 +216,63 @@ public sealed partial class CryoPodSystem: SharedCryoPodSystem
}
}
private void OnPowerChanged(EntityUid uid, CryoPodComponent component, ref PowerChangedEvent args)
private void OnPowerChanged(Entity<CryoPodComponent> entity, ref PowerChangedEvent args)
{
// Needed to avoid adding/removing components on a deleted entity
if (Terminating(uid))
if (Terminating(entity))
{
return;
}
if (args.Powered)
{
EnsureComp<ActiveCryoPodComponent>(uid);
EnsureComp<ActiveCryoPodComponent>(entity);
}
else
{
RemComp<ActiveCryoPodComponent>(uid);
_uiSystem.TryCloseAll(uid, HealthAnalyzerUiKey.Key);
RemComp<ActiveCryoPodComponent>(entity);
_uiSystem.TryCloseAll(entity.Owner, HealthAnalyzerUiKey.Key);
}
UpdateAppearance(uid, component);
UpdateAppearance(entity.Owner, entity.Comp);
}
#endregion
#region Atmos handler
private void OnCryoPodUpdateAtmosphere(EntityUid uid, CryoPodComponent cryoPod, ref AtmosDeviceUpdateEvent args)
private void OnCryoPodUpdateAtmosphere(Entity<CryoPodComponent> entity, ref AtmosDeviceUpdateEvent args)
{
if (!TryComp(uid, out NodeContainerComponent? nodeContainer))
if (!TryComp(entity, out NodeContainerComponent? nodeContainer))
return;
if (!_nodeContainer.TryGetNode(nodeContainer, cryoPod.PortName, out PortablePipeNode? portNode))
if (!_nodeContainer.TryGetNode(nodeContainer, entity.Comp.PortName, out PortablePipeNode? portNode))
return;
if (!TryComp(uid, out CryoPodAirComponent? cryoPodAir))
if (!TryComp(entity, out CryoPodAirComponent? cryoPodAir))
return;
_atmosphereSystem.React(cryoPodAir.Air, portNode);
if (portNode.NodeGroup is PipeNet {NodeCount: > 1} net)
if (portNode.NodeGroup is PipeNet { NodeCount: > 1 } net)
{
_gasCanisterSystem.MixContainerWithPipeNet(cryoPodAir.Air, net.Air);
}
}
private void OnGasAnalyzed(EntityUid uid, CryoPodComponent component, GasAnalyzerScanEvent args)
private void OnGasAnalyzed(Entity<CryoPodComponent> entity, ref GasAnalyzerScanEvent args)
{
if (!TryComp(uid, out CryoPodAirComponent? cryoPodAir))
if (!TryComp(entity, out CryoPodAirComponent? cryoPodAir))
return;
var gasMixDict = new Dictionary<string, GasMixture?> { { Name(uid), cryoPodAir.Air } };
var gasMixDict = new Dictionary<string, GasMixture?> { { Name(entity.Owner), cryoPodAir.Air } };
// If it's connected to a port, include the port side
if (TryComp(uid, out NodeContainerComponent? nodeContainer))
if (TryComp(entity, out NodeContainerComponent? nodeContainer))
{
if (_nodeContainer.TryGetNode(nodeContainer, component.PortName, out PipeNode? port))
gasMixDict.Add(component.PortName, port.Air);
if (_nodeContainer.TryGetNode(nodeContainer, entity.Comp.PortName, out PipeNode? port))
gasMixDict.Add(entity.Comp.PortName, port.Air);
}
args.GasMixtures = gasMixDict;
}
#endregion
}

View File

@@ -1,7 +1,9 @@
using Content.Server.Administration.Logs;
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Medical.Components;
using Content.Server.Popups;
using Content.Server.Stack;
using Content.Shared.Audio;
using Content.Shared.Damage;
@@ -15,8 +17,6 @@ using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Stacks;
using Content.Server.Popups;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Random;
@@ -34,6 +34,7 @@ public sealed class HealingSystem : EntitySystem
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly MobThresholdSystem _mobThresholdSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
public override void Initialize()
{
@@ -43,7 +44,7 @@ public sealed class HealingSystem : EntitySystem
SubscribeLocalEvent<DamageableComponent, HealingDoAfterEvent>(OnDoAfter);
}
private void OnDoAfter(EntityUid uid, DamageableComponent component, HealingDoAfterEvent args)
private void OnDoAfter(Entity<DamageableComponent> entity, ref HealingDoAfterEvent args)
{
var dontRepeat = false;
@@ -54,8 +55,8 @@ public sealed class HealingSystem : EntitySystem
return;
if (healing.DamageContainers is not null &&
component.DamageContainerID is not null &&
!healing.DamageContainers.Contains(component.DamageContainerID))
entity.Comp.DamageContainerID is not null &&
!healing.DamageContainers.Contains(entity.Comp.DamageContainerID))
{
return;
}
@@ -63,22 +64,22 @@ public sealed class HealingSystem : EntitySystem
// Heal some bloodloss damage.
if (healing.BloodlossModifier != 0)
{
if (!TryComp<BloodstreamComponent>(uid, out var bloodstream))
if (!TryComp<BloodstreamComponent>(entity, out var bloodstream))
return;
var isBleeding = bloodstream.BleedAmount > 0;
_bloodstreamSystem.TryModifyBleedAmount(uid, healing.BloodlossModifier);
_bloodstreamSystem.TryModifyBleedAmount(entity.Owner, healing.BloodlossModifier);
if (isBleeding != bloodstream.BleedAmount > 0)
{
dontRepeat = true;
_popupSystem.PopupEntity(Loc.GetString("medical-item-stop-bleeding"), uid, args.User);
_popupSystem.PopupEntity(Loc.GetString("medical-item-stop-bleeding"), entity, args.User);
}
}
// Restores missing blood
if (healing.ModifyBloodLevel != 0)
_bloodstreamSystem.TryModifyBloodLevel(uid, healing.ModifyBloodLevel);
_bloodstreamSystem.TryModifyBloodLevel(entity.Owner, healing.ModifyBloodLevel);
var healed = _damageable.TryChangeDamage(uid, healing.Damage, true, origin: args.Args.User);
var healed = _damageable.TryChangeDamage(entity.Owner, healing.Damage, true, origin: args.Args.User);
if (healed == null && healing.BloodlossModifier != 0)
return;
@@ -99,10 +100,10 @@ public sealed class HealingSystem : EntitySystem
QueueDel(args.Used.Value);
}
if (uid != args.User)
if (entity.Owner != args.User)
{
_adminLogger.Add(LogType.Healed,
$"{EntityManager.ToPrettyString(args.User):user} healed {EntityManager.ToPrettyString(uid):target} for {total:damage} damage");
$"{EntityManager.ToPrettyString(args.User):user} healed {EntityManager.ToPrettyString(entity.Owner):target} for {total:damage} damage");
}
else
{
@@ -110,12 +111,12 @@ public sealed class HealingSystem : EntitySystem
$"{EntityManager.ToPrettyString(args.User):user} healed themselves for {total:damage} damage");
}
_audio.PlayPvs(healing.HealingEndSound, uid, AudioHelpers.WithVariation(0.125f, _random).WithVolume(-5f));
_audio.PlayPvs(healing.HealingEndSound, entity.Owner, AudioHelpers.WithVariation(0.125f, _random).WithVolume(-5f));
// Logic to determine the whether or not to repeat the healing action
args.Repeat = (HasDamage(component, healing) && !dontRepeat);
args.Repeat = (HasDamage(entity.Comp, healing) && !dontRepeat);
if (!args.Repeat && !dontRepeat)
_popupSystem.PopupEntity(Loc.GetString("medical-item-finished-using", ("item", args.Used)), uid, args.User);
_popupSystem.PopupEntity(Loc.GetString("medical-item-finished-using", ("item", args.Used)), entity.Owner, args.User);
args.Handled = true;
}
@@ -134,21 +135,21 @@ public sealed class HealingSystem : EntitySystem
return false;
}
private void OnHealingUse(EntityUid uid, HealingComponent component, UseInHandEvent args)
private void OnHealingUse(Entity<HealingComponent> entity, ref UseInHandEvent args)
{
if (args.Handled)
return;
if (TryHeal(uid, args.User, args.User, component))
if (TryHeal(entity, args.User, args.User, entity.Comp))
args.Handled = true;
}
private void OnHealingAfterInteract(EntityUid uid, HealingComponent component, AfterInteractEvent args)
private void OnHealingAfterInteract(Entity<HealingComponent> entity, ref AfterInteractEvent args)
{
if (args.Handled || !args.CanReach || args.Target == null)
return;
if (TryHeal(uid, args.User, args.Target.Value, component))
if (TryHeal(entity, args.User, args.Target.Value, entity.Comp))
args.Handled = true;
}
@@ -170,10 +171,14 @@ public sealed class HealingSystem : EntitySystem
if (TryComp<StackComponent>(uid, out var stack) && stack.Count < 1)
return false;
if (!TryComp<BloodstreamComponent>(target, out var bloodstream))
return false;
var anythingToDo =
HasDamage(targetDamage, component) ||
component.ModifyBloodLevel > 0 // Special case if healing item can restore lost blood...
&& TryComp<BloodstreamComponent>(target, out var bloodstream)
&& _solutionContainerSystem.ResolveSolution(target, bloodstream.BloodSolutionName, ref bloodstream.BloodSolution, out var bloodSolution)
&& bloodSolution.Volume < bloodSolution.MaxVolume; // ...and there is lost blood to restore.
if (!HasDamage(targetDamage, component) && !(bloodstream.BloodSolution.Volume < bloodstream.BloodSolution.MaxVolume && component.ModifyBloodLevel > 0))
if (!anythingToDo)
{
_popupSystem.PopupEntity(Loc.GetString("medical-item-cant-use", ("item", uid)), uid, user);
return false;

View File

@@ -1,14 +1,14 @@
using Content.Server.Body.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Medical.Components;
using Content.Server.PowerCell;
using Content.Server.Temperature.Components;
using Content.Shared.Damage;
using Content.Shared.DoAfter;
using Content.Shared.Interaction;
using Content.Shared.MedicalScanner;
using Content.Shared.Mobs.Components;
using Robust.Server.GameObjects;
using Content.Server.Temperature.Components;
using Content.Server.Body.Components;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Player;
@@ -19,6 +19,7 @@ namespace Content.Server.Medical
[Dependency] private readonly PowerCellSystem _cell = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
public override void Initialize()
@@ -28,14 +29,14 @@ namespace Content.Server.Medical
SubscribeLocalEvent<HealthAnalyzerComponent, HealthAnalyzerDoAfterEvent>(OnDoAfter);
}
private void OnAfterInteract(EntityUid uid, HealthAnalyzerComponent healthAnalyzer, AfterInteractEvent args)
private void OnAfterInteract(Entity<HealthAnalyzerComponent> entity, ref AfterInteractEvent args)
{
if (args.Target == null || !args.CanReach || !HasComp<MobStateComponent>(args.Target) || !_cell.HasActivatableCharge(uid, user: args.User))
if (args.Target == null || !args.CanReach || !HasComp<MobStateComponent>(args.Target) || !_cell.HasActivatableCharge(entity.Owner, user: args.User))
return;
_audio.PlayPvs(healthAnalyzer.ScanningBeginSound, uid);
_audio.PlayPvs(entity.Comp.ScanningBeginSound, entity);
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, healthAnalyzer.ScanDelay, new HealthAnalyzerDoAfterEvent(), uid, target: args.Target, used: uid)
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, TimeSpan.FromSeconds(entity.Comp.ScanDelay), new HealthAnalyzerDoAfterEvent(), entity.Owner, target: args.Target, used: entity.Owner)
{
BreakOnTargetMove = true,
BreakOnUserMove = true,
@@ -43,14 +44,14 @@ namespace Content.Server.Medical
});
}
private void OnDoAfter(EntityUid uid, HealthAnalyzerComponent component, DoAfterEvent args)
private void OnDoAfter(Entity<HealthAnalyzerComponent> entity, ref HealthAnalyzerDoAfterEvent args)
{
if (args.Handled || args.Cancelled || args.Args.Target == null || !_cell.TryUseActivatableCharge(uid, user: args.User))
if (args.Handled || args.Cancelled || args.Target == null || !_cell.TryUseActivatableCharge(entity.Owner, user: args.User))
return;
_audio.PlayPvs(component.ScanningEndSound, args.Args.User);
_audio.PlayPvs(entity.Comp.ScanningEndSound, args.User);
UpdateScannedUser(uid, args.Args.User, args.Args.Target.Value, component);
UpdateScannedUser(entity, args.User, args.Target.Value, entity.Comp);
args.Handled = true;
}
@@ -73,13 +74,26 @@ namespace Content.Server.Medical
if (!HasComp<DamageableComponent>(target))
return;
TryComp<TemperatureComponent>(target, out var temp);
TryComp<BloodstreamComponent>(target, out var bloodstream);
float bodyTemperature;
if (TryComp<TemperatureComponent>(target, out var temp))
bodyTemperature = temp.CurrentTemperature;
else
bodyTemperature = float.NaN;
float bloodAmount;
if (TryComp<BloodstreamComponent>(target, out var bloodstream) &&
_solutionContainerSystem.ResolveSolution(target.Value, bloodstream.BloodSolutionName, ref bloodstream.BloodSolution, out var bloodSolution))
bloodAmount = bloodSolution.FillFraction;
else
bloodAmount = float.NaN;
OpenUserInterface(user, uid);
_uiSystem.SendUiMessage(ui, new HealthAnalyzerScannedUserMessage(GetNetEntity(target), temp != null ? temp.CurrentTemperature : float.NaN,
bloodstream != null ? bloodstream.BloodSolution.FillFraction : float.NaN));
_uiSystem.SendUiMessage(ui, new HealthAnalyzerScannedUserMessage(
GetNetEntity(target),
bodyTemperature,
bloodAmount
));
}
}
}

View File

@@ -1,17 +1,16 @@
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Fluids.EntitySystems;
using Content.Server.Forensics;
using Content.Server.Popups;
using Content.Server.Stunnable;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.IdentityManagement;
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.StatusEffect;
using Robust.Server.Audio;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
@@ -59,29 +58,32 @@ namespace Content.Server.Medical
// Empty the stomach out into it
foreach (var stomach in stomachList)
{
if (_solutionContainer.TryGetSolution(stomach.Comp.Owner, StomachSystem.DefaultSolutionName,
out var sol))
if (_solutionContainer.ResolveSolution(stomach.Comp.Owner, StomachSystem.DefaultSolutionName, ref stomach.Comp.Solution, out var sol))
{
solution.AddSolution(sol, _proto);
sol.RemoveAllSolution();
_solutionContainer.UpdateChemicals(stomach.Comp.Owner, sol);
_solutionContainer.UpdateChemicals(stomach.Comp.Solution.Value);
}
}
// Adds a tiny amount of the chem stream from earlier along with vomit
if (TryComp<BloodstreamComponent>(uid, out var bloodStream))
{
var chemMultiplier = 0.1;
var vomitMultiplier = 0.9;
const float chemMultiplier = 0.1f;
// Makes a vomit solution the size of 90% of the chemicals removed from the chemstream
var vomitAmount = new Solution("Vomit", solutionSize * vomitMultiplier);
var vomitAmount = solutionSize;
// Takes 10% of the chemicals removed from the chem stream
var vomitChemstreamAmount = _solutionContainer.SplitSolution(uid, bloodStream.ChemicalSolution, solutionSize * chemMultiplier);
if (_solutionContainer.ResolveSolution(uid, bloodStream.ChemicalSolutionName, ref bloodStream.ChemicalSolution))
{
var vomitChemstreamAmount = _solutionContainer.SplitSolution(bloodStream.ChemicalSolution.Value, vomitAmount);
vomitChemstreamAmount.ScaleSolution(chemMultiplier);
solution.AddSolution(vomitChemstreamAmount, _proto);
_solutionContainer.SplitSolution(uid, bloodStream.ChemicalSolution, solutionSize * vomitMultiplier);
solution.AddSolution(vomitAmount, _proto);
solution.AddSolution(vomitChemstreamAmount, _proto);
vomitAmount -= (float) vomitChemstreamAmount.Volume;
}
// Makes a vomit solution the size of 90% of the chemicals removed from the chemstream
solution.AddReagent("Vomit", vomitAmount); // TODO: Dehardcode vomit prototype
}
if (_puddle.TrySpillAt(uid, solution, out var puddle, false))